fix(#1066): retry turn once on 401 before parking for re-login
This commit is contained in:
parent
ae695931ce
commit
cbd14e9cd0
2 changed files with 15 additions and 1 deletions
|
|
@ -320,6 +320,16 @@ pub async fn drive_turn(prompt: &str, files: &TurnFiles, bus: &Bus) -> TurnOutco
|
|||
// Rate-limited: no point retrying immediately — bubble up so the
|
||||
// serve loop can park + emit status before the next attempt.
|
||||
TurnOutcome::RateLimited => return TurnOutcome::RateLimited,
|
||||
// Auth failed: may be a transient token-refresh race or brief API
|
||||
// hiccup. Retry once before bubbling up so the serve loop parks for
|
||||
// re-login. The retry outcome is passed through unchanged — if it
|
||||
// fails again the serve loop handles it as usual.
|
||||
TurnOutcome::AuthFailed => {
|
||||
bus.emit(LiveEvent::Note {
|
||||
text: "got 401 — retrying once before parking for re-login".into(),
|
||||
});
|
||||
run_turn(prompt, files, bus).await
|
||||
}
|
||||
other => other,
|
||||
};
|
||||
// Proactive: a turn just completed on a still-healthy session. If its
|
||||
|
|
|
|||
Loading…
Reference in a new issue