Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced 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 |
| const unsubscribeAssistant = openCodeHost.subscribeAssistantState(() => | ||
| bus.publish({ type: "assistant.state", snapshot: getAssistantState() }), | ||
| const openCodeAssociations = new OpenCodeAssociations(assistantSessions); | ||
| const assistantLifecycle = new AssistantLifecycleCoordinator({ store: assistantSessions, host: openCodeHost, associations: openCodeAssociations }); |
There was a problem hiding this comment.
🔴 Closed sessions retain Assistant runtimes
Closing a Studio session never calls assistantLifecycle.beginEnd, so its lease and native runtime remain active. An open pane can continue Assistant requests after closure.
Learn more
The lifecycle coordinator owns the fence that invalidates leases, retires the native Assistant process, and persists ending then ended. Production creates this coordinator but never invokes that flow for a Studio session close. The deletion route still calls sessionManager.close directly, while Assistant request admission only consults the coordinator lease and durable lifecycle. Closing the Terminal therefore leaves the Assistant process and lease usable.
Example: Alice opens Assistant, receives a lease, then closes the Studio tab. The DELETE request closes the Terminal, but the mounted pane can still send a leased Assistant request. The expected result is immediate rejection and retirement of both runtimes.
Recommended fix: Add one close orchestration boundary used by the REST deletion route. It must call assistantLifecycle.beginEnd(id) synchronously, join sessionManager.closeWithResult(id), Assistant retirement, and lifecycle persistence, then call assistantLifecycle.finishEnd(fence) only after the required cleanup result. Coalesce concurrent close callers through the complete operation as required by beginEnd.
Was this helpful? React with 👍 or 👎 to provide feedback.
| return { | ||
| ...runtime, | ||
| revision, | ||
| lifecycles: runtime.enabled ? lifecycle.snapshot() : [], |
Primary change type
Problem and motivation
Reopening Assistant history currently lets the browser request recovery of old unfinished work. An obsolete pane also needs to lose authority when its Studio session ends or its native runtime changes.
Summary and scope
Pair the browser's validated lifecycle handshake and runtime lease with production server admission. Restored runtimes remain paused until explicit Send, including both acknowledgment/history arrival orders. Publish lifecycle and native observation updates under one ordered state clock. Fence Terminal and Assistant admission together during shutdown, and reject new attaches while cancelled old association work is still pending.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #999; pairs the adapter in #997. Native stack target: main. Fixed Epic 2 context/runtime ancestry is preserved; its production activation and artifact pin remain separately owned.
Validation
Tests and documentation
Tests cover paused recovery, both Send acknowledgment/history orders, exact lease headers, stale attachment disposal, End-before-attach, lifecycle snapshot validation, authority removal, and shutdown admission. Seven screenshots and command/mutation evidence are retained in the workspace handoff. Browser evidence uses deterministic HTTP/SSE fixtures; installed native acceptance remains a later integration gate. The repository has no pr:size script; measured increment: 833 changed lines including tests and changeset.
Compatibility and release impact
Security
AI assistance
Checklist
Review evidence
These images show disposable browser fixture states before and after an explicit user action, not a historical pre-implementation baseline. They do not establish native execution or an installed activated release.