Skip to content

Isolate agent process groups from Controller - #362

Open
germanescobar wants to merge 1 commit into
mainfrom
fix/isolate-agent-process-groups
Open

germanescobar wants to merge 1 commit into
mainfrom
fix/isolate-agent-process-groups

Conversation

@germanescobar

Copy link
Copy Markdown
Owner

Summary

  • launch Anita, Codex, and Claude in isolated POSIX sessions/process groups
  • signal the complete isolated agent tree during cancellation and forced shutdown
  • reap active isolated agents when Controller exits normally
  • add regression coverage for process-group isolation and shutdown cleanup

Why

An agent tool or test runner can signal its entire process group. Agent CLIs previously shared Controller's process group, so one of those signals could terminate the Electron host as well. macOS then recorded a normal process exit rather than a crash, which explains why no crash report was generated.

Verification

  • npm run build
  • npx tsc -p server/tsconfig.json --noEmit
  • focused and adjacent server tests: 32/32 passing
  • full suite: 1044/1046 passing; the two failures are pre-existing date-sensitive visited-state tests whose September 4-5 fixtures are outside the TTL on September 16

@germanescobar

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 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-16T16:45:05.176895Z 28b8e8c Manual request
ℹ️ 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: 28b8e8c27c

ℹ️ 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 server/index.ts
Comment on lines +73 to +74
process.once("exit", () => {
stopAllSessionRuntimes();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Clean up isolated agents on termination signals

When Controller is stopped with SIGINT or SIGTERM—such as Ctrl-C in the documented dev flow, whose wrapper forwards both signals in scripts/dev-server-with-port-bump.mjs—Node performs the default signal termination without emitting the exit event, so this callback does not run. Since this commit moves agent CLIs into detached process groups, they no longer receive that terminal/service signal and can continue running tools after Controller exits; install explicit SIGINT/SIGTERM handlers that synchronously stop the runtimes before re-raising the signal or exiting.

Useful? React with 👍 / 👎.

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