Skip to content

Daytona persistent resumes do not refresh SCM auth #680

Description

@ColeMurray

Summary

Daytona sandboxes use persistent resume/recover rather than Modal-style snapshot restore. On resume, we call Daytona startSandbox / recoverSandbox against the existing sandbox, so the sandbox keeps its previous filesystem, environment variables, git remotes, and runtime bootstrap state.

That means SCM auth is not refreshed on Daytona resume/recover.

Why this matters

Create-time SCM auth can expire while a Daytona sandbox is stopped, idle, or running for longer than the token TTL. Because resume/recover does not rebuild the environment or rewrite credentialed git remotes, later git operations can fail with stale credentials.

Modal snapshot restore is different: restore mints a fresh token and the restored entrypoint rewrites origin before fetching. This issue is specific to Daytona persistent resume/recover behavior.

Current behavior

  • Fresh Daytona sandbox creation receives SCM auth setup.
  • Daytona resume/recover only restarts or recovers the existing sandbox.
  • No new clone token is resolved during resume.
  • Existing env vars and credentialed remotes are preserved.

Expected behavior

On Daytona resume/recover, we should ensure SCM auth state is current before the agent performs git operations.

Possible fixes:

  • Force a fresh Daytona sandbox when the previous create-time SCM auth may be expired.
  • Add a resume-time auth refresh step that updates the sandbox's git auth state before git operations run.
  • Track auth freshness/expiry in control-plane state and choose resume vs fresh spawn accordingly.
  • Avoid relying on persisted env tokens/remotes for resumed Daytona sandboxes.

Impact

Users with Daytona persistent sandboxes can hit git auth failures after token expiry, especially after idle/resume or sandboxes running longer than the token TTL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions