Skip to content

fix(adapters): gcp-sandboxes forks keep the owner, no unmovable TTL, request faults spare the pool - #135

Merged
reachjalil merged 1 commit into
pre-releasefrom
fix/gcp-sandboxes-review
Nov 21, 2026
Merged

reachjalil merged 1 commit into
pre-releasefrom
fix/gcp-sandboxes-review

Conversation

@reachjalil

Copy link
Copy Markdown
Member

An independent review of the experimental gcp-sandboxes adapter (Agent Platform sandboxes) found three problems that would bite on first real use. Each claim was checked against Google's REST reference and the scheduler's code before fixing.

Fixes

  • Forks were refused. Google's reference says "A Sandbox can only be restored from a snapshot that belongs to the same owner. If not set, sandbox will be created as the default owner." Sandboxes are created with owner set to the installation, but :snapshot sent no owner. A snapshot now takes its source's owner.

  • A TTL extension lost the sandbox. Sandboxes have no update method, so a ttl set at create can never move. The adapter isn't an Expirer, and the server leaves such backends alone on a TTL change, so Google deleted the sandbox at the original deadline while Differently still counted it alive. A sandbox without a TTL was deleted after the adapter's own 7-day default; Google's docs say a sandbox without ttl is never deleted automatically. The adapter now sets no Google TTL. Differently's audited expiry deletes the sandbox, and the reconciler deletes orphans. The trade-off: no provider-side backstop if the control plane is gone for good. This is documented.

  • One sandbox's failure marked the pool unhealthy. scheduler.retry marks a pool unhealthy for anything except capacity, sandbox_failed and invalid_request. On create, two cases now fail just that sandbox:

    • A request's template that Google doesn't have or refuses (404/403), and a snapshot that's gone, expired (Google keeps snapshots 30 days) or owned by someone else. These are now invalid_request.
    • A create or start that outlasts its wait. The provision timeout defaults to 120 s, shorter than the adapter's 3-minute wait. This is now sandbox_failed.

    The pool's own template missing still counts against the pool.

Tests

  • The fake now enforces snapshot ownership, as Google documents it, and refuses unknown templates and snapshots.
  • New tests cover owner propagation, the request faults, a create that never finishes, and the scheduler's deadline passing.
  • Each fix was removed once to confirm its test fails.
  • make verify passes.

Not run: nothing here has run against Google Cloud. TestLiveGCPSandboxes (#132) is still unrun.

The review's lower-priority items are left for later: large ReadFile responses through :execute, the STATE_STOPPING mapping, holding the token lock during a fetch, and more credential types.

🤖 Generated with Claude Code

…request faults spare the pool

- A snapshot takes its source sandbox's owner. Google restores only from a
  snapshot of the same owner, and forks are created with the installation
  as owner, so forks from Google-default-owner snapshots were refused.
- No Google ttl on sandboxes. It can never move (no update method), so
  extending a sandbox's TTL left Google to delete it at the original
  deadline, and a sandbox without a TTL was deleted after 7 days.
- On create, a request's template that Google does not have or refuses,
  and a snapshot that is gone, expired or of another owner, are
  invalid_request; a create or start that outlasts its wait is
  sandbox_failed. Both marked the shared pool unhealthy before.

The fake now enforces snapshot ownership and refuses unknown templates and
snapshots. Tested against the fake server only; nothing ran on Google Cloud.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jalil <reachjalil@gmail.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI passed at 38761a0.

@reachjalil
reachjalil merged commit 7a1707d into pre-release Nov 21, 2026
36 of 37 checks passed
@reachjalil
reachjalil deleted the fix/gcp-sandboxes-review branch November 21, 2026 00:26
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