Skip to content

fix(sandbox): keep current sandbox, return building when not ready - #1709

Merged
dcramer merged 8 commits into
mainfrom
fix/workspace-snapshot-not-ready-tool-error
Aug 27, 2026
Merged

dcramer merged 8 commits into
mainfrom
fix/workspace-snapshot-not-ready-tool-error

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Two bugs:

  1. A Workspace change threw away the current sandbox id, so the next turn tried to start a new sandbox even when the old one was still fine.
  2. If that new start hit a sandbox that was still preparing, the turn died as an internal error.

What this does

  • reopen the current sandbox id first
  • only start a new sandbox when reopen fails
  • only switchWorkspace replaces the current sandbox on purpose
  • keep WorkspaceSnapshotNotReadyError as-is through setup
  • sandbox tools return status: "building" with a normal preparing message instead of failing the turn

No new failure-reason paths, Slack fallback handlers, or dashboard transcript changes. Those only covered an edge the main fix should avoid.

Evidence: event 14fd838305e84885ac23c21e95cc9726 / JUNIOR-8Z

Requested by David Cramer.

--

View Junior Session [Sentry]

When a Workspace snapshot is still building, sandbox setup was wrapped into
a fatal setup error and surfaced as an internal turn failure. Preserve the
typed not-ready signal and convert it to a ToolInputError at the sandbox
tool boundary so the agent can retry instead of aborting the turn.

Evidence: https://sentry.sentry.io/issues/7694468765/events/14fd838305e84885ac23c21e95cc9726/
Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 27, 2026 1:05am

Request Review

The first pass only softened tool failures. That still left turn-boundary
paths saying "internal error" when a Workspace snapshot was still building.

Use one plain message everywhere:
- keep the typed not-ready error through sandbox setup
- convert it to a recoverable tool error for sandbox tools
- use the same message for failed-turn replies, Slack fallbacks, and resume
- record workspace_snapshot_not_ready as the failure reason
- show the same plain copy in the dashboard transcript

Evidence: https://sentry.sentry.io/issues/7694468765/events/14fd838305e84885ac23c21e95cc9726/
Co-Authored-By: David Cramer <[email protected]>
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Dashboard visual evidence

Mode: path-selected
Selected: gallery-index, conversations, conversation-detail, conversation-detail-focused

Triggered by:

  • packages/junior-dashboard/src/client/conversations/ConversationTranscript.tsx
  • packages/junior-dashboard/src/client/conversations/TranscriptFailureView.tsx
  • packages/junior-dashboard/src/client/conversations/eventTranscript.ts
  • packages/junior-dashboard/src/client/conversations/transcriptFailure.ts
  • packages/junior-dashboard/src/client/conversations/transcriptRenderModel.ts
  • packages/junior-dashboard/src/client/conversations/transcriptSearch.tsx
  • packages/junior-dashboard/src/client/markdownExport.ts
  • packages/junior-dashboard/src/client/types.ts

Component gallery index · desktop

Component gallery index · desktop

Conversations · desktop

Conversations · desktop

Conversations · mobile

Conversations · mobile

Conversation detail · desktop

Conversation detail · desktop

Conversation detail · mobile

Conversation detail · mobile

Conversation detail · focused composer · mobile

Conversation detail · focused composer · mobile

Full-page screenshots from the mock dashboard. Not a pixel-diff gate.

@sentry-junior sentry-junior Bot changed the title fix(sandbox): treat not-ready workspace snapshots as recoverable fix(sandbox): explain not-ready workspaces instead of internal errors Aug 26, 2026
@dcramer
dcramer marked this pull request as ready for review August 26, 2026 23:46
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 26, 2026
Sandbox tools should report preparing state the same way switchWorkspace
does: a normal tool result with status building, not a thrown failure.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(sandbox): explain not-ready workspaces instead of internal errors fix(sandbox): return building status when workspace is not ready Aug 26, 2026
Plugin bash was treating the building tool result as a normal command and
dropping the preparing message. Host workspace helpers were also throwing
the raw not-ready error.

Map building status into plugin stderr, and throw a plain ToolInputError
from host helpers while keeping the typed not-ready cause.
A Workspace recipe change used to drop the conversation sandbox ref when
the profile hash no longer matched. That forced a new snapshot boot and
could strand work while a rebuild was still running.

Pin sandbox continuity to the existing sandbox id. Restore that VM first.
Only create a fresh sandbox when restore fails. switchWorkspace remains
the intentional cutover path.

Co-Authored-By: David Cramer <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c363a12. Configure here.

Drop jargon-heavy comments, use one preparing message helper, and update
the old profile-mismatch recreate test to expect restore-first behavior.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(sandbox): return building status when workspace is not ready fix(sandbox): keep the current sandbox until switch or restore fails Aug 27, 2026
Keep sticky restore-first acquire and building tool results. Remove the
failure-reason/slack/dashboard plumbing that only covered a residual path.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(sandbox): keep the current sandbox until switch or restore fails fix(sandbox): keep current sandbox, return building when snapshot not ready Aug 27, 2026
Replace leftover jargon in comments, helper docs, and test names.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(sandbox): keep current sandbox, return building when snapshot not ready fix(sandbox): keep current sandbox, return building when not ready Aug 27, 2026
@dcramer
dcramer merged commit 40139a6 into main Aug 27, 2026
38 checks passed
@dcramer
dcramer deleted the fix/workspace-snapshot-not-ready-tool-error branch August 27, 2026 01:13

This branch was successfully deployed

1 active deployment
Preview – junior-docs — da777e97 Deployed Aug 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant