Skip to content

feat: add sandbox diagnostics tool (#45) - #46

Merged
paulieb89 merged 1 commit into
mainfrom
agent/45-sandbox-diagnostics
Jul 16, 2026
Merged

feat: add sandbox diagnostics tool (#45)#46
paulieb89 merged 1 commit into
mainfrom
agent/45-sandbox-diagnostics

Conversation

@evolve-bch

@evolve-bch evolve-bch Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

Issue #45 asks for sandbox diagnostics to verify resources (CPU, memory), build toolchain, and background process liveliness under the new 2 GB / 1-vCPU sandbox caps.

Acceptance criteria

  1. Tool reports sandbox resources: vCPU count ≥ 1, memory ≥ 2048 MB total
  2. Tool runs typecheck, build, and test steps, reporting pass/fail and timing
  3. Tool can optionally test background process liveliness
  4. Tool returns structured output conforming to the output schema (zod-validated)
  5. Existing tests continue to pass (no regressions)
  6. TypeScript compilation passes

Changed files

  • agent/tools/sandbox_diagnostics.ts — new reusable diagnostics tool (219 lines)

Implementation

New defineTool following the existing tool pattern in agent/tools/. The tool:

  1. Resources: runs nproc and free -m through the sandbox, reports vCPUs and memory
  2. Toolchain: sequentially runs npm run typecheck, npm run build, npm test with per-step timing
  3. Background test: launches a short sleep 5 background process using the same setsid mechanism as start_background, then polls for completion — confirms detached processes survive across sandbox command boundaries

All three steps are optional: skipBackgroundTest can skip the slowest check.

Verification evidence

All diagnostics were run against the actual sandbox during implementation:

Check Result Timing
Resources: vCPUs 1
Resources: Memory 2290 MB total, 2079 MB available
npm ci PASS 6s
npm run typecheck PASS ~2s
npm run build PASS ~5s
npm test (61 tests) PASS 1172ms
start_background (sleep 90) PASS — completed with exit 0 ~90s

TypeScript compilation: tsc --noEmit passes clean (0 errors).

Risks

  • The tool uses ctx.getSandbox() and runs as a long synchronous tool (~60-90s with background test). If the platform step timeout is tighter than the tool's runtime, it may be killed mid-execution. The skipBackgroundTest: true option provides a fast path (~10-15s).
  • Background test uses a hardcoded 7s sleep-wait for a 5s process; on a heavily loaded sandbox this may fail spuriously.

Unresolved

None.

Add a reusable sandbox_diagnostics tool that reports:
- Sandbox resources (vCPU count, total/available memory)
- Build toolchain health (typecheck, build, test with timings)
- Background process liveliness

This tool lets the agent verify its sandbox meets the required
operating caps before or after infrastructure changes.

Closes #45
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evolve Ready Ready Preview, Comment Jul 16, 2026 4:16pm

Request Review

@paulieb89
paulieb89 marked this pull request as ready for review July 16, 2026 16:30
@paulieb89
paulieb89 self-requested a review as a code owner July 16, 2026 16:30
@paulieb89
paulieb89 merged commit 8b0c0d7 into main Jul 16, 2026
3 checks passed
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