fix: persist Daytona authentication failures - #519
Conversation
🦋 Changeset detectedLatest commit: f056581 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0b05405. Configure here.
290e8b8 to
a1379ae
Compare
|
Rebased onto the latest |
a1379ae to
f056581
Compare
|
Rebased onto current Post-rebase validation:
The SQLite sandbox-provider contract could not execute on this host because the |

Summary
Persist Daytona 401/403 failures as a failed sandbox-provider status instead of returning an internal settings error or losing the typed error when sandbox execution converts it to a failed result.
Closes #516
Changes
status_reasonvaluestrueforgeandtrueforge-coreHow was this tested?
pnpm --filter @truefoundry/trueforge-core test -- --runInBand tests/core/sandbox/daytonaSnapshotRegistration.test.tspnpm --filter @truefoundry/trueforge test -- --runInBand tests/unit/sandbox/providerUtils.test.tspnpm --filter @truefoundry/trueforge test:store:sqlite -- --runInBand tests/db/sqlite/sandbox-provider-store/contract.test.tspnpm --filter @truefoundry/trueforge-core typecheckpnpm --filter @truefoundry/trueforge typecheckpnpm exec eslint packages/trueforge-core/src/core/sandbox/provider/DaytonaProvider.ts packages/trueforge/src/runtime/sessionResources.ts packages/trueforge/src/sandbox/providerUtils.tsgit diff --checkValidation is intentionally scoped to the two changed packages and the Daytona failure paths; full workspace build/test and live Daytona credential revocation were not run locally. The callback is optional and database write failures are logged without replacing the original provider result. The SQLite store contract was run locally; the equivalent Postgres contract was not run because no local Postgres service was started.
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changed (not applicable: no configuration or documented API change)Note
Medium Risk
Changes runtime sandbox error handling and persisted tenant sandbox-provider status with optimistic manifest checks; credentials are not modified but failed-state writes affect how misconfiguration is shown and recovered.
Overview
When Daytona returns 401 or 403 (including wrapped
Error.causechains), the app now writes the tenant’s sandbox provider tofailedwith stablestatus_reasontext instead of surfacing opaque settings errors or losing the signal whenexecturns errors into{ success: false }.DaytonaSandboxProvidergains an optionalonErrorhook invoked fromcreateSandboxand non–SandboxNotAvailableexecfailures;resolveSandboxProviderwires it torecordDaytonaAccessFailure.checkSnapshotStatususes the same helper when snapshot refresh calls fail with auth/permission errors.Status updates can pass
expected_manifestsoupdateSandboxStatusonly applies when the stored manifest still matches—avoiding stale failure writes after credentials or settings change. Snapshot refresh and failure recording both use that guard.Reviewed by Cursor Bugbot for commit f056581. Bugbot is set up for automated code reviews on this repo. Configure here.