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 |
| if ( | ||
| state.revision !== expectedRevision || | ||
| state.lifecycle === "ending" || | ||
| (retain && state.lifecycle !== "open") | ||
| ) |
There was a problem hiding this comment.
🟡 Active leases survive continuation preparation
prepareContinuation accepts a session with an existing lease, so preparation can overlap live use of the same runtime. inspections blocks new attachment but neither rejects nor revokes the lease already stored in leases. Continuation seeding can race user dispatch and alter an active conversation.
Learn more
Continuation preparation uses the same admission slot as attachment and inspection, but the slot only prevents new operations from starting. An attachment completed before preparation leaves a lease in leases. Requests using that lease continue through use, which does not consult inspections. The callback can therefore mutate the native conversation while an already-admitted request uses it.
Example: A child is attached and receives a paused lease. Before or during enablement, a continuation retry calls prepareContinuation with the current revision. Preparation is admitted because the lifecycle is open, while the existing lease remains usable against the same host.
Recommended fix: Reject retained preparation when the session has a current lease. Permit an obsolete lease whose host is no longer current, since the retained path can safely allocate a replacement.
| if ( | |
| state.revision !== expectedRevision || | |
| state.lifecycle === "ending" || | |
| (retain && state.lifecycle !== "open") | |
| ) | |
| if ( | |
| state.revision !== expectedRevision || | |
| state.lifecycle === "ending" || | |
| (retain && | |
| (state.lifecycle !== "open" || | |
| this.leases.get(id)?.hosted.isCurrent() === true)) | |
| ) |
Was this helpful? React with 👍 or 👎 to provide feedback.
| prepareContinuation<T>( | ||
| id: string, | ||
| expectedRevision: number, | ||
| prepare: (hosted: HostedOpenCode, signal: AbortSignal) => Promise<T>, | ||
| callerSignal?: AbortSignal, | ||
| ): Promise<T> { | ||
| return this.prepareRuntime(id, expectedRevision, prepare, true, callerSignal); |
There was a problem hiding this comment.
Primary change type
Problem and motivation
Continue needs exclusive ownership while preparing a paused child, before ordinary attachment is allowed. A lost acceptance acknowledgement must also not let retried pending input repair lost committed source material.
Summary and scope
Expose trusted continuation preparation through the existing lifecycle ownership slot, retaining only the validated exact host and granting no lease. End preempts preparation. When an acceptance manifest already exists, validate its original content and retained material before any retry writes, preserving the source store as the authority.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #1010. Native stack target: main. Native preparation and Continue API consumers follow.
Validation
Tests and documentation
Covers gated child preparation, shared-slot exclusion, paused handoff, exact failure cleanup, stale/ended revisions, End during preparation, and rejection without repair after committed material loss. Updated assistant-continuation.md. Increment:154 changed lines including tests/docs/changeset; pr:size is absent.
Compatibility and release impact
Security
AI assistance
Checklist