Repository navigation
fix(destroy): forward SIGINT and SIGTERM to the copy that re-runs in a new session - #281
Conversation
Fails on main: the original CLI never signals the detached copy. Refs #263
…a new session A destroy from inside the program's session re-runs as a detached copy in a new session, which no Ctrl-C from the terminal reaches. The original CLI now forwards SIGINT and SIGTERM to the copy and exits as the copy did, 128 plus the signal's number when a signal ended it. It does not forward the SIGHUP of the session's end. Closes #263
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Why
The operator's goal is to close every deferred follow-up issue from the first autopilot round. This PR fixes #263. A
destroythat runs inside the program's session re-runs as a detached copy in a new session (#216, #246, #259), so the copy can print its result after the session's terminal closes. Ctrl-C or SIGTERM to the original CLI stopped only the original, and the copy kept going and destroyed the session anyway.What changed
rerunInNewSessioninsrc/cli/commands/destroy.tsforwards SIGINT and SIGTERM to the copy while it waits, and removes those handlers once the copy exits.batchuses. Before, such a copy gave 1.docs/USAGE.mdand theverify-session-lifecycleSKILL describe the forwarding. The Exit Codes table indocs/USAGE.mdlists130and143, whichbatchalready gives too.Behavior for CLI and JSON users
destroytyped into the session's shell, or SIGTERM to such adestroy, now also stops the copy. Thedestroyexits 130 or 143 and prints no result. A destroy request that already reached the host still ends the session, as with an in-placedestroy.Verification
forwards SIGINT|SIGTERM to the copy and exits as the copy doesfind nokillon the copy. They pass here. They also check the exit code (130, 143) and that the CLI's signal listeners are back to their count before the re-run. Commit c0a5914 (verifier note) addsdoes not forward SIGHUP to the copy, which fails whenSIGHUPjoins the forwarded signals.node --import tsx src/cli/main.ts, isolatedAGENT_TTY_HOMEandXDG_STATE_HOME): a session whose program ignores SIGHUP. ThendestroywithAGENT_TTY_SESSION_IDset, which re-runs, and SIGINT to the original CLI 0.3 s after its copy started.ok: trueenvelope later.docs/USAGE.md.--maxWorkers=1 --retry=2): unit 1733, integration 335, e2e 34 passed. That includes the existing tests of adestroytyped into the session's shell. The only later commit syncs coverage.json.npm run typecheck,npm run lintandnpm run format:checkexit 0..agents/skills/verify-session-lifecycle/scripts/check.sh --update-coverage: exit 0, 64 runs as expected, 22,897,048 and 22,308,620 distinct states. The model does not change. It has no signals to the CLI.Closes #263
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh