Repository navigation
Description
Problem Description
devops ci fail-to-pass --base origin/main stops with a raw Python traceback when the pytest run on the base passes the limit of the process runner. _run_pytest_on_base (src/devops_cli/ci/fail_to_pass.py) calls run_subprocess(argv, cwd=tree_dir, capture_output=True) with the default limit of 1,800 s and does not catch subprocess.TimeoutExpired. The run of the base is also serial (-o addopts= removes -n logical), so 4 test modules of the implement job pass the limit on a busy host.
Reproduction Steps
- On a host with a load of about 50, change tests in
tests/roadmap/implement/test_roadmap_implement_job.py,tests/roadmap/implement/test_roadmap_implement_push_current.py,tests/core/test_roadmap_implement_checks.pyand add one test module. - Run
uv run devops ci fail-to-pass --base origin/main.
Expected vs Actual Behavior
Expected: a run of the base that passes its limit is a run that could not run. The command names the limit and the test files, and exits with its documented status, as for an interrupted pytest (#1669).
Actual: after 30 min 55 s the command prints a rich traceback that ends in TimeoutExpired: Command '[... '-m', 'pytest', '-o', 'addopts=', ...]' timed out after 1800.0 seconds.
Environment Diagnostics
devops-cli at origin/main cbdce63f (2026-11-12), Python 3.14.10, devcontainer, load average about 50.
Logs, Traces, or Terminal Output
TimeoutExpired: Command
'['<worktree>/.venv/bin/python', '-m', 'pytest', '-o', 'addopts=', '-p', 'no:cacheprovider',
'--continue-on-collection-errors', '--junitxml=/tmp/<tmp>/junit.xml',
'tests/core/test_roadmap_implement_checks.py', 'tests/git/test_branch_current_hook.py',
'tests/roadmap/implement/test_roadmap_implement_job.py',
'tests/roadmap/implement/test_roadmap_implement_push_current.py']' timed out after 1800.0 seconds
Elapsed: 30m 55s
Seen in the work on #4670 (PR #4879). Related: #4472 (a narrowed test run is serial).
Alternatives check of 2026-11-15: none.
Tool: none found.
Proposed design
Problem statement
The fail-to-pass command prints a raw Python traceback when the base pytest run exceeds the process-runner limit. The base run is serial, so a busy host can exceed 1,800 seconds. The command must catch the timeout, name the limit and the test files, and exit with its documented could-not-run status.
Acceptance criteria
Requirement: Base replay timeout is a could-not-run result
The fail-to-pass command SHALL treat a pytest replay that raises subprocess.TimeoutExpired as a replay that could not run.
Scenario: Base pytest timeout
- WHEN The base pytest replay raises subprocess.TimeoutExpired.
- THEN The command records a ReplayCouldNotRun result and prints no Python traceback.
Requirement: Timeout report names the limit and test files
The timeout report SHALL name the process-runner limit and each test file of the replay.
Scenario: Timeout report content
- WHEN A pytest replay times out after 1,800 seconds.
- THEN The report contains the 1,800 second limit and each test file path passed to pytest.
Requirement: Timeout uses the documented failure status
The command MUST exit with the same non-zero status that it uses for an interrupted pytest when a replay times out.
Scenario: Timeout exit status
- WHEN A pytest replay times out.
- THEN The command exits with the documented could-not-run status and not with an uncaught exception.
Requirement: Timeout does not report a false pytest status
The timeout result SHALL NOT report a pytest exit status that pytest did not return.
Scenario: Timeout message
- WHEN The command reports a timed-out replay.
- THEN The report names the timeout limit and does not print a pytest exit status line.
Requirement: Timeout handling covers each pytest replay
Each pytest replay in the fail-to-pass command SHALL use the same timeout handling.
Scenario: Head replay timeout
- WHEN The head replay or the plain-base replay raises subprocess.TimeoutExpired.
- THEN The command reports that replay as a replay that could not run and prints no traceback.
Existing Tool Considered
The alternatives check found no tool that covers the need. pytest-timeout (MIT, 2.4.0) only enforces a per-test timeout inside a pytest run. It does not catch the devops-cli run_subprocess timeout, name the 1,800 second limit and test files, or set the command's documented exit status. The in-repo change costs about 1,500 tokens to build, about 300 tokens to keep and fix, and about 1 hour elapsed.
Key questions
- Which call raises the timeout that the command does not catch?: The call to run_subprocess in _run_pytest_replay raises subprocess.TimeoutExpired. That function runs the base, plain-base and head pytest replays. [sources: src/devops_cli/ci/fail_to_pass.py]
- Where should the command catch the timeout?: Catch subprocess.TimeoutExpired in _run_pytest_replay and return a BaseReplayRun with could_not_run set. The existing report path then prints the could-not-run lines. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py]
- Chosen: Catch in _run_pytest_replay. It covers each pytest replay with one change and uses the existing could-not-run report.
- Rejected: Catch only in replay_on_base. It leaves the head and plain-base replays uncaught.
- Rejected: Let TimeoutExpired propagate. It prints the raw traceback that the issue reports.
- How should the timeout result carry the limit?: Add a timeout_seconds field to ReplayCouldNotRun and a new message. The report then names the limit without a false pytest exit status. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py, src/devops_cli/config/constants.py]
- Chosen: Add timeout_seconds to ReplayCouldNotRun. It keeps the limit with the result and separates timeout from a pytest exit status.
- Rejected: Reuse exit_status 124. It prints a pytest exit status that pytest did not return.
- Rejected: Put the message in output_tail. It mixes a structured reason with raw output.
- Which exit status should a timed-out replay use?: Use the existing documented non-zero status that an interrupted pytest uses. Do not add a new status. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py, src/devops_cli/config/constants.py]
- Chosen: Same status as interrupted pytest. The issue asks for the documented status of fix(ci): a test that hangs fails at a per-test timeout, so devops ci never stalls on a stuck child process #1669 and keeps one failure contract.
- Rejected: New timeout status. It adds a second contract that callers do not expect.
- Rejected: Exit 0. A timeout proves nothing about the fix.
- Should the timeout limit be configurable?: No. Use the 1,800 second process-runner limit and pass it explicitly to run_subprocess so the report can name it. (best practice) [sources: src/devops_cli/core/process.py, src/devops_cli/config/constants.py]
- Chosen: Use the existing 1,800 second limit. The issue asks to name the existing limit and no caller asks for another value.
- Rejected: Add a CLI option. It expands the command surface with no requirement.
- Rejected: Read an environment variable. It hides the limit from the report and adds configuration.
- Should the change make the base run parallel?: No. The issue asks for timeout handling. The serial base run is separate work. (best practice) [sources: src/devops_cli/ci/fail_to_pass.py]
- Chosen: Handle the timeout. It matches the issue's expected behavior.
- Rejected: Add xdist to the base run. It changes the test run and does not fix the traceback.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(ci)scope of the title gives the scope.The command crashes with an unhandled traceback instead of a clean error, but the timeout itself still occurs; it is a usability defect, not a data-loss or security issue.Users see a 30-minute traceback instead of a one-line status, which is confusing but does not block the timeout from firing.Catch 'subprocess.TimeoutExpired' in one function and print the documented status message; the pattern already exists for interrupted pytest (#1669).Both fix an unhandled 'TimeoutExpired' traceback in a devops-cli command, but in different commands ('ci fail-to-pass' vs 'test run') and different source files.devops-cli-service commentedon Nov 12, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The bug gives a bad error message in an internal command and does not corrupt data or block a release.A clear timeout message and exit status help developers understand and retry a failed base run.The fix catches 'subprocess.TimeoutExpired' in one function and prints the limit and the test files.Both stop a raw traceback when pytest passes the subprocess limit, but they change different commands and different handler code.devops-cli-service commentedon Nov 15, 2026
Alternatives check: none
Reason: The searches found no tool that covers the need: the only relevant hit, the pytest-timeout plugin (MIT, 2.4.0), only enforces a per-test timeout inside a pytest run, while the issue asks devops-cli itself to catch
subprocess.TimeoutExpiredfromrun_subprocess, name the 1,800 s limit and the test files, and exit with its documented status. That is a small in-repo error-handling change to_run_pytest_on_base, which no library provides.Tool: none found
Lacks:
_run_pytest_on_baseTools considered:
Searches run:
Sources:
Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 16, 2026
Status set to Ready at fccb781 (see proposed design in issue body).
devops-cli-service commentedon Nov 18, 2026
Released in v0.174.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.174.2
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 01:44 UTC