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 pending = this.pending.get(id); | ||
| if (pending) | ||
| return pending.revision === expectedRevision | ||
| ? pending.promise | ||
| : Promise.reject(failure("lifecycle_changed")); |
There was a problem hiding this comment.
🟡 Shutdown reuses stale attach admission
After shutdown, attach returns an existing pending attachment before checking closed admission. Cancellation-ignoring association work leaves same-session callers hanging instead of receiving lifecycle_changed.
| const pending = this.pending.get(id); | |
| if (pending) | |
| return pending.revision === expectedRevision | |
| ? pending.promise | |
| : Promise.reject(failure("lifecycle_changed")); | |
| if (this.closed) return Promise.reject(failure("lifecycle_changed")); | |
| const pending = this.pending.get(id); | |
| if (pending) | |
| return pending.revision === expectedRevision | |
| ? pending.promise | |
| : Promise.reject(failure("lifecycle_changed")); |
Was this helpful? React with 👍 or 👎 to provide feedback.
Primary change type
Problem and motivation
A stale pane must not obtain execution after End or same-ID restoration. Context preparation can also ignore cancellation and leave old dispatch admission or recovery locks blocking the replacement runtime.
Summary and scope
Add a durable lifecycle coordinator with expected revisions, exact runtime leases, paused restoration, and an immediate End fence. Isolate in-memory dispatch admission by hosted runtime while preserving durable replay fences. Cancel pre-dispatch provider waits so late preparation results cannot submit work or hold the recovery lock. The next increment pairs these contracts with the router and browser.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Native stack target:
main. Depends on the preceding branch, preserving Epic 2 dependency ancestry through #987. Depends on #995. Shared context types and dispatch ownership retain the fixed Epic 2 ancestry; production activation/pin remains with that owner.Validation
Independent review reproduced the stale durable-revision, hung-attach, cross-runtime admission, and held recovery-lock cases before correction. Browser/production wiring is delivered in the dependent increment; this PR changes server primitives and cancellation only.
pr:sizeis absent in sapiom-js; incrementalgit diff --numstatmeasures 812 changed lines, including tests.Tests and documentation
Regression tests cover durable End, stale leases, paused restart, access change, old attach completion, ignored cancellation, recovery lock release, and durable replay-fence preservation. The End orchestration caller must coalesce requests through Terminal/native cleanup and persistence.
Compatibility and release impact
@sapiom/harness.Security
AI assistance
Checklist