Repository navigation
Description
TL;DR
The heartbeat is a fixed interval, so its line count grows with the length of
the run while its information content does not. A 474 s full-suite run printed
46 progress lines; the first three carried everything the other 43 repeated.
--agent-heartbeat already exists and already accepts 0, so nothing is
missing. The default is what is wrong, and a fixed interval is the reason it
cannot be right for both a 70 s run and a 500 s one.
The piped-stdout guard is not in scope. No change here weakens it. An agent
must not reach for head or tail, and the point of this issue is to remove
the reason to want to.
Measured
One pytest tests run, 2044 tests, 474 s, captured to a file:
| lines | |
|---|---|
| total | 166 |
| heartbeat ticks | 46 |
agent_notes values |
61 |
the direnv/Nix dev-env rebuild |
42 |
| headers, footers, the rest | 17 |
20 680 bytes in total.
42 of the 166 lines are not pytest-agent. They are the nanopynix-dev-env
rebuild that direnv exec . performs, and no change here touches them. They
are listed so the number 166 is not read as pytest-agent's.
The heartbeat
A tick reads:
[pytest-agent] 140s pass=543 fail=0 done=544 tot=2048 cur=tests/pynix/test_build.py::test_build_flake_derivation[local]
Three facts a reader wants: the run is alive, it is making progress, and this
is the test it is on. All three arrive on the first tick. Every later tick
restates them, and only the last one is kept.
A fixed interval makes the count a function of wall-clock time:
| run | ticks |
|---|---|
tests/meta (1.4 s) |
0 |
| a four-directory group (74 s) | 7 |
tests (474 s) |
46 |
Seven is right. Forty-six is the same seven, six more times.
Proposed: widen the interval as the run goes on, with a cap. Start at the
current 10 s and grow towards about 60 s. The 474 s run emits roughly a dozen
lines instead of 46, and the first minute -- where a reader is still asking
whether the run started at all -- is unchanged.
The heartbeat does not have to stay fine-grained to catch a stuck run.
--agent-stuck-after already owns that, and it does the useful thing rather
than the visible one: it dumps every thread's stack at 300 s.
The notes block
61 lines, ending in +110 more lines: .pytest-agent/runs-NNNN/notes.jsonl. So
the block already knows it has a limit
8000
, and already writes the whole thing to
disk.
--agent-max-summary-lines governs exactly this decision for an end-of-run
report from another plugin -- a --cov table, --durations. The notes block
makes the same trade with a constant nobody can reach. Either it should honour
that option or it should have its own.
This half is smaller than the heartbeat and less clear-cut: a note is a value a
test was asked to report, so a reader usually does want it. Raising it here
because the inconsistency is the finding, not the number.
Acceptance criteria
- A 500 s run prints on the order of a dozen heartbeat lines, not 46, and a
70 s run prints no fewer than it does today. --agent-heartbeatandPYTEST_AGENT_HEARTBEATkeep working, 0 still means
off, and an explicit value still means a fixed interval -- backoff is the
default, not the only behaviour.- The inline cap on the notes block is reachable from the command line.
- The piped-stdout guard is untouched, and a test proves it.
Activity
feat(pytest-agent): widen the heartbeat as a run goes on, and let the…