AGE-1831: enhance DaytonaSandboxProvider with build failure handling - #258
Open
thesujai wants to merge 2 commits into
Open
AGE-1831: enhance DaytonaSandboxProvider with build failure handling#258thesujai wants to merge 2 commits into
thesujai wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f49c37a. Configure here.
| return next; | ||
| // GET is a reader: it only persists terminal states (ready/failed) observed from Daytona. | ||
| // `pending` is transient and re-derived on every read, so never write it back. | ||
| if (next.status === 'pending') { |
Contributor
There was a problem hiding this comment.
we should still persist. We can use db to serve in scenarios where Daytona endpoint becomes unavailable. Lets keep DB updated
| logger: deps.logger, | ||
| ...(locked ? { build_metadata: locked.build_metadata } : {}), | ||
| }); | ||
| // Awaits register-only POST (~1s). Auth failures throw here → 422 below; progress is on GET. |
| return this.toBuild(registered.state, registered.errorReason); | ||
| } catch (error) { | ||
| // A losing concurrent create is not a build failure: the winner owns the deterministic name. | ||
| if (error instanceof DaytonaError && error.statusCode === SNAPSHOT_CONFLICT_STATUS) { |
Contributor
There was a problem hiding this comment.
Also update get Status to catch 404?
Are we using SDK in get? or API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
On build failure we will do a callback to fail in db
Changes
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/sdk,.github/fern/openapi/openapi.json).env.exampleupdated if configuration or behavior changedNote
Medium Risk
Changes sandbox provider configure/read paths and DB status persistence for Daytona builds; failures could affect tenant sandbox readiness but scope is limited to Daytona snapshot lifecycle.
Overview
Daytona sandbox image builds no longer block on the SDK’s
snapshot.create, which polls until the snapshot is active or failed.buildImagenow POSTs to Daytona’s/snapshotsendpoint (register-only), maps the immediate response topending/ready/failed, and treats 409 as “another replica started the build” instead of an error.Configure (PUT) awaits that register call (still capped at ~3s), so auth failures surface on save while long image pulls stay observable via GET status checks.
GET status refresh only persists terminal
readyorfailedto the DB; transientpendingis returned on the wire but not written back, avoiding stale pending rows.Provider construction now passes
apiKeyand optionalapiUrlfor the direct HTTP register path. Unit tests cover register POST shape, conflict handling, and forbidden responses.Reviewed by Cursor Bugbot for commit 1cc7ffe. Bugbot is set up for automated code reviews on this repo. Configure here.