Topic/upstream session lifecycle 20260412#167
Merged
everett4320 merged 6 commits intoOpenLAIR:mainfrom Apr 12, 2026
Merged
Conversation
Scope (public upstream branch only):\n- Port queue/steer workflow for chat dispatch, including queued-turn persistence, steer promotion, pause/resume semantics, and settlement reconciliation.\n- Add session scope isolation helpers and tests to prevent cross-project/provider session collisions when session IDs overlap.\n- Strengthen realtime protocol with explicit lifecycle events: session-accepted, session-busy, and session-state-changed.\n- Enrich lifecycle/session-created payloads with projectName metadata for more reliable client-side routing and state ownership.\n- Keep Nano provider command/session status flows aligned with other providers in active-session and lifecycle handling.\n\nUpstream safety constraints applied:\n- Excluded local/private product policy changes (Codex-only strategy, auth/license stack, workspace-root hard-cut/backfill behavior).\n- Excluded branding and private demo/link routing changes (kept Dr. Claw naming).\n- Avoided introducing server-side CODEX_ONLY/provider lock-in behavior into upstream.\n\nCompatibility notes:\n- Lifecycle protocol additions are provider-agnostic and transport-level; no Windows-only behavior was hardcoded.\n- Existing macOS/Linux provider command paths remain unchanged.\n\nValidation:\n- node --check server/index.js\n- node --check server/claude-sdk.js\n- node --check server/cursor-cli.js\n- node --check server/gemini-cli.js\n- npm run test -- ... (blocked: vitest executable missing in this environment)\n- npm run typecheck (blocked: tsc executable missing in this environment)
This was referenced Apr 12, 2026
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes multi-provider session lifecycle stability and performance issues on
topic/upstream-session-lifecycle-20260412, while keeping full provider support (claude/cursor/codex/gemini/openrouter/local/nano).Key outcomes:
FOREIGN KEY constraint failednoise.Root Causes Addressed
sessionIdin several paths instead of consistently usingactualSessionId ?? sessionId.session.idonly, which is insufficient in multi-provider / multi-project contexts.~/.codex/sessions, causing heavy latency under concurrent usage.ownerUserIdin config could violate DB FK constraints.What Changed
Frontend
OPTIMISTIC_SESSION_CREATED_EVENT) with scoped dedup identityproject::provider::sessionId.actualSessionId ?? sessionId.new-session-*/temp-*)project+session(+provider)compatibilityproject-onlyfallback to avoid cross-session replayBackend
session-createdevent builder includingprojectName.ownerUserIdvalidation/fallback to authenticated/valid user to avoid FK errors.Compatibility
Verification
Automated
npm run typecheck✅npm run test -- --run --maxWorkers=1✅19 passed files / 110 passed testsManual smoke