Skip to content

feat: teach agents on a sandbox to keep files out of /tmp - #19

Merged
OmarAlex24 merged 1 commit into
feat/sandbox-github-all-reposfrom
feat/sandbox-agent-skill
Nov 11, 2026
Merged

OmarAlex24 merged 1 commit into
feat/sandbox-github-all-reposfrom
feat/sandbox-agent-skill

Conversation

@OmarAlex24

@OmarAlex24 OmarAlex24 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Problem

A sandbox's /tmp is emptied every time it stops and resumes. Agents kept saving screenshots, drafts, logs and extra git worktrees there, and lost them. An image embedded in a reply from /tmp broke for the user after the next stop.

Solution

The host installs a built-in Claude skill, t3-sandbox-files, in every sandbox. It says to save anything needed later under $HOME, in an existing work folder or ~/scratch/<task>/, never in /tmp. Its description names the moments an agent reaches for /tmp, so Claude loads it then.

  • Content. The text lives once, as SANDBOX_FILES_SKILL in apps/server/src/sandbox/sandboxSetup.ts.
  • Launch. The tools step always writes the skill, even when the config chose no skills. It is written after the user's own skills, so a template's older copy is replaced.
  • Resume. The skill is written only when SKILL.md is missing, and before t3 serve starts. That way existing sandboxes get it, and a queued message's first Claude session already sees it.
  • Failures. A failed write is only a warning, on launch and on resume.
  • Docs. docs/user/remote-access.md and docs/internals/sandbox-environments.md describe it.

Known limitations

  • Codex agents don't get it. The fork writes no Codex instructions into sandboxes, and the docs say so.
  • Resume wait. The resume step adds a 30-second agentSkill limit, which raises the bridge's resume wait from 900 to 930 seconds.
  • Status line. A launch with nothing else to set up still reads "Nothing to set up" in its tools step, even though the skill was written.
  • Newer text. A resume never replaces an existing copy, so a sandbox gets newer skill text only on its next launch.

Test plan

  • sandboxSetup.test.ts, in a temporary home:

    • the script writes the skill;
    • a resume leaves an existing copy alone, and fills it back in when it is missing;
    • a launch replaces it.
  • Also in sandboxSetup.test.ts: the skill's name and the triggers in its description

  • SandboxProvisioner.test.ts:

    • a launch with no skills chosen still writes it;
    • a failed write on launch or resume is only a warning;
    • the resume step runs before t3 serve.

    These tests fail without the change.

  • sandbox.test.ts (contracts): the resume wait still outlasts every step

  • vp run check:changed origin/feat/sandbox-environments on this branch: format, lint, knip, graphql, typecheck (38 packages) and React compiler pass. 818 of 819 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 on feat/sandbox-environments too.

🤖 Generated with Claude Code

A sandbox's /tmp is emptied on every stop, and agents kept putting
screenshots, drafts, logs and extra worktrees there. Every sandbox's
Claude now gets a built-in t3-sandbox-files skill: the launch writes it
whether or not the config copies any skills, and a resume adds it when it
is missing. A failure to write it is only a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OmarAlex24
OmarAlex24 added this pull request to stack #13 November 11, 2026 14:55
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Nov 11, 2026
@OmarAlex24
OmarAlex24 merged this pull request into feat/sandbox-environments Nov 11, 2026
8 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant