Repository navigation
Description
Problem Description
The runner agent in devops-cli-runner sleeps in a polling loop when test commands run for many minutes.
Test execution commands in ci test run pytest with -n 0 by default.
Evaluation and replay test suites take more than 30 minutes in single-process mode and time out.
Because background commands do not push notifications to the runner agent, the agent executes shell sleep commands in a loop.
This behavior consumes tens of thousands of tokens and keeps runner pods alive for more than 75 minutes.
Shell sleep commands violate the repository rules.
Slow test suites violate the 5-minute build and check limit.
Reproduction Steps
- Inspect pod logs of a runner Job executing an evaluation test or replay test.
- Observe repeated tool calls executing
uv run python -c "__import__('time').sleep(...)". - Observe test execution exceeding timeouts.
Expected vs Actual Behavior
Expected: Test suites run with xdist concurrency and finish within 5 minutes. The runner harness notifies the agent when commands finish.
Actual: Single-process test execution times out, and the agent polls with shell sleep commands.
Environment Diagnostics
- DevOps CLI Version: 0.83.2
- Python Version: 3.14.10
- OS & Architecture: Linux x86_64
- Execution Environment: devops-cli-runner Job / Kubernetes
Logs, Traces, or Terminal Output
Tool call: shell, started: uv run devops ci test tests/roadmap/stage/test_roadmap_stage_eval_gates.py ...
Tool call: shell, started: uv run python -c __import__('time').sleep(240)
Tool call: shell, started: uv run python -c __import__('time').sleep(240)
Tool call: shell, started: tail -5 .../output.log
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
A narrowed devops ci test of the eval gate module runs serially, and that module recomputes the whole golden-set replay in six tests over 69 cases, so the run exceeds the 5-minute budget of AGENTS.md rule 5. While it runs, the implement agent waits by running shell sleep commands and tailing a log, which spends tokens and keeps the runner pod alive. The fix computes the replay once per module, gives each case its own pytest item so pytest-xdist can distribute the cases, keeps the documented worker choice of devops ci test, and tells the agent that a shell call returns when its command ends.
Acceptance criteria
Requirement: One replay per module
The eval gate test module SHALL compute the golden-set replay once per pytest module and share the report through a module-scoped fixture.
Scenario: Six report tests share one replay
- WHEN A person reads the source of
tests/roadmap/stage/test_roadmap_stage_eval_gates.py. - THEN The module holds one
replay_allcall, inside a fixture whose scope ismodule, and no test function callsreplay_all.
Requirement: One test per case
Each golden-set case SHALL replay in its own parametrized pytest test so pytest-xdist can distribute the cases across its workers.
Scenario: Collected case items
- WHEN pytest collects the case replay test with
--collect-only -q. - THEN The collected item count equals the number of cases that
load_casesreturns.
Requirement: Documented worker choice
devops ci test SHALL keep -n logical for the full suite and -n 0 for a selection of up to 12 test modules, and MUST NOT add -n auto to a run that gives no -n.
Scenario: Full suite command
- WHEN A caller runs
devops ci testwith no paths and no-n. - THEN The pytest command holds no
-n auto, andaddoptssupplies-n logical.
Requirement: Prompt forbids polling
The implement prompt MUST state that a shell call returns when its command ends and MUST forbid polling with sleep, time.sleep or a repeated tail.
Scenario: Prompt rule
- WHEN A test reads
src/devops_cli/ai/tasks/roadmap_implement_step.md. - THEN The prompt holds the no-poll rule and names
sleep,time.sleepandtail.
Existing Tool Considered
The check ran against the repository. pytest-xdist 3.8.0 is the open, maintained library that covers parallel test execution: it is already a dev dependency (pyproject.toml:99) and addopts already runs -n logical --dist worksteal (pyproject.toml:205). It lacks a shared module-level result and one test item per data case, so the change adds a module-scoped fixture and parametrization in the eval gate test, not a runner. No custom runner is built.
Key questions
- Which library should run the evaluation and replay test suites in parallel?: pytest-xdist 3.8.0, which is already a dev dependency and is already configured in
addopts. No new library is added. The eval gate test must expose each case as its own test item so xdist distributes the cases, and it must compute the shared report once. (best practice) [sources: pyproject.toml:99, pyproject.toml:205, docs/TESTING.md:157]- Chosen: pytest-xdist 3.8.0. It is open, maintained, already pinned in the dev group, and already runs the suite with
-n logical --dist worksteal. - Rejected: pytest-split. It splits a suite across jobs by file; the need here is distribution of the items of one module across workers, which xdist does.
- Rejected: Custom multiprocessing runner. It adds code to build, keep and fix, and pytest-xdist already covers the need (AGENTS.md rule 3).
- Chosen: pytest-xdist 3.8.0. It is open, maintained, already pinned in the dev group, and already runs the suite with
- Does
devops ci testrun pytest with-n 0by default?: No. The full suite keepsaddopts'-n logical.-n 0is chosen only when paths narrow the run to at mostDEFAULT_CI_TEST_SERIAL_MAX_FILES(12) test modules; a larger narrowed selection getsDEFAULT_CI_TEST_NARROWED_WORKERS(4) workers. [sources: src/devops_cli/commands/ci.py:1902, src/devops_cli/commands/ci.py:1909, pyproject.toml:205, docs/TESTING.md:157] - Should
devops ci testuse parallel execution by default?: No. The project records the module-count worker choice: serial for a selection of up to 12 modules, where worker start-up costs more than it saves, and-n logicalfor the full suite. The fix is in the eval gate test, which repeats the whole replay six times; adding-n autoto every run would reverse the recorded decision and pay worker start-up for tiny selections. (best practice) [sources: docs/TESTING.md:157, CHANGELOG.md:2317, src/devops_cli/commands/ci.py:1902, pyproject.toml:205]- Chosen: Keep the documented module-count choice. It is the recorded, measured decision (fix(ci): a test that hangs fails at a per-test timeout, so devops ci never stalls on a stuck child process #1669), and the 30-minute run comes from six repeated replay passes, not from the worker count.
- Rejected: Pass
-n autofor every run. It reverses the measured fix(ci): a test that hangs fails at a per-test timeout, so devops ci never stalls on a stuck child process #1669 decision and starts workers for selections of one or two small modules. - Rejected: A maintained list of parallel suites. It needs a list that every new slow suite must join, and a suite that is left out silently runs serially.
- How should the runner harness wait for a long-running shell command?: It already waits synchronously. The step uses the harness
Shellcapability, whose tool call returns one result when the command exits, and_tunesets no command timeout or polling loop. No completion-event service or harness code is added. [sources: src/devops_cli/roadmap/implement/implement_step.py:464, src/devops_cli/roadmap/implement/implement_step.py:550, src/devops_cli/ai/knowledge_base/devops_cli/libraries/pydantic_ai_harness.md:34] - How should the agent stop polling with shell sleep commands?: Add a rule to the implement prompt: a shell call returns when its command ends, so run the verification command and read its result, and do not run
sleep,time.sleepor a repeatedtail. The prompt already defines how the shell is used and which programs it runs, so the rule belongs there. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_implement_step.md:40, docs/SDLC.md:328]- Chosen: Prompt rule against polling. The harness shell already blocks, so the model's sleep calls are a choice that the instructions can remove, and a prompt test can hold the rule.
- Rejected: Refuse
uv run python -csleeps in the shell policy.uvis a documented program of the shell, and matching sleep code inside-cis brittle and would refuse other probes. - Rejected: Add a completion-event service. The tool call already returns one result per command, so a service adds a dependency for no need.
- Is there a repository rule that a shell sleep command violates?: No rule names a shell sleep command. The applicable rules are the 5-minute budget for a build or check (AGENTS.md rule 5), the ban on tests that bound elapsed time from above, and the rule never to poll in rapid or sub-minute intervals. The issue's claim that shell sleep violates the repository rules has no source. [sources: AGENTS.md:13, docs/TESTING.md:141, docs/SDLC.md:328]
- What makes the eval and replay suite exceed 30 minutes?: The eval gate test calls
replay_all(cases)in six test functions over 69 cases, and each replay runs every gate over the case. The same full replay therefore runs six times in one module; the targeted tests then replay one case each. [sources: tests/roadmap/stage/test_roadmap_stage_eval_gates.py:44, tests/roadmap/stage/test_roadmap_stage_eval_gates.py:56, tests/roadmap/stage/test_roadmap_stage_eval_gates.py:65, tests/roadmap/stage/test_roadmap_stage_eval_gates.py:101, tests/roadmap/stage/test_roadmap_stage_eval_gates.py:189, tests/roadmap/stage/test_roadmap_stage_eval_gates.py:405, src/devops_cli/roadmap/stage/stage_eval_gates.py:420]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 7, 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.(roadmap)scope of the title gives the scope.The agent wastes tens of thousands of tokens, keeps pods alive over 75 minutes, and violates repository rules on shell sleep commands.Active resource waste and rule violations in every long test run make this high value to fix.Two changes are needed: set a default xdist worker count and add push notifications from the runner harness to the agent.Both address CI test execution time, but #1735 reduces pytest collection overhead while the candidate fixes the runner agent shell-sleep polling and the default single-process test mode.devops-cli-service commentedon Nov 7, 2026
Status set to Ready at 257cb46 (see proposed design in issue body).
devops-cli-service commentedon Nov 8, 2026
Staged: branch
fix/4079-runner-agent-sleeps-in-polling-loop, draft pull request #4155. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
The runs of the planner and the review made 55 model request(s), and used 4258141 input tokens and 126497 output tokens. The tool calls, in order:
list_files({"directory":"tests/roadmap/stage"})search_code({"text":"DEFAULT_CI_TEST_SERIAL_MAX_FILES"})search_code({"text":"roadmap_implement_step.md"})read_spec({"capability":"roadmap-stage-eval"})read_spec({"capability":"ci-test-selection"})read_spec({"capability":"roadmap-implement-step"})list_files({"directory":"tests/roadmap"})read_file({"path":"src/devops_cli/roadmap/implement/implement_step.py","start_line":420,"end_line":580})search_code({"text":"eval implement"})read_file({"path":"docs/ROADMAP_WORKFLOW.md","start_line":380,"end_line":410})read_file({"path":"pyproject.toml","start_line":90,"end_line":112})read_file({"path":"pyproject.toml","start_line":195,"end_line":215})read_file({"path":"docs/TESTING.md","start_line":130,"end_line":165})list_files({"directory":"tests/roadmap/implement"})read_file({"path":"src/devops_cli/ai/knowledge_base/devops_cli/libraries/pydantic_ai_harness.md","start_line":1,"end_line":60})read_file({"path":"src/devops_cli/config/defaults.py","start_line":460,"end_line":480})read_file({"path":"src/devops_cli/commands/ci.py","start_line":1815,"end_line":1850})search_code({"text":"sleep"})search_code({"text":"CASES_DIRECTORY"})read_file({"path":"src/devops_cli/roadmap/stage/stage_eval_gates.py","start_line":400,"end_line":450})read_file({"path":"tests/roadmap/implement/test_roadmap_implement_prompt.py","start_line":1,"end_line":70})read_file({"path":"openspec/changes/archive/2026-11-01-3043-runner-hooks-and-scoped-ci/tasks.md","start_line":30,"end_line":70})find_issues({"terms":"test_roadmap_stage_eval_gates"})find_issues({"terms":"replay_all"})read_issue({"number":1669})list_files({"directory":"tests/fixtures/roadmap_eval/stage"})file_symbols({"path":"tests/roadmap/stage/test_roadmap_stage_eval_run.py"})file_symbols({"path":"tests/roadmap/stage/test_roadmap_stage_eval_gates.py"})read_file({"path":"src/devops_cli/roadmap/stage/stage_eval_cases.py","start_line":60,"end_line":130})list_files({"directory":"tests/fixtures/roadmap_eval/stage/2116-the-scanner-executor-tests-find-the"})read_file({"path":"docs/SDLC.md","start_line":315,"end_line":340})find_issues({"terms":"roadmap_implement_step"})find_issues({"terms":"roadmap_stage_eval_gates"})read_file({"path":"AGENTS.md","start_line":9,"end_line":15})list_files({"directory":"tests/roadmap/implement"})read_file({"path":"src/devops_cli/config/defaults.py","start_line":455,"end_line":480})read_file({"path":"src/devops_cli/commands/ci.py","start_line":1800,"end_line":1860})read_file({"path":"pyproject.toml","start_line":195,"end_line":212})list_files({"directory":"tests/fixtures/roadmap_eval/stage"})read_file({"path":"tests/roadmap/implement/test_roadmap_implement_prompt.py","end_line":80})read_file({"path":"src/devops_cli/ai/tasks/roadmap_implement_step.md","start_line":30,"end_line":50})read_file({"path":"docs/TESTING.md","start_line":135,"end_line":165})read_spec({"capability":"roadmap-stage-eval"})read_spec({"capability":"roadmap-implement-step"})read_file({"path":"src/devops_cli/roadmap/implement/implement_step.py","start_line":455,"end_line":470})read_file({"path":"docs/SDLC.md","start_line":320,"end_line":335})read_file({"end_line":406,"path":"docs/ROADMAP_WORKFLOW.md","start_line":394})read_file({"end_line":556,"path":"src/devops_cli/roadmap/implement/implement_step.py","start_line":545})read_file({"end_line":424,"path":"src/devops_cli/roadmap/stage/stage_eval_gates.py","start_line":412})read_file({"end_line":76,"path":"src/devops_cli/roadmap/stage/stage_eval_cases.py","start_line":62})read_file({"end_line":30,"path":"AGENTS.md","start_line":1})read_file({"end_line":102,"path":"pyproject.toml","start_line":95})read_file({"end_line":495,"path":"src/devops_cli/roadmap/implement/implement_step.py","start_line":464})find_issues({"terms":"replay_all eval gate test"})find_issues({"terms":"roadmap_implement_step prompt polling"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_eval_gates.py"})list_files({"directory":"tests/fixtures/roadmap_eval/stage"})read_file({"path":"tests/roadmap/stage/test_roadmap_stage_eval_gates.py","start_line":200,"end_line":460})search_code({"text":"test_the_replay_runs_the_check_of_the_job"})search_code({"text":"test_a_rule_of_the_check_that_stops_refusing_fails_the_replay_of_its_defects"})search_code({"text":"replay_all("})read_spec({})read_spec({"capability":"roadmap-stage-eval"})read_spec({"capability":"roadmap-implement-step"})read_file({"path":"docs/TESTING.md","start_line":130,"end_line":180})search_code({"text":"poll"})search_code({"text":"sleep"})read_file({"path":"src/devops_cli/ai/tasks/roadmap_implement_step.md"})read_file({"path":"src/devops_cli/roadmap/implement/implement_step.py","start_line":430,"end_line":600})read_file({"path":"pyproject.toml","start_line":90,"end_line":215})read_file({"path":"src/devops_cli/ai/knowledge_base/devops_cli/libraries/pydantic_ai_harness.md"})read_file({"path":"src/devops_cli/config/defaults.py","start_line":455,"end_line":480})read_file({"path":"docs/ROADMAP_WORKFLOW.md","start_line":385,"end_line":415})search_code({"text":"def _narrowed_workers"})read_file({"end_line":1930,"path":"src/devops_cli/commands/ci.py","start_line":1890})search_code({"text":"timeout"})read_file({"path":"src/devops_cli/roadmap/implement/implement_step.py","start_line":1,"end_line":120})search_code({"text":"DEFAULT_CI_TEST_SERIAL_MAX_FILES"})search_code({"text":"_narrowed_workers"})read_file({"end_line":470,"path":"tests/roadmap/stage/test_roadmap_stage_eval_gates.py","start_line":377})search_code({"text":"background"})read_file({"end_line":340,"path":"docs/SDLC.md","start_line":315})search_code({"text":"pydantic_ai_harness.shell"})search_code({"text":"IMPLEMENT_SHELL_PROGRAMS"})read_file({"end_line":640,"path":"tests/roadmap/implement/test_roadmap_implement_step.py","start_line":560})search_code({"text":"Shell("})search_code({"text":"when the command exits"})search_code({"text":"stop_grace_seconds"})read_file({"path":"src/devops_cli/roadmap/stage/stage_criteria.py"})read_file({"end_line":30,"path":"AGENTS.md","start_line":1})read_file({"end_line":130,"path":"docs/TESTING.md","start_line":88})search_code({"text":"module-scoped"})search_code({"text":"golden set"})find_issues({"terms":"replay_all eval gate test"})find_issues({"terms":"roadmap_implement_step prompt polling"})read_issue({"number":4113})read_issue({"number":3266})search_code({"text":"test_roadmap_stage_eval_gates.py"})search_code({"text":"roadmap_implement_step"})search_code({"text":"command_timeout_seconds"})search_code({"text":"module-scoped fixture"})search_code({"text":"parametrized"})search_code({"text":"shell"})read_spec({"capability":"roadmap-implement-step","requirement":"The shell tool admits only the project's programs"})read_file({"end_line":480,"path":"tests/roadmap/implement/test_roadmap_implement_shell_policy.py","start_line":420})read_file({"end_line":300,"path":"tests/roadmap/implement/test_roadmap_implement_shell_refusal.py","start_line":250})search_code({"text":"\"docs\""})search_code({"text":"def docs"})search_code({"text":"Shell"})search_code({"text":"create_subprocess_exec"})read_file({"end_line":120,"path":"tests/roadmap/implement/test_roadmap_implement_step.py","start_line":1})search_code({"text":"tool_calls("})read_file({"end_line":440,"path":"src/devops_cli/roadmap/stage/stage_eval_gates.py","start_line":408})read_file({"end_line":80,"path":"src/devops_cli/roadmap/stage/stage_eval_cases.py","start_line":60})search_code({"text":"_needs_no_spec"})search_code({"text":"every path in 'changes' is under tests/"})read_file({"end_line":660,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":590})read_file({"end_line":720,"path":"src/devops_cli/roadmap/stage/stage_change.py","start_line":690})search_code({"text":"_NO_SPEC_PREFIXES"})read_file({"end_line":2160,"path":"src/devops_cli/commands/ci.py","start_line":2125})read_file({"end_line":820,"path":"src/devops_cli/commands/ci.py","start_line":795})Tool calls: file_symbols=2 (empty=0), find_issues=8 (empty=5), list_files=8 (empty=0), read_file=55 (empty=0), read_issue=3 (empty=0), read_spec=9 (empty=0), search_code=36 (empty=1)
The stage job read the open pull requests and their files in 1 GraphQL request(s).
docs(openspec): plan #4079 Replay the stage set once and stop the pol…
docs(openspec): plan #4079 Replay the stage set once and stop the pol…
docs(openspec): plan #4079 Replay the stage set once and stop the pol…
2 remaining items
devops-cli-service commentedon Nov 8, 2026
Stopped at group 1.
Failure class:
limit_reached.Action taken: none.
Action left:
raise_limit: raise the limit that the run went over.Reason:
Last message of the agent (a claim that no check verified): Now let me make the change to the test module. First the header, imports and fixtures:
The item is Blocked, and the job will not run it. Fix the cause. Then comment
implement: retry. The Service clears the stop on its own when a new runner image rolls out, but only if a retry can fix the class of the stop and the limits ofroadmap.implement.digest_clears_per_classandroadmap.implement.digest_clears_per_itemallow it.The job kept 1 work-in-progress commit on the branch
fix/4079-runner-agent-sleeps-in-polling-loopon origin. The last isdbfa4c7dc25c3db554733c2cb520010ff2f87a89. The job discarded only the work after it. The next run continues from it and does the tasks that are not ticked.devops-cli-service commentedon Nov 8, 2026
The runner Job devops-cli-runner-20261108-145901-90a8 ended: succeeded.
Image digest: sha256:5bc8c0eda31dfb2bee0e86a6ecae2495e47088c7cb421272dabbe2478062c954
The last lines of its log:
fix(roadmap): runner agent sleeps in polling loop during test
devops-cli-service commentedon Nov 8, 2026
Released in v0.91.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.91.0
devops-cli-service commentedon Nov 8, 2026
Live since 2026-11-08 17:21 UTC