Repository navigation
Conversation
…hers Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and reconciliation Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ough MCP tools Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eir UI state Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nment settings Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # apps/server/src/peer/PeerLinks.test.ts
The release smoke fixture rebuilds the lockfile from a fixed list of workspace manifests. The server depends on @t3tools/cloud-sandbox, which depends on @t3tools/boat, so the install failed without both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… saved Clients without sandbox support reject unknown tags in the catalog's targets, profiles and credentials, then replace the whole catalog with an empty one. Sandbox records are now stored under separate keys those clients ignore, and merged back in when decoding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ew tests The resolver imported the managed sandbox client, which imported the environment HTTP helpers, which imported the supervisor, which imports the driver, which imports the resolver. ChatView's browser test mocks the driver with importOriginal, so the cycle deadlocked module loading and Test Web hit its 10 minute limit. The request helpers now live in environmentHttpRequest.ts with no supervisor import. environmentHttpAuth.ts re-exports them and keeps the supervisor-bound helper, so its public path is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The directory cached its controller listing for 30 seconds, including an empty list from a failed or timed-out request, and never re-listed on a miss. A sandbox that existed could read as missing for that long. Only successful listings are cached now, and a miss on a cached listing lists again once. The test fixture also lacked profileId, so its listing never decoded and the old test passed without finding a sandbox. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only new allocations checked the concurrency cap and monthly budget. A stopped sandbox holds no running slot, so resuming it from the UI, from an agent's connect, or by re-provisioning its operation id could exceed both. All three now reserve through the same check first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
HttpRouter.provideRequest builds its layer in a forked memo map that only reuses what the parent has already built. It was provided outside the manager, so it built first and made a second manager with its own routes and reconcile loop. Providing the manager after it keeps one instance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ensureCloudSandboxReady resumed only when its first read said stopped. A sandbox still stopping then reached stopped during polling and stayed there until the 60 second timeout. Resume after a Stop hit this. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The client never passed the Retry-After header to parseRateLimit, so waitMs was never set and the controller never sent a retry delay. A 429 with Retry-After but no window in its body now counts as paced too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The wizard clears the parent error on Back and on type or step changes, so a failed key check no longer stays on the first step. - The desktop viewer keys on the controller and resource ids, so each 30 second status poll no longer reopens the desktop session. - Refreshing a preview does not release the forward when the server returns the same URL. - The desktop panel shows the failure's message instead of String() of the error, and nothing for an interrupted command. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The case used callsMust, which the grader ignores, so it checked only the final text. It now rejects any sandbox delegation in wait mode. The prompt names no task, so the model rightly starts nothing, and the case does not require a delegation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # apps/server/src/peer/RemoteDelegation.ts # apps/server/src/provider/agentContextBudget.json # apps/web/src/components/settings/settingsSearch.ts # apps/web/src/components/settings/useAvailableSettingsSearchItems.ts
closePreviewSession now releases a preview's forwarded URL through browserTargetResolver, which imports the sandbox preview code and its command runtime. The test replaces client-runtime/state/runtime with one export, so loading failed on createAtomCommandScheduler. The test does not exercise releasing, so the resolver is mocked like the other command modules it replaces. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An agent's connect on a child read the record and reserved its slot before taking the child's lock. A stop or delete in that window was overwritten by the reservation's save, so a deleting child could become active again. The reservation and connect now run in one critical section, and only an active stopped record is reserved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…allow-list A delegated task normally checks the source project's provider allow-list in dispatch. A sandbox task returns before dispatch and launches in the child's project, so an explicitly named instance the source project turned off still ran. The sandbox path now checks it first. A retry of an accepted delegation still skips the check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…imits Blocks the child's stop on a Deferred, starts a source connect that queues on the child's lock, lowers the profile cap so the source alone fills it, then releases the stop. The connect must fail with concurrency and leave the child stopped. Before c00800a it read the child as running before the stop, skipped the check, and resumed it over the cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… stay provider-owned Budgeted admission no longer counts an unknown machine rate as free: a missing, non-finite, or negative rate refuses the allocation, and an existing sandbox whose running cost cannot be confirmed refuses new admission too. A release whose lifetime spend cannot be estimated now records unknown spend instead of a fabricated zero. Providers report their machines (labels and hourly rates) instead of shared code knowing boat.dev's sizes, so a test-only second driver runs the same allocation, resume, and lifecycle rules. Disconnect still leaves compute running; the sandboxes list and the user guide now say so. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
… and exclude account envs Managed sandboxes now pass noEnv: true on every create, which boat.dev documents as the way to keep account secrets and repository access out of the VM; the request shape is asserted in tests. SSH host keys are pinned on first use and stored across restarts: a changed key for the same resource fails the connect until the resource is deleted, which drops the pin. A lost create response is recovered by re-adopting the VM that carries the controller's durable operation id in its provider name, instead of allocating a second one. The user guide states the uninstall and budget semantics. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
Distinguish managed compute from its owner so disposable task/thread sandboxes stop looking like selectable environments. Resource records now decode with explicit `owner` (user/thread/task) and `retention` (manual/stop-and-retain/delete-on-completion); legacy payloads decode as user-owned so old records stay visible and recoverable, no new migration needed (records persist whole in payload_json). - `manager.bindOwner` stamps ownership under the resource lock: the host environment id is derived by the controller (route path) or the authenticating source record (child path), never asserted by callers; rebinding to a different owner is refused; same-owner retries stay idempotent. - Root-initiated forks inherit the source owner; child-initiated forks begin unbound and are bound to their task after delegation. - Delegated workspaces bind task ownership once the child task exists, through the controller proxy in-sandbox or the local manager at the root; a failed bind leaves the resource user-owned for the sweep. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…ller host Add an explicit allowlist of settings fields a follower may inherit (defaultModelSelection, fallbackModelSelection, defaultRuntimeMode, responseStreamingMode, defaultAutoPull). Field classification fails closed, so settings added later stay host-only until classified; secrets, secret references, host paths, provider instances, source-control credentials, and identity config are excluded by rule. The controller keeps a versioned ledger of approved inheritance that recomputes on every host settings save without blocking or failing the save, persists one revision per genuine content change, announces only persisted approvals, and adopts current settings at boot under the same lock as saves so nothing saved across the subscription attach window is lost. The follower pulls the approved snapshot over the existing controller channel, seeds only allowed non-default fields at provision, resets inherited keys to defaults when the host reverts them, never overwrites sandbox-local values, refuses out-of-order or unclassified revisions, and replays the latest approved revision on reconnect. The hostSettings source operation exposes the snapshot to running followers. Tests: field classification against the settings schema, secret and path exclusion, initial seed and boot adoption, reset-to-default, out-of-order refusal, skip at equal revision, offline replay, and non-blocking host save. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
A follower resource's release now attributes its one spend line to the controller host it forked from: the amount is still guarded by and counted under the follower's own resource id, so per-resource VM cost stays in the profile and manager records and the same release recorded twice never adds twice. The profile payload records the controller host resource id in a dedicated attributedResourceIds list with no usd effect, so attribution doubles as owner provenance without duplicating the amount. Old payloads decode unchanged (optional key, no migration). Tests: single-count release with host attribution, repeated release adding nothing, and the host's own release staying its own line. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
Environment pickers and selectable environment counts now derive from the resource record's owner: user-owned sandboxes are selectable, while thread and task owned followers stay hidden as their controller host's private delegated compute. A `selectableManagedSandboxesAtom` family sits beside the polled managed list in the web and mobile connection state so picker surfaces can read the filtered view; the full list stays available for controller administration surfaces, where followers remain listed as delegated compute of their host. No authorization changes: forwarding, project access, and child-thread access are untouched; the filtering is presentation-only and derived from the record owner. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…mpletion `delete_task` with sandbox isolation accepts `deleteOnCompletion`. The workspace binds that retention on the resource, and the sweep releases a stopped follower once its delegated task settles to a terminal status (read from the parent thread's stored `subagent.updated` events; an unreadable or unsettled task is never treated as settled). Default task behavior is unchanged: stopped followers are retained until an owner deletes them or they are orphaned. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
Follower sandboxes that hit a provider-auth, connectivity, bind, or allocation failure now carry an optional `issue` on their managed resource record. Presence is state: overwritten on a new failure class, cleared on recovery, idempotent repeats refused. The controller's issue ticker dispatches `delegated_task.remote.issue`, projected into `remoteChild.sandboxIssue` on the parent thread through the existing `subagent.updated` event, so task cards render the degraded state and its clearance with no new transport, no synthetic turn items, and no waking of the delegated child. Settings collapse follower issues per controller into one banner per dead cloud profile; per-resource rows keep individual detail. Docs updated with the issue/notice model. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
Blind review fixes. The card's issue clear lived only in the reporter's in-memory told-map, so a controller restart across a degraded-then-recovered follower left a permanent stale warning: redrive now reconciles each task owner's card against its resource once per process, clears stale cards, and reports each attempt as its own command id (per-attempt uuid, the remote-task-complete precedent), so a failed or burnt id never blocks the next retry. Connect failures now classify provider-token rejections as provider-auth instead of mislabeling them allocation. The refused-bind stamp moved under the record lock so it cannot race a recovery's clear back onto a connected record, and a same-cause stamp is a full no-op (first wording stands) so the record and the card cannot drift. New tests cover the stamping state machine and the restart redrive. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…nship rows The follow loop retried an unreachable linked environment forever, leaving its task running with only server logs; retries are now bounded (10 minutes or 40 attempts) and past the budget the follower completes the task failed with the unreachable wording. The relationships listings now degrade the same way the task card does: web rows show the warning "on X · issue" with the issue detail in the row tooltip's hint, and the mobile agents sheet says so in its accessibility hint. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…llup banner Web browser tests now assert the settings section's collapsed follower-issue banner (cause label, plural affected count, per-row issue lines) and the relationships row's degraded pill plus tooltip carrying the same line. Mobile gains a SubagentRow react test covering the issue suffix beside a remote task's metadata and its absence when healthy. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…wer reporting All four issue causes were exercised against a real Boat.dev account and a scratch controller: refused rebind stamps and clears on recovery, a dead token lands a failed provision with no allocation, and a blocked transport stamps connectivity and clears on the next successful reconcile. Render coverage and operation timing notes came out of the same run. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <[email protected]>
…ent context budget The smoke-test sweep found three defects already on the branch: the boat driver test pinned a capabilities object that 00fb872 changed without updating it, the mobile SubagentRow test never typechecked (unbranded driver/providerInstanceId, null where the contract wants undefined), and dd3598d grew the delegate_task schema past the committed tool-list budget (measured 49471 vs committed 49204). Derive the machines expectation from the driver, brand the fixture values, and set the budget json to the measured value. The budget is now 1105 bytes over main, so CI's budget gate needs the agent-context-increase label or a text cut. Model: zai-glm-5-3 (omp harness).
# Conflicts: # apps/server/src/peer/PeerForwarding.test.ts # apps/server/src/peer/PeerLinks.ts # apps/server/src/peer/RemoteDelegation.test.ts # apps/server/src/peer/RemoteDelegation.ts # apps/server/src/persistence/Migrations.ts # apps/server/src/persistence/reconcileV2PreviewMigration.test.ts # apps/server/src/provider/agentContextBudget.json # apps/web/src/components/RightPanelTabs.tsx # apps/web/src/components/chat/ThreadRelationshipsControl.tsx # apps/web/src/components/preview/PreviewView.tsx # apps/web/src/components/settings/AddEnvironmentDialog.browser.test.tsx # apps/web/src/components/settings/AddEnvironmentDialog.tsx # apps/web/src/components/settings/AddProviderInstanceDialog.tsx # packages/client-runtime/src/connection/model.ts # packages/client-runtime/src/state/environmentHttpAuth.ts # packages/ssh/src/command.test.ts # packages/ssh/src/tunnel.test.ts # packages/ssh/src/tunnel.ts
# Conflicts: # apps/server/src/peer/PeerLinks.test.ts
|
This PR changes the test suite by +203 test cases (browser +17, unit +66, server +120). New browser test files: Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing. |
Persist and recover pending task ownership without duplicating running work. Repair lifecycle cleanup, conservative budget reservations, nested diagnostics, setup authorization, provider deadlines, preview cleanup, and RPC error privacy. Improve provider setup and key replacement across clients. Apply the reviewed fixes on PR #1 head 73d0e74, preserving its newer main merges and existing fixture corrections. Record the measured MCP tool context as 49337 bytes. Validation: check:changed 73d0e74 passes with 212 tests across 16 affected files, 11-package type checks, lint, format, unused-code, GraphQL, and React compiler checks. Earlier real-browser and Boat evidence covers the feature flows; controlled browser alias verification covers remint and close behavior.
Thread transfer impact
This comment will update automatically after the next completed run. |
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
T3 can connect to existing environments, but cannot provision and manage disposable cloud compute as first-class environments. Agents can delegate work to local worktrees, but cannot create isolated cloud VMs for those tasks.
This requires more than a provider API integration. Provisioning, credentials, remote access, lifecycle recovery, cost controls, project transfer, and agent orchestration need to work together without coupling T3 to one VM provider.
Summary
This PR adds provider-agnostic cloud sandbox environments and agent workspaces, with Boat.dev as the first provider adapter.
Each sandbox runs its own T3 server and appears as another environment. The user's T3 server, called the controller below, provisions the VM through a common provider driver, retains provider API credentials, maintains SSH connectivity, and proxies client traffic. Clients and agents never receive provider API keys.
Managed sandboxes also carry explicit ownership and retention on their record. Sandboxes created for or by agents act as followers of their owning thread or task: they stay out of environment pickers, inherit only classified settings from their controller, attribute their spend to that controller, and can opt into deletion once their delegated task settles. A follower that loses its provider token, connectivity, bind, or allocation carries the degradation as state on its record, reported to its owning task card and collapsed into one warning per controller profile — without synthetic transcript items, without waking the delegated task, and with clears that survive controller restarts.
The change includes the provider contract, persistent sandbox management, first-class environment integration, desktop and port previews, and MCP-based agent delegation. Boat.dev is the only implemented and tested provider; its adapter is the initial reference for future adapters, not the boundary of the feature.
Proposal and discussion: pingdotgg#27949. The proposal has not received maintainer approval of scope. This PR requests that decision for the framework, managed environments, agent workspaces, and Boat.dev adapter.
Sandbox orchestration also extends T3's MCP capabilities. The sandbox additions measured +971 bytes on the serialized tool list when introduced. Shortening the added descriptions caused sandbox evaluation regressions. Latest recorded measurements: 49,337 bytes on this branch (2026-11-13,
40dbb0f59e) and 49,736 bytes on currentmain(2026-11-15), so merging adds no serialized-list growth today; theagent-context-increaselabel request should be re-weighed againstmainat review time.User-facing behavior
Web and desktop
Mobile
Environment settings provide sandbox management (Open, Stop, Resume, Delete), the same follower-issue banners, and follower-free environment selection. Physical-device behavior has not yet been verified; the management component has automated coverage.
Agent workspaces
delegate_taskwithisolation: "sandbox": Provision a fresh VM, transfer the source project, launch a child thread, and return control asynchronously.t3_worktree_handoffwithisolation: {kind: "sandbox"}: Fork the current managed sandbox's disk, including uncommitted changes, rather than starting from a fresh image.preview_share: Make a running service port accessible from inside a managed sandbox.delegate_tasksandbox delete-on-completion: A task's follower can opt into deletion once its delegated task settles and the VM has stopped; the orphan sweep reclaims the rest only when the source thread is gone.Sandbox delegation requires linked environments to be enabled, but does not turn linking on for pre-existing environments. Child tasks inherit the source project's provider allow-list rather than gaining unrestricted providers.
Outside this PR
Architecture
The controller owns lifecycle decisions. Client-facing routes and RPC handlers delegate to the manager; provider implementations stay behind a driver boundary.
flowchart TB subgraph Clients UI["Web / desktop / mobile"] CR["packages/client-runtime"] UI --> CR end subgraph Controller["apps/server — controller"] R["Managed routes / RPC"] MCP["MCP tools"] W["CloudSandboxWorkspaces"] M["CloudSandboxManager"] P["CloudSandboxProfiles"] S[("CloudSandboxStore · migration 081")] T["CloudSandboxTransport · packages/ssh"] R --> M MCP --> W W --> M M --> P M --> S M --> T end D["packages/cloud-sandbox · driver contract / registry"] B["packages/boat · Boat.dev adapter"] VM["Cloud VM · t3 serve"] CR --> R M --> D D --> B B --> VM T <-->|"SSH forward / reverse tunnel"| VMThe key responsibilities are:
packages/cloud-sandbox: Provider-independent driver interface and lifecycle contract.packages/boat: Provider-specific API operations; no client-side Boat.dev dependency.CloudSandboxManager: Allocation, connections, controls, reconciliation, and serialization of state-changing operations.CloudSandboxProfilesandCloudSandboxStore: Credentials, policies, accounting, and persistent VM records.CloudSandboxTransport: SSH transport, HTTP forwarding, and the reverse tunnel.CloudSandboxWorkspaces: Project transfer, child-thread orchestration, and integration with existing delegation/peer-link infrastructure.packages/client-runtime: Managed sandbox connection targets, discovery, and environment resolution.Connectivity and trust boundary
Clients connect only to the controller, whether over LAN, Tailscale, or T3 Connect. The controller controls provider calls and proxies requests to the sandbox over SSH. Sandboxes need neither public inbound ports nor their own public TLS/tunneling setup.
The controller exchanges the VM's bootstrap pairing token for a bearer token. Provider API keys remain controller-side. The sandbox T3 server and the controller communicate over SSH forwards; a reverse tunnel supports project source transfer.
Provisioning sequence
The shared profile lock prevents concurrent starts from each independently passing the same budget and concurrency checks. Sandbox operations are also serialized under per-sandbox locks.
Provisioning failure is handled by the controller, which retains the provider resource identifier for reconciliation and cleanup rather than handing partially initialized resources to clients.
Lifecycle model
A sandbox record deliberately tracks three separate dimensions:
These must not be collapsed into a single status. A VM can be running but unreachable, which is materially different from a stopped VM: the former may continue billing. Deletion can also be pending while provider cleanup is retried.
stateDiagram-v2 [*] --> allocating allocating --> active allocating --> failed active --> deleting failed --> deleting deleting --> deleted deleted --> [*] state active { running --> stopped: Stop / auto-stop stopped --> running: Explicit resume }The client-facing phase is derived, in priority order: non-active lifecycle state; stopped power; disconnected intent; connected if a live route exists; otherwise connecting. A failed health check therefore does not falsely imply that the VM stopped.
Ownership is a separate explicit property, present since the follower-architecture commits:
user,thread, ortask(host, source thread, and task id), plus a retention policy (manual,stop-and-retain,delete-on-completion). It decides who may bind, control, and release the resource, and only user-owned sandboxes are selectable; it is never derived from power, intent, or connectivity, and followers keep their registration and routes while hidden from pickers. A follower's degradation rides the same record as an optionalissue(cause, driver, profile, message, first-seen), cleared by a successful connect or rebind; the controller reports changes to the owning task's card through the existingdelegated_task.remote.issueinternal command, and Settings collapses open issues per controller profile. Pending ownership is durable: delegated allocations belong to their source thread from creation and bind to their task once its id exists; workspace journals persist setup and retention intent before allocation and checkpoint the prepared checkout, so a lost response or controller restart resumes setup and binding without duplicating running work or re-copying transferred files. Recovery never overwrites a different existing owner and never revives a deleted workspace; legacy completed journals recorded before binding intent are conservatively repaired tostop-and-retain.Reconciliation and failure recovery
The controller reconciles sandbox state once a minute, with up to eight records processed concurrently. For each live record (including deletion records still associated with a provider VM), it compares persisted state against provider-side state.
Core rules:
These rules also cover externally deleted VMs and partial failures between provider creation, SSH bootstrap, persistence, and client registration. Cleanup must remain idempotent: neither a broken connection nor a lost client is proof that a billable resource no longer exists.
Budget and concurrency semantics
Each provider profile has a monthly budget and maximum concurrently running sandbox count (default: three). Allocation and every explicit resume path perform admission checks under the profile lock; per-sandbox locks serialize operations against the same VM. In-flight provisions and resizes hold a durable reservation until provider state is observed: admission counts the highest hourly rate among the requested size, the previous selection, and any recorded reservation, so a lost resize response cannot under-count the profile's budget.
The controls are start/resume admission limits, not a guaranteed provider-side spending ceiling. A VM already running may incur charges after the budget threshold. A credible strict spending ceiling would require additional live-spend enforcement and stop behavior.
That distinction is especially important for agent-initiated provisioning: automatic recovery must not silently start billable compute, and concurrent agents must not bypass configured caps.
Agent delegation and disk handoff
The regular delegation path provisions a fresh VM and transfers the source project's files. The handoff path instead forks the current sandbox's disk so uncommitted state survives. Both reuse the existing thread/peer-link model rather than introducing a separate agent execution protocol.
A delegated task whose linked environment becomes unreachable follows it with back-off for at most 10 minutes (40 attempts); past that the task completes failed locally, so a dead follower ends as either a stamped degradation issue (stamped immediately on the record) or a clean terminal failure — never a task that shows running forever.
Design rationale and trade-offs
The following choices are deliberate and worth reviewing as architectural decisions, not incidental implementation details.
Controller-owned provider access. Concentrating credentials and VM controls in the user's T3 server avoids leaking keys to browser, mobile, or agent clients and avoids duplicating provider integrations across platforms. It also makes the controller a critical point for recovery and cleanup.
Controller-mediated connectivity. SSH-forwarded requests reuse T3's existing remote environment model and eliminate public ports on sandboxes. The trade-off is an additional hop and controller dependence for connectivity.
Provider contract before additional providers. Boat.dev is a concrete adapter of the general contract, not a Boat-only architecture. A second adapter remains the important test of whether provider-neutral assumptions are genuinely neutral.
Orthogonal state dimensions. Keeping lifecycle, power, and connection intent separate prevents connectivity failures from being mistaken for stopped compute and makes partial deletion recoverable.
No automatic resume in reconciliation. Recovery may reconnect to a running VM or stop an unwanted one, but must not start new billable runtime without an explicit action.
Shared and per-sandbox locks. Shared profile admission checks prevent oversubscription; per-sandbox serialization prevents conflicting stop, resume, connect, and delete operations.
HTTP 410 for externally deleted VMs. Permanent absence is distinguishable from transient unavailability, so clients can stop infinite retries and clean up stale registrations.
Asynchronous sandbox delegation. Provisioning does not fit a synchronous tool-response model. Existing peer links provide a way for parent threads to follow the child after delegation.
Source-project provider restrictions. Isolation cannot be used as a bypass for the parent's allowed-provider policy.
Backward-compatible connection catalog keys. Older clients can still use existing environments, but may drop sandbox registrations when saving their catalog. Reopening from Settings restores them; eliminating that limitation requires additional migration/storage work.
Preserved MCP descriptions. Shortening tool descriptions reduced context consumption but caused agent-eval regressions. The current working descriptions increase serialized tools by 971 bytes, motivating the
agent-context-increaselabel.Review order
For a focused code review, I recommend reading the implementation in this order:
packages/cloud-sandbox, thenpackages/boat.apps/server/src/cloudSandbox, migration081_CloudSandboxes.packages/ssh, managed HTTP proxy and authentication paths.CloudSandboxWorkspaces,PeerLinks,RemoteDelegation(including the bounded follow loop and thedelegated_task.remote.issuedispatch), and MCP schema changes.packages/contracts,packages/client-runtime(issue/rollup atoms).apps/webandapps/mobile(follower-issue banner, degraded task pill, mobile issue suffix).docs/user/remote-access.mdanddocs/internals/cloud-sandboxes.md.Highest-risk review questions: Can any path start or leave compute billable without a corresponding lifecycle record? Are state transitions and final accounting idempotent? Can credentials or sandbox routes cross the wrong trust boundary? Do shared SSH, environment-catalog, and agent-delegation changes regress existing behavior?
Verification
Real Boat.dev VM
The following were observed on one small Boat.dev VM, not established as performance guarantees:
Regression coverage
The review rounds included tests for failures that existed in earlier revisions:
@t3tools/cloud-sandbox; smoke passed.concurrency, leaving the child stopped.invalid_request.The logic fixes have regression tests that fail against the prior behavior.
Package tests and agent evals
(Counts below predate the follower-ownership, degradation-reporting, and follow-loop commits, and the later review-hardening commits
40dbb0f59e,b6919ee5d2, and5536eb9633. The follower work adds server suites for stamping, orchestrator set/clear refusal, and restart redrive, client-runtime rollup tests, web browser tests for the follower-issue banner and the degraded task pill/tooltip, and a mobile react test for the task-row issue suffix. The review-hardening work extractsCloudSandboxWorkspaceLifecycle, centralizes admission and reservations inManagerReservations, and adds manager, workspaces, preview, transport, ws, sandbox-handler, boat-client, and tunnel tests; running counts are not re-measured here.)cloud-workspaceseval: 9/9 passed.file-watcher-after-async-delegatescase does not use sandbox tools and passed 2/3 attempts on rerun.sandbox-delegate-wait-refused: 3/3 passed with Claude Sonnet 5.5 after correction.Format, lint, Knip, and typecheck passed after integrating the then-current
main.Not yet verified
Live verification (2026-11-12/13, real Boat.dev VMs)
Exercised end to end against a scratch controller and the user's Boat account:
issue {cause: "bind"}(HTTP 403) while the sandbox stays healthy and owned by its original task.failedrecord withissue {cause: "provider-auth"}andsandboxId: null— no VM allocated, no billing.issue {cause: "connectivity", message: "The managed cloud connection could not be established."}on a still-running VM; restoring access reconnected within one reconciliation tick and cleared the issue.910654cf17.UI evidence
Add environment: Cloud sandboxes are listed beneath “Or use a cloud sandbox.” SSH is absent in the web screenshot because it is only available in the desktop client.
Sandbox management: Open, Stop, Resume, and Delete appear in Settings. These screenshots use display-only records seeded on a scratch server; the Deleting record illustrates reconciliation of an unreachable fake VM.
Provider key and defaults:
Editing limits:
Delete confirmation:
Merge Danger
Door: one-way. Migration
081_CloudSandboxesadds persistent tables. Reverting the code does not automatically remove those tables or terminate already-provisioned VMs. Live provider resources can keep billing after a code rollback. Cleanup therefore requires an explicit inventory and termination plan independent of the database rollback.Ownership, retention, the degradation
issue, and the allocationreservationride that same migration's JSON payloads — no new table or migration; payloads written with them decode on older builds as user-owned, manual, healthy records (binds and follower states are lost on rollback, never records).Blast radius: moderate. The new sandbox feature is inactive until a provider profile is configured, but this PR changes shared paths used by existing functionality:
RemoteDelegationandPeerLinks.The MCP tool list is shared, so its size affects agents even when sandbox isolation is not selected; the latest recorded measurements show no net growth against current
main. The principal risks are unintended billing, incomplete resource cleanup, connection compatibility regressions, and altered agent delegation behavior.Written with Claude Opus 5.5 in Claude Code.