feat: add sandbox diagnostics tool (#45) - #46
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
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
Changed files
agent/tools/sandbox_diagnostics.ts— new reusable diagnostics tool (219 lines)Implementation
New
defineToolfollowing the existing tool pattern inagent/tools/. The tool:nprocandfree -mthrough the sandbox, reports vCPUs and memorynpm run typecheck,npm run build,npm testwith per-step timingsleep 5background process using the samesetsidmechanism asstart_background, then polls for completion — confirms detached processes survive across sandbox command boundariesAll three steps are optional:
skipBackgroundTestcan skip the slowest check.Verification evidence
All diagnostics were run against the actual sandbox during implementation:
npm cinpm run typechecknpm run buildnpm test(61 tests)start_background(sleep 90)TypeScript compilation:
tsc --noEmitpasses clean (0 errors).Risks
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. TheskipBackgroundTest: trueoption provides a fast path (~10-15s).Unresolved
None.