feat: add metadata_only param to GET /api/sandboxes

Merge conflicts
SW
8mo ago
+353-59

Summary

  • Adds metadata_only=true query parameter to GET /api/sandboxes that skips expensive Sandbox.get() API calls to Vercel
  • When metadata_only=true, returns only snapshot_id, github_repo, and filetree (empty sandboxes array)
  • Prevents 100+ parallel Vercel API calls that cause 410 errors in the setup-sandbox task

Root Cause

The Tasks repo's getAccountSandboxes() only needs snapshot_id and github_repo, but the GET endpoint was making Sandbox.get() for every sandbox record (100+). This caused the newly created sandbox to become unavailable (HTTP 410) by the time setupSandboxTask tried to use it.

Test plan

  • Added failing test (TDD RED): getSandboxStatus should NOT be called when metadataOnly is true
  • Implemented fix (TDD GREEN): all 103 sandbox tests pass
  • Deploy and verify setup-sandbox task no longer fails with 410

šŸ¤– Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added metadata_only parameter for sandbox retrieval to optimize requests by returning only metadata without live status checks.
  • Bug Fixes

    • Improved sandbox creation resilience with automatic fallback when snapshot-based creation encounters errors.
  • Documentation

    • Updated organizations API documentation with clearer authentication requirements and refined parameter specifications.