Skip to content

Remove sandbox_files / setup.sh feature#339

Merged
krrish-berri-2 merged 2 commits into
mainfrom
worktree-remove-setup-sh
May 26, 2026
Merged

Remove sandbox_files / setup.sh feature#339
krrish-berri-2 merged 2 commits into
mainfrom
worktree-remove-setup-sh

Conversation

@krrish-berri-2
Copy link
Copy Markdown
Contributor

Summary

  • setup.sh caused every E2B sandbox provision to timeout — pip install litellm[proxy] exceeded the 120s budget. Skills cover any legitimate "seed files into harness" need.
  • Removes sandbox_files DB column, all schema/API surface, the setup.sh execution block in e2b.ts, and the setup.sh editor UI from the agent detail page.
  • SandboxFileSpec type and envMap return value unchanged — still used by skills and the provider interface.

Changes

File What changed
prisma/schema.prisma + migration Drop sandbox_files column
src/server/sandbox/e2b.ts Remove readEnvMap() and setup.sh execution
src/server/types.ts Remove field from CreateAgentBody, UpdateAgentBody, ApiAgent, toApiAgent
src/lib/api.ts Remove field from ApiAgent, CreateAgentRequest, UpdateAgentRequest
src/app/api/v1/.../session/route.ts Remove rawSandboxFiles blocks from coldBringUp/warmBringUp/finishBringUp
src/server/rehydrate.ts Remove rawFiles extraction; drop unused SandboxFileSpec import
restart/route.ts, opencode/route.ts, reconcile.ts Same rawFiles removal
src/app/agents/[id]/page.tsx Remove setup script state, handlers, and UI section
src/app/agents/new/page.tsx Remove sandbox_files: selectedProject?.files from create payload
agents/route.ts, agents/[agent_id]/route.ts Remove Prisma persist blocks

Test plan

  • npx tsc --noEmit passes (zero errors)
  • Agent detail page loads without setup.sh editor
  • Create a new agent — no sandbox_files field in payload
  • Session create completes without setup.sh timeout

🤖 Generated with Claude Code

setup.sh caused every E2B sandbox provision to timeout (pip install
litellm[proxy] exceeded the 120s budget). Skills cover any legitimate
"seed files into harness" need.

- Drop sandbox_files column (Prisma migration + schema)
- Remove readEnvMap() and setup.sh execution from e2b.ts
- Remove sandbox_files from all zod schemas, API interfaces, and mappers
- Remove rawFiles extraction from all session create / rehydrate paths
- Remove setup.sh editor UI from agent detail page

SandboxFileSpec type and envMap return value unchanged — still used by
skills and the provider interface.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@krrish-berri-2
Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 26, 2026

Greptile Summary

This PR removes the sandbox_files / setup.sh feature end-to-end: the database column is dropped, all API surface (schema validation, type definitions, Prisma writes) is removed, the E2B setup-script execution block is deleted, and the setup.sh editor is stripped from the agent detail page.

  • Schema & migration: sandbox_files is dropped with IF EXISTS and inline comments documenting the reason (timeout root cause + skills as the replacement), satisfying the repo's documented-deletion rule.
  • E2B provider: readEnvMap() and the setup.sh execution block are removed; envMap is now returned as {} since setup.sh was the only mechanism to populate it.
  • Session bring-up paths: All four paths (cold, warm, inline POST, rehydrate/reconcile/restart) have their rawFiles/sandboxFiles blocks removed consistently; skillFiles is passed directly where allFiles previously spread both sources together.

Confidence Score: 5/5

Safe to merge — a straightforward removal with no functional regressions; the feature being deleted was actively causing timeouts.

The removal is consistent across all fourteen changed files: the DB migration, every bring-up code path, all type definitions, and the UI. The migration uses IF EXISTS, is documented, and the SandboxFileSpec type is intentionally preserved for skill use. No dangling references or partial rollouts were found.

No files require special attention.

Important Files Changed

Filename Overview
prisma/migrations/20260526000000_remove_sandbox_files/migration.sql Drops sandbox_files column with IF EXISTS guard and inline comments explaining the reason — satisfies the repo's documented-deletion rule.
src/server/sandbox/e2b.ts Removes readEnvMap() and the setup.sh execution block; envMap is now returned as {} which is correct since setup.sh was the only mechanism to populate it.
src/app/api/v1/managed_agents/agents/[agent_id]/session/route.ts Removes sandbox_files extraction from all three bring-up paths (cold, warm, inline POST) and from finishBringUp's signature; skillFiles is now passed directly where allFiles was.
src/server/types.ts Removes sandbox_files from CreateAgentBody, UpdateAgentBody, ApiAgent, and toApiAgent; SandboxFileSpec type intentionally preserved for skill use.
src/lib/api.ts Removes sandbox_files from AgentRow, CreateAgentRequest, and UpdateAgentRequest client types; SandboxFileSpec export kept for skill callers.
src/server/rehydrate.ts Removes rawFiles extraction and SandboxFileSpec import; both harnessCreateSession calls no longer pass files, consistent with other rehydration paths.
src/app/agents/[id]/page.tsx Removes all setup script state, handlers (currentSetupScript, openSetupScriptEditor, handleSetupScriptSave), and the UI section; no remaining references to sandbox_files.

Reviews (3): Last reviewed commit: "fix: address greptile review feedback (g..." | Re-trigger Greptile

Comment thread src/app/api/v1/managed_agents/agents/[agent_id]/session/route.ts Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 26, 2026

Greptile Summary

This PR removes the sandbox_files / setup.sh feature end-to-end: the DB column is dropped, the E2B execution block is deleted, all API schema fields are stripped, and the setup-script editor is removed from the agent detail page.

  • The migration includes an explanatory comment and uses DROP COLUMN IF EXISTS, satisfying the team's column-deletion documentation rule.
  • The SandboxFileSpec type and envMap contract are intentionally preserved because skills still depend on them.
  • One bring-up path in session/route.ts (the inline-harness new-session block, ~lines 697–732) was not cleaned up: agent.sandbox_files is still read and an always-empty sandboxFiles array is still spread into harnessCreateSession. This is harmless at runtime but is inconsistent with the rest of the PR.
  • src/app/agents/new/page.tsx retains a dead SandboxFileSpec import and LocalProject.files field that no longer serve any purpose.

Confidence Score: 4/5

Safe to merge — the column removal and all primary code paths are handled correctly; the leftover sandbox_files read in the inline-harness path evaluates to an empty array and causes no incorrect behavior.

The cleanup is thorough across 13 of 14 changed files. The one missed spot — reading agent.sandbox_files in the inline-harness session-create block of session/route.ts — is inert after the migration (the column is gone so the value is always undefined/[]), but it is still unfinished work from the stated goal of the PR. The dead import and interface field in new/page.tsx are in the same category.

src/app/api/v1/managed_agents/agents/[agent_id]/session/route.ts around the inline-harness create-session block (lines 697–732) — the only place the feature was not fully removed.

Important Files Changed

Filename Overview
prisma/migrations/20260526000000_remove_sandbox_files/migration.sql Drops sandbox_files column with IF EXISTS guard and an explanatory comment satisfying the column-deletion documentation rule.
prisma/schema.prisma Removes sandbox_files Json field from the Agent model in sync with the migration.
src/app/api/v1/managed_agents/agents/[agent_id]/session/route.ts Three bring-up paths cleaned up correctly, but the inline-harness create-session code (lines 697–732) still reads agent.sandbox_files and spreads a now-always-empty sandboxFiles array — a missed removal.
src/app/agents/new/page.tsx Removes sandbox_files from the create payload but leaves the SandboxFileSpec import and LocalProject.files field as dead code.
src/server/sandbox/e2b.ts Removes readEnvMap helper and the setup.sh execution block; envMap: {} is now the always-correct return value since the feature is gone.
src/server/types.ts Removes sandbox_files from CreateAgentBody, UpdateAgentBody, and ApiAgent; SandboxFileSpec type itself is retained as it is still used by skills.
src/lib/api.ts Removes sandbox_files from AgentRow, CreateAgentRequest, and UpdateAgentRequest client interfaces cleanly.
src/server/rehydrate.ts Removes rawFiles/files extraction and all downstream usages from both the inline and pod-based rehydrate paths; unused SandboxFileSpec import also dropped.
src/server/reconcile.ts Removes sandbox_files read and files pass-through from the stuck-session recovery path.
src/app/agents/[id]/page.tsx Removes all setup-script state, editor UI, save handler, and decode helper — clean deletion with no leftover references.
src/app/api/v1/managed_agents/agents/route.ts Removes the conditional sandbox_files Prisma persist block and its explanatory cast comment from the agent create route.
src/app/api/v1/managed_agents/agents/[agent_id]/route.ts Removes the sandbox_files conditional update from the agent PATCH route.
src/app/api/v1/managed_agents/sessions/[session_id]/opencode/[...path]/route.ts Removes rawFiles extraction, SandboxFileSpec import, and files pass-through from the inline recovery path.
src/app/api/v1/managed_agents/sessions/[session_id]/restart/route.ts Removes rawFiles and files from the restart create-session call.

Comments Outside Diff (4)

  1. src/app/api/v1/managed_agents/agents/[agent_id]/session/route.ts, line 697-699 (link)

    P2 Incomplete removal — the inline-harness create-session path still reads agent.sandbox_files and splices the result into harnessCreateSession. Every other bring-up path had its equivalent block removed in this PR, but this one was missed. After the migration the column no longer exists in the DB, so rawFiles is always undefined and sandboxFiles is always [], making the spread harmless but entirely dead.

  2. src/app/api/v1/managed_agents/agents/[agent_id]/session/route.ts, line 732 (link)

    P2 Follow-up to the dead sandboxFiles variable: this spread should become just inlineSkillFiles once the stale variable is removed.

  3. src/app/agents/new/page.tsx, line 23-34 (link)

    P2 The files field on LocalProject and the SandboxFileSpec import are now dead code. sandbox_files is no longer passed in the create payload, so selectedProject?.files is never consumed. The SandboxFileSpec type in @/lib/api is still valid (used by skills), but this local interface field and the import that exists solely to type it can be removed.

  4. src/app/agents/new/page.tsx, line 40-49 (link)

    P2 With SandboxFileSpec removed from the import, this field in LocalProject is no longer typed and can be dropped as well.

Reviews (1): Last reviewed commit: "feat: remove sandbox_files / setup.sh fe..." | Re-trigger Greptile

- Remove leftover rawFiles/sandboxFiles read from inline-harness create
  path in session/route.ts (lines 697-699) — last missed site
- Fix inline files pass: spread sandboxFiles+inlineSkillFiles → just
  inlineSkillFiles (sandboxFiles was always empty after migration)
- Rename allFiles → skillFiles in finishBringUp for accuracy
- Remove dead SandboxFileSpec import and LocalProject.files field from
  new/page.tsx

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@krrish-berri-2
Copy link
Copy Markdown
Contributor Author

@greptile review

@krrish-berri-2 krrish-berri-2 merged commit 20199e6 into main May 26, 2026
4 checks passed
@krrish-berri-2 krrish-berri-2 deleted the worktree-remove-setup-sh branch May 26, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant