Repository navigation
Conversation
|
This run croaked 😵 The workflow encountered an error before any progress could be reported. Please check the link below for details. |
|
| } | ||
| visited.add(child.pid) | ||
| // Shared daemons own their entire subtree, including detached tools. | ||
| if (child.pgid === child.pid && isCodexManagedDaemon(child.command)) { |
There was a problem hiding this comment.
Force kill still reaches daemon
If the managed daemon retains the launching PTY's TTY, excluding it here protects it from the descendant sweep but not from force teardown. That path sends SIGKILL to every process group on the PTY's TTY, so an immediate or delayed force kill can still shut down the shared backend.
| execFile( | ||
| 'ps', | ||
| ['-axo', 'pid=,ppid=,pgid=,lstart='], | ||
| ['-axww', '-o', 'pid=,ppid=,pgid=,lstart=,command='], |
There was a problem hiding this comment.
This now collects untruncated command text for every process, but the whole-host scan still has a one-second deadline. On a busy host, a scan that exceeds that deadline is discarded: teardown kills only the PTY root and leaves detached descendants running. A timeout during the later scan also prevents SIGKILL escalation.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The managed-daemon exclusion is mergeable after normal project checks; no concrete cleanup regression remains identified. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The change protects a shared backend from terminal shutdown, but it may also let a terminal-launched process and its children survive shutdown if they appear to be that backend. The exposure appears limited to processes on the same host; broader access or privilege gain has not been established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1⚔️ Resolve 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. Comment |
|
Addressed both findings in 47e3b86 and merged upstream main in 26c703e to resolve the conflict. Please re-review the updated patch. P1 — force teardown: confirmed the separate TTY-wide SIGKILL path bypassed the original exclusion. The force path now inspects only the TTY's process-group leaders and uses the existing scoped root fallback when it finds a managed Codex service. It avoids the entire TTY-wide group sweep, protecting service tools that have their own groups as well as the daemon itself. Ordinary agent-owned descendants retain the descendant cleanup path. Missing, changed, truncated, timed-out, or unsupported command inspection also falls back conservatively; this may leave other terminal jobs alive. Pause/resume behavior is unchanged. P2 — snapshot size: whole-host snapshots now capture executable names rather than full argument lists. Only Codex group-leader candidates receive a separate argv query, using the remaining original deadline and matching PID/start time/group/parent before merging. The legacy delayed SIGKILL pass queries only target identities. This reduces argument-list volume without simply increasing the timeout; it does not guarantee every busy-host scan will finish. Validation: 8 targeted test files / 156 tests pass on macOS with mocked signals; repository oxlint and native code-quality checks pass for changed files, as do formatting and whitespace checks. Added tests cover shared-TTY services and tools, ordinary app-servers, command-query failures, deadline exhaustion, and identity changes. A read-only query also recognized the two local managed services. The PR body details the temporary test setup and remaining platform/CI checks. No live terminal closure, frontend testing, or project build was performed. |
| ...processTableSpec([ | ||
| '-ww', | ||
| '-p', | ||
| [...new Set(leaders.map((row) => row.pid))].join(','), | ||
| '-o', | ||
| `${SELECTED_COLUMNS},command=` | ||
| ]), |
There was a problem hiding this comment.
BusyBox force teardown leaves jobs
On BusyBox systems where ps -p is unsupported, the initial PTY lookup falls back to a whole-table query, but this new command lookup still uses ps -p. It fails, so force teardown kills only the PTY root and leaves ordinary terminal jobs running, even when no managed Codex daemon is present. This lookup needs to respect the detected ps dialect.

ELI5
Closing the terminal that started Codex should not stop the shared backend used by other terminals. This change preserves the explicitly managed backend and its tools during descendant cleanup and checks for it before forced terminal-wide termination.
What Changed
codex app-server ... --managed-daemonandcodex app-server daemon pid-update-loopsubtrees from descendant signals.Why
A managed backend can keep its launching CLI as its parent even after creating a separate process group. An ancestry-only cleanup therefore crosses an ownership boundary. A separate TTY-based force-kill path also needs protection when the backend retains that TTY.
The protection is deliberately conservative: TTY membership alone cannot tell which tool groups belong to the shared service. Ordinary agent descendants still use the existing descendant sweep. On a shared TTY, or when command inspection fails or is unsupported, forced terminal-wide cleanup falls back to the root; this can leave other terminal jobs alive rather than risk killing shared work.
Reading selected command lines avoids adding every tool's potentially large argument list to every whole-host snapshot. It does not eliminate all scan timeouts or claim a measured speedup on every host.
Linked Issue
Fixes #23833
Visual Proof
N/A — backend process lifecycle change with no rendered UI changes.
Testing
On macOS, 8 targeted Vitest files / 156 tests pass. Coverage includes shared-TTY force teardown, tools in separate groups, daemon maintenance, ordinary app-servers, unavailable/incomplete command queries, remaining timeout budgets, changed process identities, existing teardown/exit verification, and Windows job wiring. Signals are mocked; no live user session was terminated.
Changed files pass repository oxlint rules, the native code-quality configuration, oxfmt, and
git diff --check. A read-only localpscheck of the new two-stage query identified both managed services.This checkout has no project dependencies installed. Tests used a temporary Vitest 4.1.5 installation with a minimal Node config (
oxc.tsconfig: false), without repository-wide setup. Lint/format tools were oxlint 1.85.0 and oxfmt 0.70.0. The unavailable lint-staged commit hook was bypassed after these direct checks. No build, full project typecheck, frontend tests, Linux/Windows runtime test, remote connection, or destructive end-to-end reproduction was performed; broader verification remains for CI.AI Disclosure
Prepared with OpenAI Codex (GPT-6).
Review
Recognition requires the known command forms and a process-group leader, not just the name
codex. Executable paths containing whitespace and global flags precedingapp-serverremain outside this conservative matcher. Windows termination is unchanged. Pause/resume process-table queries retain their existing behavior. All inspection runs on the execution host; there are no wire changes or assumptions about git versus folder workspaces.Agent skill upstream boundary
Checklist