Repository navigation
fix(sandbox): background work an agent waits on keeps its sandbox on - #71
Merged
t3-code-sandboxes[bot] merged 1 commit intoNov 15, 2026
Conversation
The keep-alive saw only thread statuses and updates, so a sandbox stopped while an agent waited on subagents, background commands or monitors, killing the agent before it woke. It now reads every thread's pending background work: work that holds a thread counts as busy, and work no agent waits on, such as a dev server, keeps the sandbox on up to the running limit. Each check logs how many threads had background work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
Base automatically changed from
fix/sandbox-model-parity
to
feat/sandbox-environments
November 15, 2026 21:16
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.
Stacked on #70.
Problem. A Boat sandbox stops after about 35 minutes "without work". The keep-alive only counted threads with a queued, preparing, starting or running status, or a thread changed since its last check. An agent waiting on background subagents, background commands or monitors looked idle: its thread was
waitingorcompleted, and native subagent children list as idle. So Boat stopped the sandbox mid-wait, killing Claude Code and its tasks, and the agent never woke. On a user's own machine that work is never killed for being idle.Fix (keep-alive script only).
nextCursor, and judges each check in this order:subagentorbackground_task, or anawaitedcommand or monitor. These are the same rules asbackgroundWorkHoldsCompletion.pendingBackgroundTaskson list items, so no server or contract changes. On an older T3 without that field, it behaves as before.busy pending=2 extend 200), so a stop can be explained afterwards.docs/user/remote-access.mdnow covers this.Test plan
sandboxSetup.test.ts"counts background work an agent will wake for, and a dev server to the limit": the work sits on page 2 of the list (awaited command, waiting parent with a subagent, idle child) and gives one extend. The CLI fallback carrying a subagent also extends, and a lone dev server extends at 59 min but not at 60. Gives 0 extends on the base.sandboxKeepAliveScripttests (5/5) and the server typecheck pass on the stack tipClaude Opus 5.5 via Claude Code.
🤖 Generated with Claude Code