Skip to content

Daytona snapshot registration has no request timeout — GET /capabilities, GET settings, and turn creation can hang ~5 min when Daytona stalls #417

Closed

Description

@aniruddhaadak80

What happened?

DaytonaSandboxProvider.registerSnapshot() issues a raw fetch to the Daytona API with no AbortSignal / timeout:

// packages/trueforge-core/src/core/sandbox/provider/DaytonaProvider.ts (main @ 506bf5c, registerSnapshot)
response = await fetch(`${this.apiUrl}/snapshots`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: this.buildRef, imageName: this.imageUri }),
});

That call is reached from buildImage(), which runs — without any timeout wrapper — inside three request-facing paths via checkSnapshotStatus:

  1. GET /api/v1/capabilities (packages/trueforge/src/apis/capabilities.ts:35) — this is the UI's boot/capability probe, hit on app load.
  2. GET /api/v1/settings/sandbox-providers (packages/trueforge/src/apis/sandboxProviders.ts:41) — the settings page.
  3. Turn creation when a fresh sandbox is needed (packages/trueforge/src/apis/turns.ts:200, sandboxProvider: async ({...}) => {... checkSnapshotStatus ...}).

The only caller that bounds the round-trip is PUT /settings/sandbox-providers, which wraps it in withTimeout(provider.buildImage(), BUILD_REQUEST_TIMEOUT_MS /* 3s */) (sandboxProviders.ts:18,84). The three paths above have no such cap, so a Daytona endpoint that accepts the connection but stalls the response hangs these requests for up to undici's default ~5-minute header/body timeouts — per request. During that window:

  • The UI capability probe and settings page hang with no feedback.
  • New turns that need a sandbox stall before execution starts.
  • Each hung request keeps a server connection + event-loop task alive; a Daytona brownout turns into piled-up concurrent requests.

Related side effect worth noting while here: checkSnapshotStatus is invoked from GET handlers and can mutate persisted status (and re-activate an idle snapshot via snapshot.activate), so plain reads trigger external writes — retrying clients amplify the external call volume.

Steps to reproduce

  1. Configure a Daytona sandbox provider.
  2. Simulate a stalled Daytona API for POST {apiUrl}/snapshots (e.g. point apiUrl at a TCP sink that accepts but never responds, or add an artificial delay).
  3. GET /api/v1/capabilities or GET /api/v1/settings/sandbox-providers (with a snapshot in a non-ready/non-fresh state so buildImage is reached) — the request hangs ~5 minutes instead of failing fast.

Expected behavior

Every outbound Daytona call should carry an explicit timeout (the codebase already has both primitives: AbortSignal.timeout as used by mcpOAuthFetch, and withTimeout as used by the PUT handler), and status refreshes reachable from GET/request-hot paths should reuse the same bounded budget as the PUT path.

How are you running TrueForge?

Docker Compose

Version

main @ 506bf5c

Relevant logs or screenshots

No error is logged during the hang; requests simply do not complete until undici's default timeouts fire.

Environment

OS: any
Node.js version: 22.14+

Activity

  1. added
    help wanted
    on Aug 25, 2026
  2. thesujai commented on Aug 25, 2026

    @thesujai
    Contributor

    @aniruddhaadak80 thanks for reporting this

    Can make the timeout 1 min for this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions