fix(server): let stopped threads settle immediately - #5553
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 26db156 Small defensive bug fix using nullish coalescing to preserve No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
Stopping or interrupting a thread could make Settle fail for two minutes. The SQLite projection cleared the latest turn when the session returned to ready, so clients misclassified the last user message as a queued turn.
Keep the previous latest turn when a session has no active turn. The lifecycle test now verifies that turn history remains linked after the session ends.
Tested:
vp test run apps/server/src/orchestration/Layers/ProjectionPipeline.test.tsvp run --filter t3 typecheckMade by GPT-5.6 Sol in T3 Code using the Codex harness.
Note
Medium Risk
Changes orchestration projection semantics for all threads when sessions clear
activeTurnId; low blast radius but affects settle and client turn classification.Overview
Fixes Settle timing out and clients treating the last user message as a queued turn when a thread is stopped or interrupted.
On
thread.session-set, the threads projector no longer writeslatestTurnIdfromsession.activeTurnIdwhen that value is null. It keeps the existingprojection_threads.latest_turn_idso a terminal session (e.g.readywith no active turn) does not wipe turn history.The turn lifecycle test now asserts
latest_turn_idstays set after the session ends.Reviewed by Cursor Bugbot for commit 6374e09. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve
latestTurnIdin projection whensession.activeTurnIdis nullWhen handling a
thread.session-setevent, the projector in ProjectionPipeline.ts previously overwrotelatestTurnIdwithnullifsession.activeTurnIdwas absent. It now falls back to the existinglatestTurnIdvalue using null-coalescing. A corresponding test assertion was added to verifyprojection_threads.latest_turn_idis preserved correctly.Macroscope summarized 6374e09.