GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(server): keep turn interrupts responsive by NeilTheFisher · Pull Request #6531 · pingdotgg/t3code 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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -1409,7 +1414,9 @@ const make = Effect.gen(function* () { | |||
| event.type === "thread.user-input-response-requested" || | |||
| event.type === "thread.session-stop-requested" | |||
| ) { | |||
| return yield* worker.enqueue(event); | |||
| return yield* event.type === "thread.turn-interrupt-requested" | |||
| ? interruptWorker.enqueue(event) | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟠 High Layers/ProviderCommandReactor.ts:1418
A thread.turn-interrupt-requested can be processed before the same thread’s queued thread.turn-start-requested finishes, so providerService.interruptTurn runs before the provider session or turn exists; its failure is only logged, and the later turn starts without ever being interrupted. Coordinate the two lanes per thread while allowing interrupts for unrelated threads to bypass blocked work.
In file @apps/server/src/orchestration/Layers/ProviderCommandReactor.ts around line 1418:
A `thread.turn-interrupt-requested` can be processed before the same thread’s queued `thread.turn-start-requested` finishes, so `providerService.interruptTurn` runs before the provider session or turn exists; its failure is only logged, and the later turn starts without ever being interrupted. Coordinate the two lanes per thread while allowing interrupts for unrelated threads to bypass blocked work.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
ApprovabilityVerdict: Needs human review 2 blocking correctness issues found. Two High-severity findings identify race conditions where interrupts can process before turns start or where stale aborts can cancel subsequent turns. The changes also introduce new concurrency patterns in provider session management that warrant careful review. You can customize Macroscope's approvability policy. Learn more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9276f63 to
c9d0bcb
Compare
| context.activeTurnId = undefined; | ||
| context.activeAgent = undefined; | ||
| context.activeVariant = undefined; | ||
| yield* updateProviderSession(context, { status: "ready" }, { clearActiveTurnId: true }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟠 High Layers/OpenCodeAdapter.ts:1595
interruptTurn marks the session ready and clears activeTurnId before session.abort settles, so a new sendTurn can start on the same session while the old abort is pending; that abort can cancel the new turn. The later MessageAbortedError then reads the newer context.activeTurnId, clears it, and emits turn.aborted for the wrong turn. Prevent new prompts until the abort settles without delaying the local lifecycle update, or correlate the abort and error with the interrupted turn before mutating session state.
In file @apps/server/src/provider/Layers/OpenCodeAdapter.ts around line 1595:
`interruptTurn` marks the session `ready` and clears `activeTurnId` before `session.abort` settles, so a new `sendTurn` can start on the same session while the old abort is pending; that abort can cancel the new turn. The later `MessageAbortedError` then reads the newer `context.activeTurnId`, clears it, and emits `turn.aborted` for the wrong turn. Prevent new prompts until the abort settles without delaying the local lifecycle update, or correlate the abort and error with the interrupted turn before mutating session state.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c9d0bcb. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| Effect.mapError(toRequestError), | ||
| Effect.ignore({ log: true }), | ||
| Effect.forkIn(context.sessionScope), | ||
| ); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
High Severity
interruptTurn now returns after a local turn.aborted and forks session.abort without binding it to that turn. A follow-up send can start while the abort is still in flight, so the remote abort or a later MessageAbortedError can cancel or settle the new turn instead of the stopped one.
Reviewed by Cursor Bugbot for commit c9d0bcb. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| : event.type === "turn.completed" || event.type === "session.exited" | ||
| : event.type === "turn.completed" || | ||
| event.type === "turn.aborted" || | ||
| event.type === "session.exited" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Medium Severity
Ingestion now maps every turn.aborted to session ready with lastError cleared. OpenCode already emits turn.aborted when a fresh promptAsync fails, so that failure can overwrite recoverTurnStartFailure and hide the error in orchestration session state.
Reviewed by Cursor Bugbot for commit c9d0bcb. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together. Closing this interrupt implementation because it marks the session ready before the provider abort completes. A new turn can then start in the same OpenCode session and be cancelled by the delayed session-wide abort. The Stop latency problem is valid, but the fix must keep cancellation tied to the intended turn. If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed. If GitHub does not let you reopen it, leave a comment here and we'll take another look. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.