Skip to content

bug(sandbox): an exec that exits during its 2 s output drain can still be reported as stalled #4722

Closed

Description

@yannickmonney

Summary

When an exec's command exits, runnerd waits up to EXIT_DRAIN_GRACE_MS (2 s) for its stdio to close before it emits the terminal event (services/sandbox-runtime/daemon/src/exec-manager.ts:1010-1017). record.finishing is only set once finish() runs (exec-manager.ts:876-879), and the stall watch only lets go of the exec later still (exec-manager.ts:1376). Verified on main at 73d03a9.

If a stall-watch round lands inside that grace for an exec that had been quiet for the window, endStalled sees finishing === false (exec-manager.ts:1174-1183), marks it stalled, signals the group, and the terminal event carries failure: 'EXEC_STALLED' (exec-manager.ts:910) — although the command ended by itself with its own exit code. A backgrounded grandchild that holds the pipe makes the full 2 s likely. The platform then records turn_stalled, with no retry, for a turn that finished.

Suggested fix

In endStalled, also stand down once rec.processState.leaderExited is set (or unwatch the exec in commandExit). Test: a command exits while a backgrounded child holds stdout open, a stall round is forced inside the grace, and the exec reports its own exit code without EXEC_STALLED.

Activity

  1. added
    agent-ready
    on Oct 29, 2026
  2. added a commit that references this issue on Oct 30, 2026
    d51a6e4
  3. added a commit that references this issue on Oct 31, 2026
    cc7abd6
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

    agent-readybugpriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions