Repository navigation
feat(devtools): run managed pytest through the host pytest slot - #4581
Conversation
pytest started from a session subagent runs outside every load control the daemon applies to its own jobs. On 2026-09-03 three concurrent runs pushed the corpus job past its four-hour timeout. `devtools test` and the pytest step of `devtools verify` now acquire the host's single-parallelism `pytest` pueue group before running. A caller already inside a queued task (`SINNIXD_JOB_ID`) holds the slot and streams as before; a caller outside it queues, waits, reports the exit code pueue recorded, and prints the captured log path. An unreachable queue is a typed refusal naming `systemctl --user start pueued`, never an unqueued run. pueue 4 persists the `pueue add` client's whole environment into user state, so the adder inherits only HOME, PATH, XDG_RUNTIME_DIR, and XDG_DATA_HOME; the managed pytest environment travels in a launch file the queued task consumes and deletes. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90270526d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
## Summary Fixes the two reds in `tests/unit/devtools/test_verify.py`. One was a real defect (inherited, not from #4709); one was a stale expectation from #4709. ## Which was which Measured, not assumed. Both tests were run at `d430734f1`, the commit immediately before #4709 merged, with `devtools` and `tests` both checked out at that commit: - `test_accepted_flake_clears_both_recorded_exit_statuses` **fails identically there**. It is inherited and predates #4709. The `relative_to(ROOT)` call it trips over came from #4536. - `test_missing_checkout_venv_tool_is_a_typed_failure` **passes there**. That one is #4709's, and it is a stale expectation rather than a defect: an absent `.venv` now reports `gate_unprovisioned_environment` instead of `gate_missing_executable`, which is the intended distinction and is what the new test in #4709 asserts. So the rerun routing through `run_pytest` is not implicated; it arrived in #4581 and is unchanged here. ## Problem `_rerun_failed_once` formats its receipt with `rerun_report.relative_to(ROOT)`, which raises `ValueError` when the step directory is outside the checkout — a configured basetemp root, or any caller supplying its own artifact directory. A rerun that had already adjudicated its flakes correctly then died formatting its own path, and no rerun result was recorded at all. ## Solution Report the path relative to the checkout when it is inside one, absolute otherwise. Split the venv test into both conditions so the original coverage (a provisioned venv missing one tool) survives beside the new one (no venv at all). ## Verification `POLYLOGUE_ALLOW_BARE_PYTEST=1 POLYLOGUE_PYTEST_RUN_ID=x .venv/bin/python -m pytest tests/unit/devtools/test_verify.py -p no:randomly --override-ini=addopts=` — **41 passed**, redirected to a file and read, not piped. ## Residuals - A third red was reported in this file; only these two reproduce at master (`04e297bbc`). If the third is real it is ordering-dependent and not visible in a full run of the file. - The static quick gate ran green via the pre-push hook; the focused run above is the test evidence. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at bf68918):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at c950478):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
devtools testand the pytest step ofdevtools verifyacquire the host's single-parallelismpytestpueue group before running pytest.Problem
pytest started by a session subagent runs outside every load control the daemon applies to its own jobs: it is an ordinary foreground subprocess in
session.slice, not a queued task. On 2026-09-03 three concurrent agent runs contended for the same cores and disk and pushed the corpus job past its four-hour timeout. Closes sinnix-9t8i / sinnix-xteo.6.Solution
devtools/pytest_slot.pyowns the slot, and both managed pytest routes go throughrun_pytest.sinnixd-queue-runexportsSINNIXD_JOB_ID, or the explicitPOLYLOGUE_PYTEST_SLOT=heldescape — pytest runs in place and streams as before..cache/verify/pytest-slot-<pid>.jsonand queued aspueue add --escape --group pytest --label polylogue:{test,verify}:<pid> --working-directory <root> --print-task-id -- <venv python> -m devtools.pytest_slot <launch file>. The caller waits on the task, reads the exit code frompueue status --json, and prints the captured log path.pueue addclient's whole environment into a user-only state file, so the adder inherits onlyHOME,PATH,XDG_RUNTIME_DIR, andXDG_DATA_HOME. The managed pytest environment travels in the launch file, which the queued task deletes after reading.PytestSlotUnavailableErrornamingsystemctl --user start pueued. There is no unqueued fallback.pytest_slot: pueue task <id>orheld.verify's single rerun of failed tests holds the slot too, so the adjudication does not escape the control that the run it adjudicates is under.Verification
The last one queued as pueue task 12 in group
pytest:and finished
Done/Success, exit 0,2 passedin the captured log. Its persisted task environment carriesHOME PATH XDG_DATA_HOME XDG_RUNTIME_DIRplus pueue's ownPUEUE_GROUP/PUEUE_WORKER_IDand nothing else; its receipt records"pytest_slot": "pueue task 12".Anti-vacuity, named in the test module: deleting the queueing branch in
run_pytestmakestest_outside_a_task_the_run_is_queuedred, because the command executes here and its marker file appears. WideningINHERITED_ENVIRONMENT_KEYSmakestest_the_adder_environment_carries_only_the_allowed_keysred.Residual risk
The queued run is not streamed, so a long focused run shows nothing until it finishes;
pueue follow <id>is the live view and the log path is printed on both paths. A caller that setsPOLYLOGUE_PYTEST_SLOT=heldby hand reintroduces the contention. The corpus is unrun on this branch — only the quick gate and the new module ran.🤖 Generated with Claude Code
https://claude.ai/code/session_01YGi8wLWGR2HYBh8p8fXFXz