🤖 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 2 commits into
Conversation
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.
|
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 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.
|
@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". |
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, and skipsrunBackgroundInit(the parent dir is already initialized). The queued + dequeue paths persist/honor the same flag (taskIsolation), and the dequeue fork-fallback (parent checkout gone) clears the flag.taskIsolationfield is persisted on the workspace config entry.WorkspaceService.removeskips physical runtime deletion fortaskIsolation: "none"tasks so removing a shared task never deletes the parent's working tree. (Deletion is already keyed on the task's unique name — a no-op for shared tasks — but the guard makes the invariant explicit and future-proof.)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, an integration test thatisolation: "none"shares the parent worktree without callingorchestrateFork/runBackgroundInit, and a guard test thatremovenever deletes the shared parent checkout.Risks
TaskService.createpath (immediate + queued + 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-opus-4-8• Thinking:max• Cost:$n/a