Repository navigation
🤖 feat(tasks): let task_remove force-remove a sub-agent with unsaved work - #8153
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)ℹ️ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4769afe202
ℹ️ 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".
🟢 e2e stories (Haiku): 14 passed22 agent steps · 7 replayed from cache · 15 model calls · 47.1k tokens (27% cached) All 14 tests in 9 files
e2e 0.20.0 · 1m 18s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 7.9k tokens (33% cached) All 3 tests in 3 files
e2e 0.20.0 · 24.3s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 6.5s · 2 targets (web, phone) · run artifacts |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 4769afe202
ℹ️ 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.
|
Codex Review: Didn't find any major issues. 👍 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 Review · Automatically triggeredSecurity 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 Security Review · Automatically triggeredSecurity 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdb41a1a27
ℹ️ 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".
|
Merge decision for head fdb41a1: ready, with the remaining items left open.
|
Why
The goal, in the maintainer's words: "allow xum to force remove sub-agents and workspaces with a flag. I'm not interested in cleaning up after you."
Today
task_removerefuses to remove a sub-agent that holds unsaved work. It then tells the agent that the user must remove the child by hand from the command palette. An agent that owns 13 finished children cannot clean up after itself, and the user must do it.This PR gives
task_removeaforceflag. Workspace archive is a separate PR (see Scope).What changed
task_removetakesforce: boolean | null(src/common/utils/tools/toolDefinitions.ts). Onlyforce: trueforces.false,nulland an omitted flag keep the refusal.TaskServicemodels the choice as one typed value:lossyWorkPolicy: "refuse" | "force"(src/node/services/taskService.ts). A model-driven removal always sets it. The palette and automatic cleanup still omit it."force", the removal skips only the unsaved-work refusal. Under both policies these refusals stay: a running background bash process, an external editor or native terminal the user opened, a pending patch artifact, an active sub-agent, and remaining descendants.removedresult carriesdeletedWork(what was deleted, past tense, plus the checkout path and the branch) andpaths(the file list). A checkout that could not be checked is removed anyway, anddeletedWorksays it could not be checked.deletedWorkis the workspace name. I verified that each runtime forks the sub-agent checkout withnewWorkspaceName: plan.workspaceNameand that removal deletes the branch by that name.force: trueexists and when to use it: the user asked for cleanup, or the work is provably saved (pushed, merged, or in an applied patch). It keeps "you must not delete that work yourself to get around it". It no longer sends the user to the command palette.WorkspaceServicenow returns a warning when a forced removal could not delete the checkout, even if the runtime named no leftover (single runtime and multi-project). Before, it logged the failure, removed the row and returned nothing, so no caller could tell that the checkout might still exist. The palette and parent-delete paths still succeed as before and only gain that warning.task_removecard showsdeletedWorkandpathson removed and failed rows.docs/hooks/tools.mdx, the docs skill snapshot) follow the schema.Scope
task_remove) only.task_workspace_lifecycle(workspace archive) is the sibling PR, and its behavior is unchanged here. The one shared piece is a type:TaskServicereturns the sharedWorkspaceLifecycleResult, so this PR adds the optionaldeletedWorkfield toTaskWorkspaceLifecycleBaseResultSchema. The archive tool does not set it.Tradeoffs
forceonly when the user asked for cleanup or the work is provably saved. The maintainer accepted this.forceis all or nothing for the unsaved-work check. It does not take a list of paths to keep.deletedWorkis one string, not several fields. The model and the card both read prose, and one field keeps the result small.refuseLossySubagentRemovaltosettleLossySubagentRemovalintaskService.removeInactiveDescendant.test.ts. The step now returns a refusal or a forced report, so the old name was wrong.Blast Radius
task_removeon their own descendants can now delete their unsaved work. Scope checks are unchanged, so an agent cannot force-remove another tree's children or a user's workspace.Decisions (root, 2026-11-12)
force: z.boolean().nullish(). The handler testsargs.force === true.paths. The card shows it.Question for @ThomasK33
forceskips only the unsaved-work refusal. A running background bash process and an editor you opened still refuse. Do you wantforceto skip those too?task_stop. An editor you opened has no agent-side fix, so those children still need you.Screenshots
Dark theme, from the
TaskRemoveForcedNarrowstory, cropped to the card.375px:
Wider card:
Verification
taskService*.test.tsplus the cascade and multi-project removal suites: 1810 pass, 0 fail (58 files). AllworkspaceService*.test.ts: 1248 pass, 0 fail (52 files). Tool, common, browser Tools,workspaceService.pendingRemovalandsubagentRemovalWorkChecksuites: 2570 pass, 0 fail (136 files).forceonly fortrue, and the card showsdeletedWork.force, tool always forces, tool dropsdeletedWork, card hidesdeletedWork.make typecheck, oxlint, ESLint on the 11 changed files, Prettier, docs sync check,make crap-check,make dry-check: pass.make mutate-checkfortaskService.tsruns only the 10 nearest test files, and they do not includetaskService.lifecycle.test.ts. Its survivors are a test-selection artifact. I ran each survivor by hand against the lifecycle suite, and each is now killed.TaskRemoveForcedNarrowpasses (the story sets no Pixel snapshot, because the snapshot budget is at its cap).hadolint(not installed, and I changed no Dockerfile).Generated with
xum• Model:anthropic:claude-sonnet-5-5• Thinking:xhigh• Cost:$4.57