Repository navigation
feat: let agents on a sandbox ask the host for a sub-sandbox - #20
Merged
OmarAlex24 merged 4 commits intoNov 11, 2026
Merged
Conversation
…andbox A parent on a sandbox has no checkout on this machine, so start can take the repository and pushed branch its clone tracks instead of reading the host's checkout, and copies env files only from a real checkout. A caller name picks the words of a refusal, so an agent asking from a sandbox is not told about target.sandbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sandboxes run the official T3 Code, so agents there get sandbox_delegate and sandbox_task_status from a small MCP server T3 Code installs: Node built-ins only, registered in Claude's MCP list like the servers a config copies. Requests and responses are files under ~/.t3/userdata/sub-sandbox, written by rename, and a request the host does not pick up within 45 s is withdrawn with a message to do the work locally. The launch installs it after T3 Code's skill, every resume of a chat's sandbox rewrites it before T3 starts, and a subagent's own sandbox never gets it. A failure is only a warning. The template scrub removes its folder with any pending requests. The provisioner can now run T3 Code's own scripts on a running sandbox for the host's poll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The host polls each running chat sandbox for helper requests with one provider exec: every 15 s while the chat runs a turn here or has a request open, every 60 s otherwise, and once per running stretch where the helper is missing. Each request starts through SubSandboxes and RemoteDelegation on behalf of the chat's thread here, so the same config, limits, sizes and end-of-task checkWork apply, and every status, refusal and result is written back. Nothing starts before the first answer lands, and a restart recovers open requests from their responses without starting any twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OmarAlex24
merged this pull request
into
feat/sandbox-environments
Nov 11, 2026
8 of 21 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
#16 lets an agent on the host give a subagent its own sandbox. Most chats, though, run on a sandbox, and sandboxes run the official T3 release. Its MCP has no
target.sandbox, and the configs, provider keys and sub-sandbox logic live on the host. So an agent inside a sandbox had no way to ask for a sub-sandbox.Solution
The host installs a small MCP helper on each chat's sandbox. The helper turns an agent's request into a file. The host picks up those files and runs #16's path on behalf of the chat. It works only while the host (the Mac) is awake.
Inside the sandbox (
subSandboxHelper.ts):~/.t3/userdata/sub-sandbox/mcp.mjsuses Node built-ins only. The fork's own MCP registration already needsnode; without it, the install warns and skips. It has two tools:sandbox_delegate(task, size?, requestId?): queues a task to run on a new sub-sandbox.sandbox_task_status(id, waitSeconds ≤ 30): reports the status, and the result at the end.~/.claude.json, the same way the fork registers its other MCP servers. It is also listed in~/.t3/mcp-servers.json, so the template scrub removes it.requests/, written via a temp file and a rename. It carries the thread id, working directory, pushed branch and the thread's model (fromt3 thread show --json).T3CODE_THREAD_IDto Claude, and the MCP servers Claude spawns inherit it.claimed/, and the helper withdraws one by moving it towithdrawn/. Only one rename can win, so a withdrawn request never starts.requestIdnever creates a second request.On the host (
SubSandboxRequests.ts):driver.execute(newSandboxProvisioner.runScript). The bridge's bearer only hasorchestration:*scopes and can't read or write files.SandboxRecord.threadId): config, caps, sizes,createSubSandbox, peer link,RemoteDelegation, andcheckWorkat the end.responses/asqueued, thenstarting_sandbox, thenrunning(with the task id and sub-sandbox), thencompleted,failedorcancelled(with the result and where any kept work lives).responses/with its reason:concurrency_full, Linked environments off, no config, size too big, or no turn running on the host.^[A-Za-z0-9_-]{1,64}$. Branches are checked against a strict pattern. The parent thread comes from the host's record, never from the request.queuedwrite lands on the sandbox.t3-sandbox-filesskill, and on every resume of a chat's sandbox. A sub-sandbox never gets it. A failure is only a warning. The template scrub removes the helper's folder, pending requests included.docs/user/remote-access.md"Sandboxes for subagents" anddocs/internals/sandbox-environments.mdexplain the flow and the awake-Mac requirement.Known limitations
RemoteDelegationrecords the task on the chat's active turn on the host, so a turn that didn't go through T3 Code on the Mac or phone is refused. When the chat is idle, the 60 s poll can mean the agent hears "host didn't answer" instead of that refusal.t3 thread show, without its options, or on the bridge's Claude fallback.Test plan
subSandboxHelper.test.ts, with the helper run under Node against a temporary folder:requestId;SubSandboxRequests.test.ts:SubSandboxeswith a sandbox chat as parent;responses/;SandboxProvisioner.test.ts: the helper installs at launch, is backfilled on resume, is skipped on sub-sandboxes, and is removed by the template scrubagentContextBudget.jsonunchanged: the T3 MCP tool list isn't touchedChatView.browserandSidebar.browserinapps/web(22 files,vp test run --project browser) on this branch: 112 of 112 passvp run check:changed origin/feat/sandbox-environmentson this branch: format, lint, knip, graphql, typecheck (38 packages) and React compiler pass. 843 of 844 tests pass; the one failure,sandboxSetup.test.ts > tailscaleScript > falls back to userspace, joins with the key as a 0600 file, and the scrub logs out, fails onfeat/sandbox-environmentstoo.🤖 Generated with Claude Code