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 |
| this.subsessionBindings.get(id) === next | ||
| ) | ||
| this.subsessionBindings.set(id, current); | ||
| await this.persistSubsessionBindings().catch(() => {}); |
There was a problem hiding this comment.
🟡 Failed repair resurrects ended binding
When End overtakes the marker write, persistSubsessionBindings ignores a failed repair. Restarting can reload the stale binding and recover the ended session.
Learn more
The delayed restart write can finish after close() has durably removed the binding. The cancellation path then writes the current in-memory state again to repair that stale disk state. If this repair fails, the catch suppresses the only evidence that disk still contains the obsolete open marker. A later process start loads that marker without the End tombstone and can treat the delegated session as recoverable.
Example: Restart writes incarnation 2 after End has persisted an empty registry. The repair then fails with ENOSPC. End already returned successfully, but the next launch reads incarnation 2 as open.
Recommended fix: Do not suppress the compensating persistSubsessionBindings() failure. Propagate it, or serialize binding writes so the stale restart write cannot complete after End's authoritative deletion. Preserve the cancellation error only after durable state is known correct.
Was this helpful? React with 👍 or 👎 to provide feedback.
Primary change type
Problem and motivation
Shutdown omitted PTYs retained after unconfirmed cleanup. End could also delete a delegated-session binding while an older restart later recreated its marker.
Summary and scope
Retry termination of exact retained PTY handles during bounded shutdown without republishing them as live. Recheck End generations after restart probes and binding persistence, repairing only the authoritative marker state. Document that bounded registry retirement is distinct from process-exit proof.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #1003; addresses review of #995. Native stack target: main.
Validation
Tests and documentation
Regression gates cover retained-process liveness and signal failure, replacement races, End during vendor/history probes, delayed marker writes, and authority resolution. JSDoc records cleanup result semantics. Incremental size: 318 changed lines including tests; pr:size is absent.
Compatibility and release impact
Security
AI assistance
Checklist