You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(daemon): admit history shutdowns before connection preparation - #33504
A keep-history shutdown could yield while preparing its connection before registering itself with the disconnect drain. If disconnectOnly() started during that gap, it could close the connection before shutdown finished saving history and retiring the PTY.
Register the complete keep-history operation synchronously before connection preparation starts. Preserve the existing spawn-lock order, absolute deadlines, checkpoint/recovery checks, and kill/cleanup sequence. Calls admitted after disconnect starts still reject.
Validation:
A deterministic regression blocks connection preparation, starts disconnect, and verifies the admitted shutdown finishes with saved history. It fails on the original implementation at the admission assertion and passes with this fix.
All 18 history/admission cases and 87 adoption, deadline, WSL, upgrade, and idle-shutdown cases pass.
Two independent native Codex source reviews approve the committed files, including concurrency, rejection handling, cleanup, and platform boundaries.
pnpm check:changed --maxWorkers=2 --base=048bc0f30984602492c735a5d5dbf55b0abd60aa: all 20 checks passed.
The original refactor-audit merge validator passes against fresh main; only the two approved paths change, and the original history suite is untouched.
This is a separate behavior fix discovered during module-organization CI investigation. The exact interleaving behind that earlier CI failure has not been reproduced.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Walkthrough
Non-history-preserving shutdowns now run under the history/spawn lock. History-preserving shutdowns start connection and session adoption before acquiring the lock, and the operation is tracked while it runs. A new test checks admission before connection preparation completes, rejection of a later shutdown, and the resulting session and checkpoint state.
Priority: Normal
Merge Risk: Minimal · up to f4e60
The admitted history-preserving shutdown is allowed to finish before disconnect closes the connection. No actionable merge-blocking issue remains after normal checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description explains the race, the fix, the preserved behavior, and the validation performed. However, it omits the required template sections and information, including an actual Linked Issue ref…
Use the repository template headings. Add an actual issue link after “Fixes #”. Add an ELI5 explanation, mark Visual Proof as N/A with a reason if applicable, complete the Testing and Checklist items, and state the impact or N/A status for …
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: admitting history-preserving daemon shutdowns before connection preparation.
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files.
Full details: Description check
Explanation
The description explains the race, the fix, the preserved behavior, and the validation performed. However, it omits the required template sections and information, including an actual Linked Issue reference, ELI5, Visual Proof with an N/A explanation, checklist confirmations, and explicit notes on the required compatibility areas.
Resolution
Use the repository template headings. Add an actual issue link after “Fixes #”. Add an ELI5 explanation, mark Visual Proof as N/A with a reason if applicable, complete the Testing and Checklist items, and state the impact or N/A status for security, cross-platform support, SSH/remote, mobile, backwards compatibility, and performance.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
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
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.
A keep-history shutdown could yield while preparing its connection before registering itself with the disconnect drain. If
disconnectOnly()started during that gap, it could close the connection before shutdown finished saving history and retiring the PTY.Register the complete keep-history operation synchronously before connection preparation starts. Preserve the existing spawn-lock order, absolute deadlines, checkpoint/recovery checks, and kill/cleanup sequence. Calls admitted after disconnect starts still reject.
Validation:
pnpm check:changed --maxWorkers=2 --base=048bc0f30984602492c735a5d5dbf55b0abd60aa: all 20 checks passed.This is a separate behavior fix discovered during module-organization CI investigation. The exact interleaving behind that earlier CI failure has not been reproduced.