fix(ai): retry and diagnose transient provider failures

This commit is contained in:
Abeautifulsnow
2026-09-11 18:04:59 +08:00
committed by GitHub
parent 27f21d5cc4
commit 6f259a60c5
2 changed files with 1157 additions and 134 deletions
+13
View File
@@ -608,6 +608,19 @@ pub async fn run_agent_loop(
final_text.push_str(&message);
}
LoopExit::Interrupted(error) => {
// The retry layer records the HTTP-level cause; this records the
// agent-level exit so a failure still leaves a trace even after the
// user dismisses the on-screen message. Cancellation has its own arm
// above and never reaches here. The error is re-scrubbed here so a
// credential cannot reach the log file even if a provider echo slipped
// past the source-side redaction.
let error = ai::redact_secrets(&error, &ai::sensitive_values(config));
log::warn!(
"[agent] stream interrupted; provider={:?} model={} agent_mode={} error={error}",
config.provider,
config.model,
is_agent_mode
);
let message = if final_text.trim().is_empty() {
format!("Agent stream stopped before completion: {error}.")
} else {
+1144 -134
View File
File diff suppressed because it is too large Load Diff