Skip to content

Runtime parity for Sprites/Fly Machines: extensions, workflow markers, timeouts, pool robustness #3794

Done

Description

@integry

An independent code review of the merged Sprites runtime (#3791) found Docker-executor behaviour that non-Docker runtimes skip or get wrong. I confirmed items 1–3 and 6 in the code; the others are plausible and need checking. The Fly Machines runtime (#3784, still open) has the same gaps for 1 and 2.

Fix at the source: shared run pipeline, not per-runtime copies

dockerExecutor.ts does extensions, workflow markers, the cost cap, the watchdog, diagnostics and redaction inline. Sprites re-implements some of these and leaves out others. Move the runtime-agnostic steps into a shared layer that wraps every AgentRuntime handle, and use it from SpritesRuntime. Make FlyMachinesRuntime use it when it lands; if #3784 merges first, wire it in here.

Findings

  1. 🔴 Extensions are silently ignored on Sprites and Fly Machines (spritesExecution.ts). The extension mounts, gateway and beforeLaunch from extensionLaunchForDockerRun are never applied, and the output redactor covers only the Sprites org token, not currentExtensionLaunch().secrets. Admission (agentRunTrigger.ts:301/316) checks only the agent type. Required: support extensions through the shared layer, or refuse in admission with a clear message (a runtime capability flag such as supportsExtensions). Never run silently without them, and always redact extension secrets.
  2. 🔴 Workflow hook and validation markers are never captured. captureWorkflowMarkers is fed only by dockerExecutor, so a failing before_run/after_create hook no longer fails a Sprites run and every validation shows as unobserved. Feed the runtime handle's stderr through the shared marker capture.
  3. 🔴 Provisioning counts against the agent timeout (spritesRuntime.ts:49, where AbortSignal.timeout starts in start()). On a cold worker with a short-timeout run, provisioning (up to 20 min) times out, the Sprite is deleted, and the next run is cold again, so the pool never warms. Start the agent timeout at launch, and give provisioning its own bound. Provisioning that already started should complete into the pool even if this run was cancelled.
  4. 🟠 SpritePool.release can hang. restoreCheckpoint has no timeout, and a failed restore provisions a replacement inside release() with no abort signal. Add timeouts, and do the replacement in the background so the job's cleanup is not blocked and close() can cancel it.
  5. 🟠 close() and the cached pool promise. One rejected pool promise (for example a failed @fly/sprites import) makes close() reject, which skips the remaining shutdown in src/worker.ts, and the rejected promise stays cached so every later run fails. Use Promise.allSettled, and drop rejected pools from the cache.
  6. 🟠 Node engine mismatch. @fly/sprites declares engines.node >=24, but every worker image is node:22-*. It works today (verified live on Node 22), but document the support status: either pin the SDK version that is known to work on 22 and add a CI smoke test on 22, or move the worker to Node 24.
  7. 🟡 release() runs the credential export when the launcher never started (cost-cap refusal or a failure before launch). It then fails on the missing agent.json and logs a spurious release error. Skip the export when nothing was launched.
  8. 🟡 Any WebSocket drop fails a long run while the agent keeps running on the Sprite (reattach: false). At minimum, retry or reattach to the detachable session once before failing.
  9. 🟡 Validate before acquiring. Build and validate the upload payload (clone shape, binds, env files, seed, token scan) before pool.acquire(), so invalid runs fail without provisioning or restoring a Sprite.
  10. 🟡 Startup work on every launch. spritesCliVersionRefusal re-reads Dockerfile.agent synchronously on every launch; cache the pins. runtimeSelection.ts duplicates resolveAgentRuntimeKind; reuse the registry constants.

Acceptance

  • Unit tests for each item, where possible through the fake Sprite in test/.
  • An extension run on Sprites is either supported end to end or refused at admission.
  • A workflow hook failure fails a Sprites run.
  • A maintainer reruns test/spritesRuntime.live.test.ts before merge.

Activity

  1. propr-dev commented on Nov 24, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-6.2-astra model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: codex
    • Model: gpt-6.2-astra
    • Branch: 3794/gpt-6.2-astra-runtime-parity-for-sprite-20261124-2136-9kp
    • Base Branch: 3758-epic-runtime-abstraction-sc0
    • Worktree: issue-3794-20261124-2136-gpt-6.2-astra-9kp

    🔍 Track Task Execution

  2. integry commented on Nov 25, 2026

    @integry
    OwnerAuthor

    Merged in #3796.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions