Follow-up from #1881 review (async-v1 sandbox preparation).
Problem
packages/cli/src/cli/commands/fleet.ts:772 mints sbx_${randomUUID()} for every unpinned/agent37 fleet spawn --sandbox and persists nothing. If the CLI process is killed while polling Cloud preparation, a plain re-run creates a second sandbox; the first is only reclaimed by Cloud's 30-minute preparation deadline + reaper (cloud#4137).
fleet.ts:826 calls deps.ensureCloudFleetSandbox(ensureInput, { onPreparationProgress }) with no signal, so Ctrl-C does not abort cleanly or reconcile/clean the exact identity.
Mitigation already in #1881
The CLI prints Cloud sandbox identity: sbx_… If this command is interrupted, re-run it with --sandbox-id sbx_… before any Cloud work; re-running with that --sandbox-id resumes the same durable preparation (ensure is idempotent on the exact identity + request).
Proposed
- Persist the in-flight
{sandboxId, cloudWorkspaceId, request fingerprint} next to the persisted workspace route (state dir) before the first ensure; on the next identical spawn, reconcile it (GET status) instead of minting a new id; clear on ready/terminal.
- Wire a SIGINT/SIGTERM
AbortController into ensureCloudFleetSandbox; on abort after Cloud accepted the record, print the resume command (and optionally DELETE by exact identity when the user confirms abandonment).
Acceptance: killing the CLI mid-poll and re-running the same command yields one sandbox; Ctrl-C prints the exact resume/cleanup identity.
Follow-up from #1881 review (async-v1 sandbox preparation).
Problem
packages/cli/src/cli/commands/fleet.ts:772mintssbx_${randomUUID()}for every unpinned/agent37fleet spawn --sandboxand persists nothing. If the CLI process is killed while polling Cloud preparation, a plain re-run creates a second sandbox; the first is only reclaimed by Cloud's 30-minute preparation deadline + reaper (cloud#4137).fleet.ts:826callsdeps.ensureCloudFleetSandbox(ensureInput, { onPreparationProgress })with nosignal, so Ctrl-C does not abort cleanly or reconcile/clean the exact identity.Mitigation already in #1881
The CLI prints
Cloud sandbox identity: sbx_… If this command is interrupted, re-run it with --sandbox-id sbx_…before any Cloud work; re-running with that--sandbox-idresumes the same durable preparation (ensure is idempotent on the exact identity + request).Proposed
{sandboxId, cloudWorkspaceId, request fingerprint}next to the persisted workspace route (state dir) before the first ensure; on the next identical spawn, reconcile it (GET status) instead of minting a new id; clear on ready/terminal.AbortControllerintoensureCloudFleetSandbox; on abort after Cloud accepted the record, print the resume command (and optionally DELETE by exact identity when the user confirms abandonment).Acceptance: killing the CLI mid-poll and re-running the same command yields one sandbox; Ctrl-C prints the exact resume/cleanup identity.