fix(server): settle turns when provider interrupts fail - #7376
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This bug fix adds error handling when provider interrupts fail, ensuring threads settle to an error state rather than remaining inconsistent. While the change is focused and includes tests, the orchestration error-handling logic and the author's limited history with this file warrant human review. You can add or adjust custom eligibility rules. Learn more. |
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo Closing in favor of #7412. It already fixes the same provider interrupt failure and clears the stuck thread state. |
The stop button could leave a thread showing Working forever when the provider abort failed. The asynchronous reactor left the active turn set, while the provider failure never became visible to the user.
Interrupt failure is now fail-safe: T3 records a provider failure activity, attempts to stop the provider session, and clears the projected active turn even if session cleanup also fails.
Verification
Fixes #7368
Implemented with GPT-5.6 Sol through Codex in T3 Code.
Note
Medium Risk
Changes orchestration session state on interrupt failure paths; behavior is localized to ProviderCommandReactor with test coverage, but affects stop-button UX and projected thread state.
Overview
Fixes threads that could stay in Working forever when Stop failed because the provider abort errored and the reactor never cleared
activeTurnIdor surfaced the failure.Turn interrupt handling in
ProviderCommandReactoris now fail-safe: ifinterruptTurnfails, the reactor triesstopSession, then uses the sharedsetThreadSessionErrorhelper (renamed from the turn-start-only variant) to set session error, clear activeTurnId, and set lastError, and it records aprovider.turn.interrupt.failedactivity. Recovery still runs when session stop also fails.A regression test covers the case where both interrupt and stop fail against an unavailable OpenCode server.
Reviewed by Cursor Bugbot for commit 4eb952e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Handle provider turn interrupt failures by settling thread session with error state
providerService.interruptTurnfails, the handler now attemptsproviderService.stopSession, marks the thread session as error with the failure detail, and appends aprovider.turn.interrupt.failedactivity.stopSessionalso fails, a warning is logged with both the stop cause and the original interrupt cause; the thread is still settled.setThreadSessionErrorOnTurnStartFailureutility tosetThreadSessionErrorand reuses it across both turn start and interrupt failure paths in ProviderCommandReactor.ts.Macroscope summarized 4eb952e.