Skip to content

Give a resumed sandbox its Daytona API key back - #260

Merged
arseniycodes merged 1 commit into
mainfrom
ash/restore-daytona-key-on-resume
Oct 7, 2026
Merged

arseniycodes merged 1 commit into
mainfrom
ash/restore-daytona-key-on-resume

Conversation

@arseniycodes

@arseniycodes arseniycodes commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Why

Pull request review turns can't push fixes when they resume a paused sandbox. Checking out the pull request fails with Daytona API key is unavailable for file upload, and update_pull_request then refuses to push.

This is the case for every review turn that resumes: tag mode threads and automation runs. In production, 5 review turns on customer pull requests hit it since #257 shipped (stacksyncdata workflows-frontend#1737, connectors#2076, event-forward#85). A test with Codex reviewing superloglabs/otel-helpers#1 failed the same way.

Cause

When a sandbox pauses, its saved state drops apiKey so the key isn't stored in the database. On resume, DaytonaSandboxClient.resume uses the client's key to reach Daytona, but the session's state keeps apiKey empty. uploadRepositoryArchive and downloadRepositoryFile read the key from session.state, so they throw.

Change

  • resumeDaytonaSandbox in sandbox.ts deserializes the saved state and resumes it with apiKey set from the worker's Daytona configuration.
  • Tag mode (investigate.ts) and automation runs (automation-sandbox.ts) resume through it.
  • The key is still left out of the saved state.

Validation

  • New test for resumeDaytonaSandbox. The automation sandbox resume test now checks the key is passed.
  • pnpm typecheck, pnpm lint (no new warnings), pnpm test (2053 passed).

Summary by cubic

Fixes resumed sandboxes in review turns losing their Daytona API key, which broke pull request file transfers and prevented pushing fixes.

On pause, the saved state drops apiKey. On resume, resumeDaytonaSandbox restores it from the worker's Daytona configuration; tag mode (investigate.ts) and automation runs (automation-sandbox.ts) both resume through it. The key still never lands in saved state.

  • resumeDaytonaSandbox deserializes the saved state and resumes with the worker's daytonaApiKey.
  • Added a test for the resume path and updated the automation sandbox resume test to assert the key is passed.

Written for commit 1dbf01f. Summary will update on new commits.

View guided diff Turn on auto-fix

A paused sandbox's saved state leaves out the API key. Resuming it did
not put the key back, so repository archive uploads and file downloads
in the resumed session failed with "Daytona API key is unavailable".
That broke every pull request review turn that resumed a sandbox: the
checkout of the pull request failed, so the agent could not push its fix.

Both runtimes now resume through resumeDaytonaSandbox, which sets the
key from the worker's configuration.
@arseniycodes

Copy link
Copy Markdown
Contributor Author

Gitlink bump: superloglabs/responder#391

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 5 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@arseniycodes
arseniycodes merged commit 6460645 into main Oct 7, 2026
5 checks passed
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