Skip to content

fix: cancel host process trees and scope daemon cleanup - #83

Merged
roodboi merged 4 commits into
mainfrom
codex/host-cancellation-daemon-ownership
Sep 8, 2026
Merged

fix: cancel host process trees and scope daemon cleanup#83
roodboi merged 4 commits into
mainfrom
codex/host-cancellation-daemon-ownership

Conversation

@roodboi

@roodboi roodboi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Cancelling hack host exec or hack env exec now forwards SIGINT/SIGTERM to the owned command group and cleans surviving descendants. Terminal commands use a same-terminal supervisor that establishes ownership before starting the command, preserving stdin, separate output streams, terminal restoration, and Ctrl-Z/foreground resume. Cancellation returns 130/143 with bounded escalation for stubborn children.

Daemon orphan cleanup requires evidence that a candidate owns this daemon state's Unix socket. Clearing an isolated test/configuration root cannot stop another daemon merely because its process name matches.

Validation: pinned Bun 1.3.9 build, full forced typecheck/lint, privacy checks, and full CLI/database suite (924 CLI passed, 5 skipped; 2 database passed), plus the subsequently added compiled-binary regression. Nine PTY regressions cover wrapper-only cancellation, stubborn descendants, immediate foreground Ctrl-C, cancellation while the wrapper is paused, stdin and /dev/tty, separate streams, normal status/foreground restoration, and Ctrl-Z/resume. Independent review found no remaining blocker. A compiled Linux harness also passed the paused-wrapper cancellation case using the same terminal-control modules; this is separate from the full macOS CLI proof. Hosted current-head CI remains a separate gate.

Release signal: fix. #84 adds optional diagnostics on top of this change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T18:26:50.767773Z 8091e3a New commits
🔒 Security Review Completed 2026-09-08T18:40:46.332087Z 8091e3a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f5c27d502

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread src/lib/shell.ts Outdated
@roodboi

roodboi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@codex review — please re-review bd1c285, including the TTY descendant cancellation fix and its real PTY regressions.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd1c285fc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread src/lib/shell.ts Outdated
Comment thread tests/fixtures/tty-cancellation.py Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: bd1c285fc8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@roodboi

roodboi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@roodboi
roodboi merged commit 12822d4 into main Sep 8, 2026
6 checks passed
@roodboi
roodboi deleted the codex/host-cancellation-daemon-ownership branch September 8, 2026 18:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8091e3a5ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread src/lib/shell.ts
roodboi pushed a commit that referenced this pull request Sep 8, 2026
## [4.2.0](v4.1.1...v4.2.0) (2026-09-08)

### Features

* add runtime and host command observability ([19f38d5](19f38d5))
* add runtime and host command observability ([#84](#84)) ([38d49be](38d49be))

### Bug Fixes

* cancel host process trees and scope daemon cleanup ([7f5c27d](7f5c27d))
* cancel host process trees and scope daemon cleanup ([#83](#83)) ([12822d4](12822d4))
* cancel verified TTY command descendants ([bd1c285](bd1c285))
* exclude lifecycle placeholders from orphan cleanup ([a25609b](a25609b))
* own terminal command groups before forwarding cancellation ([1cc238d](1cc238d))
* preserve command outcomes and resource diagnostics ([c52e5ac](c52e5ac))
* preserve controlling terminals with piped command input ([3e7f080](3e7f080))
* preserve nested host command usage attribution ([f4f487d](f4f487d))
* recognize exact Linux daemon socket names ([a5b2cbd](a5b2cbd))
* scope tracked host usage to the requested project ([1b0cf32](1b0cf32))
* skip CLI initialization in terminal supervisor ([8091e3a](8091e3a))
* use typed Docker inspect fields in resource probes ([b0991af](b0991af))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant