Skip to content

bug(core): process backend drops signal-only exits and reports code undefined #54

Description

@khaliqgant

Problem

The process-backend adapter assumes every command returns a numeric exit code. A backend or provider reporting a signal-only termination with exitCode undefined and exitSignal SIGTERM reaches executeAgentStep as a nonzero result, but the thrown diagnostic is:

Agent step "signal-worker" exited with code undefined

The signal is discarded. This differs from the local process path, whose result/evidence contracts retain both optional exitCode and exitSignal and explicitly treat a signal-only exit as failure.

Root seam

  • ProcessEnvironment.exec and SandboxExecResult require only numeric exitCode.
  • createSandboxProcessBackend copies only output and exitCode.
  • createProcessBackendExecutor compares result.exitCode to zero and formats only that field.

A structurally compatible injected backend can still return the real process shape at runtime, so TypeScript does not protect the diagnostic path from undefined. Provider adapters also have no lossless way to report a signal.

Minimal reproduction

Use createProcessBackendExecutor with a stub ProcessBackend whose environment exec resolves, via an external/runtime-shaped value, to:

{ output: "terminated", exitCode: undefined, exitSignal: "SIGTERM" }

Execute an agent step. Current result rejects with code undefined and contains no SIGTERM.

This was reproduced independently while fixing the unrelated supervised-worker release race at origin/main SHA 9df7c5d on 2026-09-05.

Expected contract

  • ProcessEnvironment.exec and SandboxExecResult preserve optional exitCode plus optional exitSignal, or the adapter explicitly normalizes signal termination to a documented nonzero code while retaining the signal.
  • agent and deterministic step results/evidence report the signal and never render code undefined.
  • signal-only termination is always failure unless a narrowly documented terminal-success rule says otherwise.
  • local-process, Daytona, and injected runtime adapters share the same semantics.

Acceptance

  1. Add agent and deterministic process-backend regression tests for SIGTERM with no numeric code.
  2. Preserve the signal through sandbox-backend and runner evidence.
  3. Error text names SIGTERM and never says code undefined.
  4. Existing numeric exit-code and terminal-success behavior remains green.
  5. Prove the packed candidate in a clean sandbox with an actual signal-only command.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions