fix(server): recover from provider interrupt failures - #7412
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: Approved at Macroscope's review found this PR approvable — ... You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 94c2cb0. Configure here.

Fixes #7368
Problem
If a provider rejects an interrupt request, the projected session remains running and leaves the thread stuck in a working state.
Fix
Stop the provider session best-effort, then project the session as stopped, clear its active turn, and record the provider failure. Cancellation-only stop failures remain cancellations.
Verification
vp test run apps/server/src/orchestration/Layers/ProviderCommandReactor.test.tsvp run --filter t3 typecheckvp fmt --check apps/server/src/orchestration/Layers/ProviderCommandReactor.ts apps/server/src/orchestration/Layers/ProviderCommandReactor.test.tsCreated with GPT-5.6-terra in T3 Code.
Note
Fix
ProviderCommandReactorto recover from provider interrupt failuresWhen
providerService.interruptTurnfails during athread.turn-interrupt-requestedevent, the reactor now stops the session, clearsactiveTurnId, records the failure detail inlastError, and emits aprovider.turn.interrupt.failedactivity.stopSessionitself fails during recovery, a warning is logged but the failure is otherwise swallowed (except for pure interrupts).Macroscope summarized 7469c37.
Note
Medium Risk
Changes orchestration session lifecycle on interrupt failures in a critical reactor path, though recovery is guarded against overwriting ready/stopped state and is covered by new tests.
Overview
When a user interrupts a turn but
providerService.interruptTurnfails, threads no longer stay stuck in a running/working session state.processTurnInterruptRequestednow catches interrupt failures and runs recovery: it re-reads the latest projected session, skips work if the session already becameready,stopped, or the active turn changed, otherwise best-effortstopSession, then projects the session asstoppedwithactiveTurnIdcleared,lastErrorset from the provider error, and aprovider.turn.interrupt.failedactivity. Cancellation-only failures on stop are logged and do not block that projection.Tests add injectable
interruptTurnEffect/stopSessionEffecthooks and cover running andstartingsessions, plus a race where natural completion toreadymust not be overwritten.Reviewed by Cursor Bugbot for commit 7469c37. Bugbot is set up for automated code reviews on this repo. Configure here.