Skip to content

🤖 fix(tasks): list a removed sub-agent's leftover processes in task_remove - #8214

Merged
ThomasK33 merged 18 commits into
mainfrom
remove-subagent-processes
Dec 3, 2026
Merged

ThomasK33 merged 18 commits into
mainfrom
remove-subagent-processes

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Why

task_remove left a removed sub-agent's daemons running in its deleted checkout, with no owner and no mention in the result. Removal stopped only background tasks that were still running, so these survived: a daemon a finished task left in its process group (server &), a job a call detached with setsid -f, and a grandchild that left its task's group.

What changed

  • New src/node/runtime/leftoverProcesses.ts: every bash call runs with XUM_WORKSPACE_ID=<id>, and descendants inherit it. After removal's existing background-task cleanup and before the checkout is deleted, listLeftoverProcesses lists each process whose /proc/<pid>/environ holds that exact entry, skipping itself and its ancestors. It sends no signal.
  • The task_remove result gains processes ({ pid, taskId? }, capped at TASK_REMOVE_MAX_LISTED_PROCESSES, plus processesOmitted), processNote (they are still running and were not stopped), and processCheck: "unavailable" when there is no /proc or grep, the check was cut off, or removal had no workspace metadata. The user's removal adds one warning with the count and pids, and one when the check was unavailable.
  • mergeSecretsOverXumEnv refuses a project secret named XUM_WORKSPACE_ID, so a secret cannot hide processes from the list.

Scope

Only sub-agent removal lists; removing a root workspace is unchanged. What gets stopped is exactly what main stops.

Tradeoffs

An earlier revision killed the listed processes. Four Codex rounds kept finding ways the kill could hit the wrong process (two installations sharing a legacy workspace ID) or report unsafe data (argv, a rewritable comm), so the owner chose listing: a wrong match is now one extra pid in the list. The list reports no name or command, only pids and the owning bash: task. A process that clears its environment (env -i), or one started through WorkspaceService.executeBash (which runs without the marker), is not listed; macOS and multi-project devcontainer sub-agents report unavailable.

Blast Radius

The result and warnings of sub-agent removal on Linux hosts and remote Linux runtimes, and the env of bash calls whose project defines a secret named XUM_WORKSPACE_ID.

Verification

taskService.removalProcessesRepro.test.ts starts real processes through the real bash tool: a finished task's daemon and a setsid -f job are listed by pid (the daemon with its task ID) and are still alive after removal. leftoverProcesses.test.ts covers the self, ancestor and prefix-ID exclusions, the cap, a host without grep, and a process name crafted to shift /proc/<pid>/stat fields.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $39.98 (the whole three-PR stack)

@ThomasK33
ThomasK33 added this pull request to stack #8216 December 3, 2026 12:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T18:53:03.325130Z 5727a05 Manual request
🔒 Security Review ✅ Completed 2026-12-03T18:55:59.645516Z 5727a05 Manual request

Security findings

Advisory findings (1)

ℹ️ 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.

@ThomasK33 ThomasK33 changed the title remove subagent processes 🤖 fix(tasks): stop and list a removed sub-agent's leftover processes in task_remove Dec 3, 2026
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

21 agent steps · 6 replayed from cache · 15 model calls · 47.5k tokens (23% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 5.9s
🟢 a chat survives a restart of the server 1 step · 1 call 5.9s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 6.0s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 6.0s
🟢 pluginTrustRestart.e2e.ts · 1 passed 3 steps · 2 calls 9.8s
🟢 a trusted plugin hook stays trusted after the server restarts 3 steps · 2 calls 9.8s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 9.2s
🟢 a chat survives trips through Settings 2 steps · 1 call 9.2s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 4.5s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 4.5s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 4.5s
🟢 the agent opens the playground workspace 2 steps · 1 call 4.5s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 8.3s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 8.3s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 2.9s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 2.9s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 22.2s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 3.5s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 4.0s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.4s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.7s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 3.4s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.2s

e2e 0.20.0 · 1m 17s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 7.9k tokens (22% cached)
Spend: $0.02 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 5.9s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.9s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.8s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.8s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.4s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.4s

e2e 0.20.0 · 19.6s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 6.5s · 2 targets (web, phone) · run artifacts

@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: 225a123303

ℹ️ 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/node/services/taskService.ts Resolved
Comment thread src/node/services/workspaceService.ts Resolved

@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 Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 225a123303

ℹ️ 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.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 93bdcea722

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.

@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: 93bdcea722

ℹ️ 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/node/services/workspaceService.ts Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 6b65a3387c

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.

@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: 6b65a3387c

ℹ️ 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/node/runtime/runtimeScratchDir.ts Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: a84b0e532f

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.

@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: a84b0e532f

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

@ThomasK33

Copy link
Copy Markdown
Member Author

Pausing the review loop on this PR. It is not converging.

The Codex rounds on the process sweep have found new gaps in the same area every time: 4, then 3, then 2, and now 3 new findings. Each one is about whether the XUM_WORKSPACE_ID marker reliably names only this sub-agent's processes and only safe data. The open round:

  • P1: two Xum installations on one host can share a legacy workspace ID, so the sweep could kill the other installation's processes.
  • P2: WorkspaceService.executeBash runs without the marker.
  • P2: a process can rewrite /proc/<pid>/comm, so the reported name can hold a secret.

Following the repo's PR rules, I am not adding more mechanism until the owner picks a direction:

  • A. Keep the stopping sweep. Scope the marker to the installation, add it to executeBash, and stop reporting a name (pid and task ID only).
  • B. Narrow it to listing. Removal stops only Xum-tracked background tasks, as on main. It lists the pids that still carry the marker, without a name and without signalling them, so the parent can decide. With no automatic kill, a cross-installation match becomes a harmless extra pid in the list.

Fixed and pushed so far: argv no longer reported, output capped, warnings when the check is unavailable, the no-metadata path, the secret override of the marker, rescan after SIGTERM, and a missing grep reading as unavailable. #8213 and #8215 have Codex approval. #8215 sits on top of this PR.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33 ThomasK33 changed the title 🤖 fix(tasks): stop and list a removed sub-agent's leftover processes in task_remove 🤖 fix(tasks): list a removed sub-agent's leftover processes in task_remove Dec 3, 2026
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

The owner narrowed this PR from stopping leftover processes to listing them (see the PR body), so please review the new head as a whole.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 2df7764662

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.

@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: 2df7764662

ℹ️ 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/node/services/workspaceService.ts Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 2df7764662

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 2df7764662

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.

@ThomasK33

Copy link
Copy Markdown
Member Author

PASS+NOTES

Independent verifier. Parent 3f14bafb66 vs head 2df7764662, each in a detached scratch worktree, same harness file at both. Real TaskService + WorkspaceService + BackgroundProcessManager, a real worktree checkout, the sub-agent's processes started through the real bash tool with a turn's XUM_ env, removal through the real task_remove tool (agent) and removeSubagentForUser + the browser's formatWorkspaceRemoveWarnings (UI). No model calls; a dev-server sandbox's mock model cannot drive bash calls, so I used the services directly.

Setup per run: a finished background task that left sleep 300 & (the server & case), a foreground setsid -f job whose argv0 is TOKEN_XYZZY_argv, a sibling workspace whose ID is the child ID plus 2, and an unrelated workspace, both with their own daemons.

parent head
task_remove result {status: removed} only processes: [{pid: <daemon>, taskId: "bash:daemon"}, {pid: <setsid job>}] + processNote
daemons after removal alive alive (nothing signalled)
sibling (prefix ID) and unrelated daemons not listed, alive not listed, alive
Xum run with XUM_WORKSPACE_ID=<child id> in its own env not listed Xum and its parent shell not listed; same two pids
project secret XUM_WORKSPACE_ID=decoy job sees decoy; result says nothing job sees the child ID; listed
57 leftovers from one task nothing 50 listed, all ours, processesOmitted: 7
UI removal no warning one warning: "2 process(es) this sub-agent started are still running (pids …); removal did not stop them."
removal time 217 ms 208 ms

Checkout deleted and config row gone in every case. No result holds TOKEN_XYZZY, sleep, setsid or decoy; the only process-related string is the task ID bash:daemon. The PR's own tests pass at head (leftoverProcesses, removalProcessesRepro, removeInactiveDescendant, bash.test), except bash tool > should present stdin as a non-pipe for search tools, which also fails at the parent on this host.

Notes

  • A sub-agent with a still-running background task is refused as before ("Stop them before removing"), so the list only ever shows what a finished or detached job left.
  • The taskId comes from the agent's display_name, so it is agent text in the result. It is not a command line.
  • The warning gives pids only. A user who wants to stop them needs ps to see what they are. This is by design.
  • The timing was measured on a host with 63 processes. I did not measure the /proc scan on a host with thousands of processes; the check has a 20 s cap.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Base automatically changed from late-wake-reports to main December 3, 2026 18:41
Two real-stack repros (TaskService, WorkspaceService, BackgroundProcessManager, a
worktree checkout, the real bash tool with a turn's XUM_ env) of task_remove
removing a sub-agent while processes it started keep running in its deleted
checkout, with nothing in the removal result:

- a daemon that a finished run_in_background task left in its process group
  (`sleep 300 & ...`): the task reads "exited", so removal's cleanup skips its
  group kill;
- a job a foreground bash call detached with `setsid -f`: Xum never tracked it.

Each wraps its target assertion in expectReproFailure, so it passes while the
bug exists and fails once it is fixed.
task_remove and the user's sub-agent removal left processes the sub-agent
started running in its deleted checkout, and said nothing about them. Removal's
background cleanup stops only the process groups of running tasks, so a daemon
a finished task left in its group, a `setsid -f` job and a grandchild that left
its task's group all survived.

A sub-agent removal now sweeps them after that cleanup and before the checkout
deletion: every bash call of a workspace runs with XUM_WORKSPACE_ID=<id>, so a
script on the workspace's runtime SIGTERMs (then SIGKILLs) each process whose
/proc environ holds that exact entry, sparing itself and its ancestors
(workspaceProcessSweep.ts, as remoteExecMarker.ts does for remote execs).

- task_remove results gain `processes` (pid, command cut to 200 chars, the
  bash:<id> task whose group it was in, outcome stopped|still_running) and
  `processCheck: "unavailable"` when the host has no /proc or the sweep did not
  finish.
- The user's removal adds one warning per process still running and one
  summary warning for those it stopped.
- A root workspace's removal (and its descendant cascade) is unchanged.

The repro tests from the previous commit now assert the fixed behavior.

Follow-ups: task_stop of a bash task still leaves grandchildren that left its
process group, and archive does not sweep.
parseWorkspaceProcessSweep was a new function at CC 10 (limit 8). Its per-line
parse and the removed-process mapping are now their own functions; behavior is
unchanged (workspaceProcessSweep.test.ts).
The sweep reported /proc/<pid>/cmdline, and argv can hold expanded project
secrets (`server --token "$TOKEN"`) that then reach the model and disk.
Report /proc/<pid>/comm instead, read with a builtin, and rename
RemovedProcess.command to name.
With hundreds of leftover processes the sweep printed a row each and the
whole list reached the model. The script still signals every match but lists
at most TASK_REMOVE_MAX_LISTED_PROCESSES, prints an O <count> line for the
rest, and the result reports processesOmitted (the user's removal adds one
warning for them). The exec also gets a 64 KiB output cap as a backstop; a
cut output loses DONE and reads unavailable.
removeSubagentForUser turned the swept processes into warnings but ignored
processCheck: "unavailable", so on a host without /proc (macOS) or after a
failed sweep the UI showed a clean removal. Add one warning for that case.
When getWorkspaceMetadata() fails, removal deletes the row on the phantom
path but skipped the background cleanup and the sweep, so a sub-agent
removal read clean. Run the background cleanup there too (it needs only the
id; session disposal covers only a live session that did not keep its
processes) and, with no runtime to sweep with, return processCheck:
"unavailable".
The phantom path builds no runtime, so it passes no workspace path; the
optional chain grew the function's CC past its CRAP floor.
Prettier wraps the removeSubagentForUser call.
Removing a sub-agent finds its leftover processes by their
XUM_WORKSPACE_ID entry, so a secret of that name hid them and the
removal reported none. Reserve the name the way the scratch-dir names
are reserved.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
A daemon that restarts its worker from its SIGTERM handler starts a
child after the sweep's scan, so the child never got SIGKILL and the
removal did not list it. Scan /proc again after the SIGTERM wait, as
buildMarkerKillScript does, and stop and list the new matches too.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
…g them

Sub-agent removal stops only Xum's tracked background tasks again, as on
main. Afterwards, before the checkout is deleted, it lists the pids that
still carry the sub-agent's exact XUM_WORKSPACE_ID entry (the check itself
and its ancestors excluded) and sends no signal: the entry is not proof
enough to kill, since two Xum installations can share a legacy workspace ID.

Each entry is { pid, taskId? }, with no name: a process can write anything
to its own /proc/<pid>/comm. /proc/<pid>/stat is read whole, so a name that
imitates stat fields cannot shift the process group used for taskId.
The result keeps processesOmitted and processCheck: "unavailable" and adds
processNote, which says the processes are still running and were not
stopped. The user's removal warns once with the count and pids, and once
when the check was unavailable. A removal without metadata no longer runs
the background cleanup that main does not run there.

---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33
ThomasK33 force-pushed the remove-subagent-processes branch from 2df7764 to 674f247 Compare December 3, 2026 18:41

@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: 674f247220

ℹ️ 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/node/services/workspaceService.ts Resolved
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 5727a05158

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

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

Reviewed commit: 5727a05158

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.

@ThomasK33

Copy link
Copy Markdown
Member Author

PASS

Independent re-verification of the delta 674f247..5727a05 at head 5727a05 (I did not write this code). Parent and head ran in detached scratch worktrees on Linux, Docker 27.5.1, Bun 1.4.3.

What I ran, parent vs head

  1. A real container per run (mux-ssh-test), named the way DockerRuntime names it, with a sleep 300 started by docker exec -e XUM_WORKSPACE_ID=<id>. Then removeWhileTaskTreeLocked(id, true, undefined, { checkLeftoverProcesses: true }), the call task_remove makes, through the real DockerRuntime.
    • Deletion succeeds (real docker rm -f; container gone afterwards). Parent: leftoverProcesses: {processes:[{pid:62}]}, which names a process that died with its container. Head: leftoverProcesses is undefined.
    • Deletion fails (XUM_CONTAINER_CLI pointed at a shim that refuses only rm). Parent and head match: the pid is still listed, there is 1 forced-delete warning, the container still runs, the process is alive, and the row is removed.
  2. taskService.removalProcessesRepro.test.ts, local runtime, real bash and real processes through task_remove and the user's removal: 4/4 pass on parent and on head. The daemon and the setsid job are still listed, and the leftover warning still names the pid.
  3. The new workspaceService.removeLeftoverProcesses.test.ts, copied into parent: "lists nothing once the container is deleted" fails on parent and passes on head.
  4. Removal suites (9 files: workspaceService.remove*, workspaceService.test, sideChat, taskService.lifecycle, removeInactiveDescendant, leftoverProcesses.test): 243 tests. Parent has 242 pass and 1 fail, the copied repro. Head has 243 pass.

Notes

  • The production change is one call after runtime.deleteWorkspace. Other runtimes and failed deletions keep the same list. A non-forced failure still returns Err before the list is used. The rest of the diff moves a comment.
  • On a successful Docker or devcontainer delete, a processCheck: "unavailable" result is dropped too. That is right once the container is gone.
  • Not run: the off-Linux skipIf(noProc) path, because this host is Linux. A devcontainer container was not exercised. It shares the same helper branch (isDevcontainerRuntime).

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@ThomasK33
ThomasK33 merged commit 28bdffd into main Dec 3, 2026
44 of 45 checks passed
@ThomasK33
ThomasK33 deleted the remove-subagent-processes branch December 3, 2026 19:19
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