fix(server): mark superseded running turns interrupted #12221
main fromrefs/pull/12221/head·opened View on GitHubWhat Changed#
When a new active turn replaces a still-running turn, the projection now marks the earlier turn interrupted instead of completed. The existing regression asserts that state while preserving the settlement timestamp and the new turn's running state.
Why#
A new turn is not evidence that the previous turn completed successfully. After a provider interruption without a terminal event, the previous behavior hid unfinished work as completed. The change only affects superseded running turns; existing terminal turns keep their state.
Verification#
- The focused regression failed before the production change with actual
completedinstead of expectedinterrupted. node_modules/.bin/vitest run apps/server/src/orchestration/Layers/ProjectionPipeline.test.ts: 34 tests passed.- Server typecheck and focused formatting/lint passed. Independent Claude Sonnet 5 source review found no issues.
- Setup caveat: the repository's existing dependency-age policy rejected pinned
expo-image-manipulator@57.0.17. The isolated checkout was provisioned withpnpm install --frozen-lockfile --filter t3... --config.minimumReleaseAge=0; Vite+ checks used the same temporary environment override. No manifest or lockfile changed. The direct Vitest confirmation above used the already-installed dependencies. - This verifies the disposable in-memory event/SQLite projection. No installed-app end-to-end test or live database mutation was performed. The original provider termination cause remains unknown.
Checklist#
- This PR is small and focused
- I explained what changed and why
- No UI components or animations changed.
Generated by gpt-6-astra using the Codex harness.
Summary by CodeRabbit#
- Bug Fixes
- Updated turn status handling so that a previously running turn is marked as interrupted when a new active turn replaces it.
- Preserved the completion timestamp using the time the new turn became active.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
a9a8666Macroscope's review found this PR approvable — This is a narrowly scoped projection bug fix that correctly preserves superseded turns as interrupted rather than completed, with existing timestamps and new-turn behavior unchanged. The accompanying test verifies the corrected state, and no broader schema, configuration, or infrastructure behavior is affected.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
73c77f30-99c6-44de-ae66-51c69dd9c96d📥 Commits
Reviewing files that changed from the base of the PR and between 0150c6a53b409ba3bcb45645709b649cf8708354 and a9a8666c124ce57b17df59a18bafba3a500b5405.
📒 Files selected for processing (2)
apps/server/src/orchestration/Layers/ProjectionPipeline.test.tsapps/server/src/orchestration/Layers/ProjectionPipeline.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
When a new active turn replaces a running turn on the same thread, the projection now marks the prior turn as
interruptedinstead ofcompleted. The test now verifies this state and preserves the existing completion timestamp behavior.Changes#
Turn projection state
Layer / File(s) Summary Superseded turn state update
apps/server/src/orchestration/Layers/ProjectionPipeline.ts,apps/server/src/orchestration/Layers/ProjectionPipeline.test.tsThe projection marks superseded running turns as interrupted. The test updates its description and expected state. The completion timestamp remains the session update timestamp.Priority: ⬇️ Low
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix
Suggested reviewers:
t3dotggMerge Risk: ⚪ Minimal · up to
a9a86The narrow projection correction and regression test present no identified merge-blocking behavior.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely describes the main change: marking superseded running turns as interrupted. Description check ✅ Passed The description includes clear What Changed and Why sections, explains verification, confirms the PR is focused, and states that no UI changes were made. The UI Changes heading is omitted, but this is… Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2… Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. ✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Comment `@coderabbitai help` to get the list of available commands.juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.
This change touches ProjectionPipeline.ts, which the V2 merge removed. V2 persists and reads its own projections instead of the V1 read model.
Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed