fix(orchestration): scope assistant IDs by turn#42
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAssistant message IDs now include the turn ID when available. Runtime ingestion uses centralized ID helpers across deltas, completions, and diff checkpoints, with tests covering resumed sessions that reuse item IDs. ChangesAssistant message identity
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant RuntimeEvent
participant processRuntimeEvent
participant assistantMessageIdForEvent
participant AssistantMessage
RuntimeEvent->>processRuntimeEvent: assistant delta or completion event
processRuntimeEvent->>assistantMessageIdForEvent: derive base key and turn-scoped ID
assistantMessageIdForEvent-->>processRuntimeEvent: MessageId
processRuntimeEvent->>AssistantMessage: dispatch assistant update or completion
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@maria-rcks — small Cursor reliability fix when you have a minute. #42 prevents resumed Cursor sessions from reusing assistant message IDs across turns, which could make a new reply overwrite an older message and appear in the wrong place. The fix scopes assistant IDs by turn. I verified it before reaching out:
This is a focused port of the fix from No pressure—just thought it might be useful here too. Thanks for all your work on t1code; I’m really enjoying the project! |
What changed
assistant:session-1:segment:0across two turns and verify both replies remain distinct.Why
Cursor ACP can reuse assistant segment item IDs after a session resumes. Those IDs are persisted as message primary keys, so the second reply can update an older assistant row and appear above the latest user message instead of creating a new reply.
This is a focused port of the ID-collision fix from pingdotgg/t3code#3642. It intentionally ports the collision prevention only: turn-scoped IDs make the cross-turn projection merge unnecessary and avoid bringing over unrelated projection behavior.
Existing persisted IDs remain valid; newly ingested assistant events use the turn-scoped shape when a turn ID is available and preserve the legacy shape otherwise.
Verification
bun fmtbun lint(passes with 9 pre-existing warnings)bun typecheckbun run --cwd apps/server test src/orchestration/assistantMessageIds.test.ts src/orchestration/Layers/ProviderRuntimeIngestion.test.ts(31 tests passed)Made with Cursor
Summary by CodeRabbit
Bug Fixes
Tests