🤖 feat: add isolation:none for non-local sub-agent tasks#3475
🤖 feat: add isolation:none for non-local sub-agent tasks#3475ammar-agent wants to merge 11 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f4c7f284b
ℹ️ 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".
|
@codex review Addressed the P1 (worktree shared-checkout resolution):
|
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ 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". |
Allow worktree/SSH sub-agents to skip fork overhead by sharing the parent workspace checkout (isolation: none|fork, default fork). The isolation tool parameter is conditionally added to the task tool schema based on runtime, so it never enters LLM context on local runtimes.
Codex P1: worktree isolation:none tasks resolved cwd/ensureReady from the name-derived child path (never created) instead of the parent checkout. Make WorktreeRuntime honor an explicit workspacePath override (mirroring SSHRuntime) so shared tasks land in the parent's checkout. Adds WorktreeRuntime tests.
1a75460 to
d441167
Compare
|
@codex review Rebased onto latest |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4411679e4
ℹ️ 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".
|
@codex review Addressed the P2: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 527ae6a78b
ℹ️ 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".
|
@codex review Addressed: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20d46e4bf5
ℹ️ 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".
|
@codex review Addressed the P1 (fork source from a shared parent):
|
There was a problem hiding this comment.
💡 Codex Review
mux/src/node/services/taskService.ts
Line 2603 in 85019f2
When a queued isolation: "none" task is spawned from a parent that is itself a shared task, parentMeta.name is the synthetic agent workspace name rather than the branch checked out in the shared parent checkout. If that shared checkout is gone by dequeue time, startReservedAgentTask explicitly falls back to forking and passes this persisted taskTrunkBranch as preferredTrunkBranch, so the fallback tries to create the worktree from a nonexistent synthetic branch (or the wrong base) instead of the parent's real branch. Persist the checked-out branch or the parent's existing taskTrunkBranch for shared tasks.
ℹ️ 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".
|
@codex review Addressed the trunk-branch P2: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cdb3baec99
ℹ️ 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".
|
@codex review Addressed: when the parent is a shared ( |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0255317fb5
ℹ️ 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".
|
@codex review Addressed: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cdf30e02ce
ℹ️ 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".
…ueue fail-fast parity)
|
@codex review Addressed: queued shared children no longer block parent checkout deletion. Rationale: dequeue ( |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
Summary
Adds an
isolation: none | forkconfiguration to thetasktool so sub-agents on non-local runtimes (worktree/SSH) can run directly in the parent workspace's checkout instead of paying for a fork.forkremains the default to preserve current semantics. The parameter is runtime-conditional: on local runtimes it is omitted from the tool schema entirely, so it never enters LLM context.Background
On worktree/SSH runtimes, every spawned sub-agent forks a new checkout (git worktree / remote clone) plus runs init hooks. For read-only analysis (e.g.
explore) — or when the caller has already arranged isolation via the prompt — that overhead is pure waste. Local runtimes already share the project directory, so forking is a no-op there and the option is meaningless (hence hidden).Implementation
createTaskToolnow builds itsinputSchemaper runtime:buildTaskToolAgentArgsSchema({ includeIsolation }).isolationis only included for runtimes that support sharing the parent checkout (runtimeModeSupportsSharedTaskWorkspace→ worktree/SSH). The local schema is.strict()without the field, so the model is never shown it. The canonical schema (withisolation) is still used for theexecute()re-parse and token counting.TaskService.create. Whenisolation: "none"is honored, the task skipsorchestrateFork, points its workspacepathat the parent's checkout, reuses the parent runtime config, and skipsrunBackgroundInit(the parent dir is already initialized). The runtime is built with the child's identity but the parent's persisted path;WorktreeRuntimenow honors that path override (mirroringSSHRuntime) so cwd resolution andensureReadyland in the shared checkout.taskIsolation: "none"withpathpointing at the parent's checkout. On dequeue,getExistingMaterializedTaskLaunchreuses that existing path (no fork), andstartReservedAgentTaskskipsrunBackgroundInitfor it. If the parent checkout disappeared before dequeue, materialization falls back to a real fork and the shared flag is cleared so the new worktree is cleaned up normally.TaskService.createMany()applies the same gating: honored plans persist the parent's checkout path +taskIsolation: "none", and the reservation launch reuses it without fork/init.WorkspaceService.removeskips physical runtime deletion fortaskIsolation: "none"tasks so removing a shared task never deletes the parent's working tree. Internal failure-cleanup helpers (cleanupMaterializedTaskWorkspace,rollbackFailedTaskCreate) take apreservePhysicalWorkspaceflag for the same reason — notablySSHRuntime.deleteWorkspaceresolves through the persisted-path override, which would otherwise target the parent checkout.worktreeandssh(the runtimes named in the request).docker/devcontainertie runtime identity to the workspace name in the runtime factory, so they are intentionally excluded for now; multi-project parents also fall back to forking.Validation
make static-checkgreen (incl. regenerateddocs/hooks/tools.mdx+ built-in skill snapshot from the new tool param).task.test.tsasserts the advertised schema rejects/acceptsisolationper runtime;toolDefinitions.test.tscovers the builder + description gating;runtime.test.tscovers the gating helper),isolationis forwarded toTaskService.create, integration tests thatisolation: "none"shares the parent worktree without callingorchestrateFork/runBackgroundInit(both the immediate path and the queued→dequeue reservation path), and a guard test thatremovenever deletes the shared parent checkout.Risks
TaskService.createpath (immediate + queued + reservation dequeue) andWorkspaceService.remove. The shared path is gated behind an opt-in flag and supported runtimes; defaultforkbehavior is unchanged. Main regression surface is task lifecycle (create/remove) on worktree/SSH — covered by the fulltaskService/workspaceServicesuites.Generated with
mux• Model:anthropic:claude-fable-5• Thinking:high• Cost:$40.36