Skip to content

fix(agent): unrunnable pipeline.buildCommand kills the task pre-agent while a build timeout degrades gracefully #750

Open

Description

@srbhsrkr

Component

Agent (Python runtime)

Describe the bug

A pipeline.buildCommand whose executable does not exist in the agent container raises FileNotFoundError out of the pre-agent baseline build and kills the task before the agent ever runs. The surrounding code goes to considerable lengths to handle the analogous timeout case gracefully, so this looks like an oversight rather than a deliberate choice.

agent/src/repo.py:457-473:

try:
    result = run_cmd(build_argv, label="verify-build-pre", ..., timeout=BUILD_VERIFY_TIMEOUT_S, stream=True)
except subprocess.TimeoutExpired:
    log("WARN", f"Initial build ({build_cmd_str}) did not finish within ...  skipping baseline (not a regression)")

The comment above that block explains the reasoning for the timeout path at length — "a timeout means 'no usable baseline', NOT 'the agent broke it', so we treat it as no-known-regression and let the run proceed" — and notes that without the guard the task would "crash the whole task BEFORE the agent ever ran, so the issue got no PR and sat in Backlog — indistinguishable from a real failure."

A missing binary produces exactly that outcome, because only TimeoutExpired is caught.

Expected behavior

An unrunnable build command should be treated the same way as a timeout: log a warning, record "no usable baseline", and let the agent run. The misconfiguration should be surfaced on the PR (and ideally as an inert-gate note), not converted into a task failure.

Current behavior

The task dies during hydration with build_passed=null and no PR. Observed on task 01KZS2MS1BG7TDXHR7CDNMYM0A:

status        = FAILED
build_passed  = null
error_message = FileNotFoundError: [Errno 2] No such file or directory: 'pytest'

Total time to failure: ~20 seconds. The agent never started, so a single typo in a blueprint's buildCommand bricks every task against that repo until someone redeploys.

Reproduction steps

  1. Onboard a repo with a pipeline.buildCommand naming a binary not present in the agent image, e.g. buildCommand: 'pytest tests/unit/' (the agent container's PATH leads with /app/.venv/bin, built uv sync --frozen --no-dev per agent/Dockerfile:104, so there is no pytest).
  2. Submit any coding task against that repo.
  3. Task fails in ~20s at hydration with the FileNotFoundError above; no PR, no agent turns.

Possible solution

Catch FileNotFoundError (and likely PermissionError/NotADirectoryError) alongside subprocess.TimeoutExpired in both the pre-agent baseline (agent/src/repo.py:457) and the post-agent gate (agent/src/post_hooks.py:187), mapping them onto the existing inert-gate path rather than a task failure — an unrunnable command verified nothing, which is the definition of inert already handled elsewhere in pipeline.py:1435-1441.

Arguably a misconfigured blueprint should also surface a distinct, non-retryable error classification so the operator knows to fix the blueprint rather than retry.

Activity

  1. krokoko commented on Nov 20, 2026

    @krokoko
    Contributor

    Triage: what this issue asks for is on main; a small leftover is noted at the end.

    Fixed by #1052 (bf52b90). A build or lint command whose program cannot be started (not installed, not executable, or a path through a file) no longer raises: the pre-agent baseline records exit 127 and the agent runs (_run_baseline in agent/src/repo.py), and the post-agent gate reports a command that could not run (_run_verify in agent/src/post_hooks.py), which does not fail the task and shows as NOT RUN (command could not run) on a pull request the platform opens. Tests: TestBaselineCommandThatCannotStart (agent/tests/test_repo.py) and TestVerifyCommandThatCannotStart (agent/tests/test_post_hooks.py). Two points differ from the proposal: a configured command that cannot start is recorded as a failed baseline, like the same command behind a shell operator, not as a skipped one; and no separate error classification was added (the task no longer fails for this reason). Not covered and not tracked yet: a command that cannot be split into arguments (an unbalanced quote) still raises ValueError in resolve_verify_argv (agent/src/post_hooks.py) and ends the task before the agent starts.

    Posted from an automated sweep of the open issues. Each pull request, commit and file named above was checked against main at 3dbfada1. The issue is left open for a maintainer to close.

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

    v1Version 1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions