Skip to content

fix(tier3): say progress stopped when a plan line is refused, and keep the running spinner moving - #548

Merged
rng1995 merged 25 commits into
mainfrom
naren/fix-tier3-progress-followups
Nov 14, 2026
Merged

rng1995 merged 25 commits into
mainfrom
naren/fix-tier3-progress-followups

Conversation

@rng1995

@rng1995 rng1995 commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #420, which made the interactive Tier 3 progress view keep one height and redraw only on progress events and heartbeats. Two problems remained on main. When the terminal refused a plan line printed before the table starts, progress turned off with no notice, and the refused line came back with the next run on the same reporter. And a running stage's spinner stayed on its first frame for the whole run. This PR fixes both and adds regression tests. It also corrects the guide's claim that refused output is never drawn over later output.

Changes

  • A refused plan line before the table started turned progress off with no notice. The Rich view prints the Agents / models, Provider and Run plan lines before it starts Rich Live. When the terminal refused one of them, for example with BlockingIOError on a terminal another process made non-blocking, close_after_failure() recorded the outcome only when Live existed. Neither the "the run continues" line nor the late "the run went on without it" line was printed, although docs/tier3-live-evaluation.mdx and the 0.9.0 CHANGELOG entry promise one of them. RichProgressReporter._close() now treats a drawing failure before Live started like one after it: it drops the Rich console's copy of the refused line, prints the "the run continues" line and records the outcome. When the terminal refuses that line, the run's close() prints the late notice instead. Standard error, which the CLI passes, keeps a line the terminal refused in its own buffer. So the view flushes the stream before the notice and, while the terminal still refuses what the stream holds, leaves the notice to close(). The refused plan line then appears once, followed by one notice.
    The refused line also came back with the next run because the Rich console keeps a refused write for its thread and sends it before that thread's next write. The same happened to other output still refused when a run ended: the late notice, a show-cursor write, or a normal run's final table and Live stop. A final table sent with the next run moves the cursor up and erases the lines printed between the runs. The run's close() now drops the console's copy of whatever the terminal still refuses once it has finished, after a drawing failure or not. The CLI uses one reporter per run and exits afterwards, so only callers that reuse a reporter saw this part.
  • The running spinner never moved. Since fix(tier3): keep the Rich progress frame at a fixed height #420, Live runs with auto_refresh=False, and each redraw built a new Rich Spinner for every running stage. A Rich spinner picks its frame from the time since its first render, so every redraw showed frame 0. Keeping one spinner per stage is not enough, because its frame still comes from the clock: redraws every 4 seconds would show the same frame each time. Each running stage now counts its redraws and shows the next of the same dots glyphs on each one. A stage that runs again after it finished starts from the first frame, and the counts are cleared with the other rows when the reporter closes.
  • The guide said refused output can never be drawn over later output. The rich view paragraph in docs/tier3-live-evaluation.mdx said that frames the terminal refused are dropped when the run ends, so they are never drawn over output printed since. The view drops only its own copy. Standard error keeps its own copy and can still send it later, and a table sent then can still erase the lines printed since. The paragraph now says that, when any run ends, whether or not drawing failed, the view drops its own copy, and that a stream that keeps refused output, as standard error does, can still send it later. It already described the stop notice, so that part is unchanged.
  • CHANGELOG.md has one Fixed entry under Unreleased that names the 0.9.0 progress view entry. The released 0.9.0 entry is unchanged.

Known trade-offs

  • The spinner moves one frame per redraw: once a second by default while a stage runs, and on each progress update. Before fix(tier3): keep the Rich progress frame at a fixed height #420, Rich's own timer redrew it 8 times a second.
  • A refused plan line reaches the terminal only when the stream kept it, as standard error does. On a stream that keeps nothing it refused, the line is dropped, like a refused frame.
  • Dropping the console's copy does not remove the copy that standard error keeps, and the standard library has no public way to drop it. So standard error can still send a refused notice, final table or show-cursor write later, and a final table sent then can still erase the lines printed between runs. That was already so before this PR. The CHANGELOG entry and the guide say so.
  • On a stream that keeps nothing it refused, a show-cursor write still refused when the run ends is dropped, so the cursor stays hidden until a later view on that terminal shows it again.

Tests

  • 15 new test cases in tests/test_tier3_progress.py. All 15 fail on main c19b5d7 and pass on this branch:
    • test_a_refused_plan_line_before_the_frame_turns_progress_off_with_a_notice (4 cases: each plan line refused, and the plan line and the notice both refused). Each checks that one stop notice ends the run's output and that the next run prints Agents / models: once. On main there is no notice (assert 0 == 1).
    • test_a_plan_line_refused_by_a_buffered_terminal_stream_is_printed_once (4 cases, on a line-buffered text stream over a buffered writer, shaped like standard error). Each checks that the refused line appears once and that one stop notice, the expected one, ends the output. On main there is no notice (assert 0 == 1).
    • test_writes_refused_until_the_run_closes_are_not_sent_with_the_next_run (2 cases: refused from the first plan line, or from an update after the table started). Each checks that the next run starts with its own Agents / models: line and carries nothing from the failed run. On main the plan-line case prints that line twice and the update case starts with a show-cursor escape.
    • test_a_final_frame_refused_when_the_run_closes_is_not_sent_with_the_next_run (2 cases: stage finished, or still running). Nothing fails during the run; the terminal refuses only the run's close(). On main the next run starts with the old table's cursor-up and erase-line controls.
    • test_rich_progress_running_spinner_moves_on_with_each_redraw (1 case): the spinner moves one frame per heartbeat or update, wraps after ten frames, and restarts when a finished stage runs again. It does not depend on the clock. On main it stays on frame 0 (assert 0 == 1).
    • test_changelog_says_a_stream_can_still_send_refused_output_later (1 case): finds the CHANGELOG entry by its opening words and checks the stated limit. On main the entry is missing (assert 0 == 1).
    • test_live_evaluation_docs_say_a_stream_can_still_send_refused_output_later (1 case): finds the guide's rich view paragraph by its opening words and checks that it states the same limit and ties the drop to every run's end, not to a drawing failure, after which no final table is drawn. On main's guide it fails because the paragraph still says refused frames are never drawn over later output.
  • tests/test_tier3_progress.py and tests/tier3/test_skip_with_skill.py, which also uses the Rich reporter: 217 passed.
  • Other test modules that read docs/tier3-live-evaluation.mdx (tests/test_accuracy_arithmetic.py, tests/test_harbor_claude_refusal_fallback.py, tests/test_benchmark_rollout_docs.py, tests/reporting/test_applicability_saved_runs.py, tests/reporting/test_tier3_completed_agent_docs.py, tests/test_metrics_reference_docs.py): 104 passed, 16 failed. All 16 fail the same way on main here: 15 import a Harbor module the locally installed Harbor does not have yet, and one is the Tier 3 validation report pair check. tests/test_tier3_public_runtime.py and tests/tier3/test_baseline_timeouts.py: 428 passed, 9 failed, all 9 on that same missing Harbor module. Their docs checks pass.
  • tests/test_ci_workflows.py, tests/test_oss_packaging.py, tests/test_ci_change_classifier.py and tests/tier3/test_verifier_python39_syntax.py: 136 passed, 1 failed. The failure is the Harbor keyword argument contract check against the installed Harbor source. It fails the same way on main here, because the locally installed Harbor is older than the version main pins.
  • ruff check and ruff format --check pass on the changed Python files. The OSS boundary scan passes.
  • Main a8436f6 is merged into this branch (CHANGELOG.md was the only conflict; the changelog check now finds its entry wherever it sits), and git merge-tree --write-tree against main is clean.

🤖 Generated with Claude Code

rng1995 and others added 16 commits November 12, 2026 19:48
…he frame

The Rich view prints the Agents / models, Provider and Run plan lines
before it starts Live. When the terminal refused one of those writes, for
example with BlockingIOError on a terminal another process made
non-blocking, progress turned off with no notice: close_after_failure()
recorded the outcome only when Live existed, so neither the on-time nor
the late notice was printed. The refused line also stayed in the Rich
console's buffer for that thread and went out again with the next run's
plan, which then printed it twice.

A drawing failure before Live starts now prints the notice that the run
continues, after the refused line, and records the outcome as a failure
with Live does. When the terminal refuses the notice too, the run's
close() drops the held output and prints the late notice.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rich no longer redraws the progress view on its own timer, and every
redraw built a new spinner for each running stage. A Rich spinner picks
its frame from the time since it was first drawn, so each new one showed
its first frame and the running indicator stood still for the whole run.

Each running stage now keeps one spinner across redraws until it leaves
the running state, so every heartbeat or update draws it at a later frame.
The spinners are dropped with the other rows when the reporter closes.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The progress view redraws only on progress events and heartbeats. A Rich
spinner picks its frame from the clock, so even when kept across redraws
it stood still whenever redraws came a whole number of its cycles apart,
for example every 4 seconds with --progress-interval 4, and showed only
two frames every 2 seconds.

Each running stage now shows the next frame of the same dots spinner on
every redraw, however far apart the redraws come, and starts again from
the first frame when it runs again after finishing.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CLI passes standard error to the progress view, a line-buffered text
stream over a buffered writer. When a non-blocking terminal refuses a plan
line printed before Live starts, that buffered writer keeps the line and
raises BlockingIOError from its flush, and the Rich console keeps its own
copy for the thread. The stop notice then sent both copies, so the
refused line appeared twice in the same run.

A drawing failure before Live starts now drops the console's copy before
it prints the notice, as the late notice already does. The stream sends
the line it kept with the notice, once. The test terminal that refuses
plan lines counts only writes that carry text, since dropping the held
output writes an empty string.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the terminal still refused the late notice, or the write that shows
the cursor again, when a run whose progress display failed was closed,
the Rich console kept that output for its thread. A later run on the same
reporter then started with it: the late notice from the earlier run, or
a stray show-cursor escape before its plan lines.

The run's close() now drops what the terminal refused there as well, as
it already does with refused frames, so a later run starts with its own
output.

Follow-up to #420.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… full

When the terminal refused a plan line before the Rich progress table
started, standard error kept the refused line in its buffer. It was
usually still full a moment later, when the line saying that the run
continues was written, so the stream kept that line too and sent it when
the run ended, just before the line saying that the run went on. The
terminal then showed both notices.

Before writing the notice, the view now flushes the stream. If the
terminal still refuses what the stream holds, the notice is left for the
run's close(), which prints the late notice, so only one of the two
reaches the terminal. A stream that keeps nothing it refused flushes at
once, so it still gets the notice right away.

Follow-up to #420.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Tier 3 progress follow-up entry now says that only one stop notice
appears when the terminal still refuses writes, and that output still
refused when a run ends is not sent with the next run on the same
reporter.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When nothing failed while a run went on but the terminal refused the
final table and Live's stop in the run's close(), the Rich console kept
that output for its thread. Only a run whose display had failed earlier
dropped what was still refused. A later start() on the same reporter then
sent the old final table first. It starts by moving the cursor up over
the frame that was on screen, so it erased the lines printed between the
runs and drew the old table over them.

The run's close() now drops whatever the terminal still refuses once it
has finished, after a drawing failure or not.

Follow-up to #420.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…utput

The Tier 3 progress entry said the view no longer sends output the terminal
still refuses when the run ends with the next run on the same reporter. The
run's close() drops only the view's own copy. A stream that keeps what the
terminal refused, as standard error does, still sends it with its next write,
and a final table sent then can still erase the lines printed between the
runs. The entry now says so, and a test checks it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in current main. The 0.9.0 release moved this branch's CHANGELOG
entry into the released section with the progress view entry it follows,
so it moves back under Unreleased > Fixed and now names that 0.9.0 entry.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rich progress view paragraph in the Tier 3 live evaluation guide said
that refused frames are dropped when the run ends, so they are never drawn
over output printed since. The view drops only its own copy. A stream that
keeps what the terminal refused, as standard error does, can still send it
later, and a table sent then can still erase the lines printed since. The
guide now says so, as the Unreleased CHANGELOG entry does, and a test checks
the paragraph.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The guide said the view "then" drops its own copy of output the terminal
still refuses, such as the final table, right after the sentences about a
failed display. After a drawing failure the view draws no final table, and
the drop happens when every run ends. The sentence now says so, and the
docs test checks the new wording and rejects the old one.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CHANGELOG.md conflicted. Main's file is kept as is, and this branch's
entry sits under Unreleased > Fixed.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check split CHANGELOG.md at blank lines and expected the entry to
start its own block, so it failed once main added entries above it in
the same subsection. It now reads each bullet with its continuation
lines and finds the entry by its opening words.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 42ab398. The plan-line notice, the close-time drop and the spinner work as described: the PR's 15 new cases and test_skip_with_skill.py pass (217 passed), and a refuse/accept probe matrix on a stderr-shaped stream matches or beats main everywhere except one case. In that case the deferred notice is lost when the terminal refuses the show-cursor at close (P2). There is also a CHANGELOG spacing nit (P3). I'll push fixes with regression tests.

Comment thread CHANGELOG.md Resolved
rng1995 and others added 3 commits November 13, 2026 21:19
_finish_failed_stop showed the cursor and wrote the late stop notice in
one try, so when the terminal refused the show-cursor write as the run
closed, the notice was never written. Since the stop notice now waits
for close() while the stream still holds refused output, a first frame
refused on standard error, a terminal that drained during the run and
was full again at close left the run with no stop notice at all; main
had sent the early notice from the stream's buffer. A refused update
frame already lost the notice this way.

The notice now has its own try after the cursor restore. Standard error
keeps the refused notice with the show-cursor write and sends both once
the terminal drains; on a stream that keeps nothing, close() drops both
as before.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Unreleased Fixed entry for the Tier 3 progress view was followed by
two blank lines before the 0.9.0 heading. The entry's CHANGELOG check
now also requires a single blank line after it.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e notice test

On Python 3.12 and 3.13 the 8 KiB BufferedWriter under the test's stderr-shaped
stream keeps only the start of the refused update frame and sends it with the
next write, cut inside a box-drawing character, so a strict UTF-8 decode of
what the terminal received failed (CI Tests 3.12/3.13, Tier 2 Windows, Tier 3
macOS). Python 3.14's buffer keeps the whole frame. Decode with replacement;
the cursor and stop-notice assertions are unchanged.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of b843463. An independent pass over the stop-notice paths found one more P3. When standard error keeps a refused "the run continues" line, that line is printed along with the late notice. A fix with regression tests follows.

rng1995 and others added 6 commits November 13, 2026 22:19
_stop_live_after_failure flushes the stream before the "the run
continues" notice so that standard error does not send a refused notice
before the late one. That missed the next step: the terminal takes the
flush, then refuses the notice write itself. Standard error's buffer
kept the notice, and close() sent it from the stream and then wrote the
late "the run went on without it" notice as well. A plan line refused
before the table started (raw writes 1 and 3 refused) printed both
notices, where main printed none, and a refused update frame followed
by a refused notice printed both on main too.

The flush and the notice now have separate tries. When the notice
write raises BlockingIOError on a stream over a BufferedWriter right
after the flush, and the console held nothing else, the stream holds
the whole notice. The record says so, and close() flushes the stream
instead of writing the late notice. A stream that keeps nothing it
refused still gets the late notice. A first frame that Live.start()
stopped itself is left as it was: the console's held frame and stop go
out with the notice, so how much of it the stream kept depends on its
buffer size.

Tests: the buffered-stream plan-line test gains the refused-lines-1-and-3
case, and a new test refuses an update frame and then the notice on a
stderr-shaped stream, with the terminal taking writes at close or still
full then. All three cases print two notices without the fix.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…en as kept

781ec05 treats a stop notice the terminal refused as kept by the
stream only when the console held nothing else. After a refused first
frame, Live.start() stops Live itself, and when the terminal refuses
that stop too the console holds the frame and stop and sends them with
the notice in one write. A stream buffer smaller than that write keeps
only its start, so the notice is lost and the late notice is needed.
No test covered that exclusion: removing it left every test passing,
and the run then ended with no stop notice.

The new test refuses the first frame and Live.start()'s stop on a
stderr-shaped stream with a 1 KiB buffer, lets the flush before the
notice through, refuses the notice, and checks that one stop notice,
the late one, ends the output. It sets the buffer size so that it does
not depend on the Python version's default. With the exclusion removed
it fails with 0 == 1 on Python 3.14 and 3.13.

The comments now say what the code does. After a failed first frame the
late notice is written whether or not Live.start()'s stop went out,
because nothing there tells which. When that stop went out and the
stream kept the notice, both notices still print, as on main. A stream
buffer smaller than the notice would keep only part of it; standard
error's buffer is many times larger.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
After 781ec05, a stream that keeps what the terminal refused, as
standard error does, sends a refused "the run continues" line when the
run ends, and the late "the run went on" line no longer follows it. The
guide still said that a refused line is always replaced by the late
one, which on standard error is now so only when the terminal also
refuses the writes before that line. The CHANGELOG entry said the same
for the plan-line case and did not mention the refused table update,
after which standard error printed both lines.

The guide's rich view paragraph now says that a stream that kept the
refused line sends it then instead of the later one, and that after a
failed first frame both can still appear, as on main. The CHANGELOG
entry says the same for its plan-line case and notes the table update
case. The changelog and guide tests check the new sentences and fail
on the old text.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d cursor write

73c3323 moved the late stop notice into its own try so that a refused
show-cursor write no longer loses it. That write also skips the line()
that ends the frame's last line, and the notice was then written anyway.
When the stream had kept only the start of the refused Live stop, cut
before the stop's newline, the notice landed on the cut frame's last
line. The 8 KiB default BufferedWriter of Python 3.12 and 3.13, as
under the tests' stderr-shaped stream, does this when it already holds
a refused update frame: with raw writes 6, 7 and 9 refused, the output
ended with the cut box border followed by the notice.

When the cursor write raises before line() runs, the notice now starts
with a newline in the same write. A refused line() needs nothing more:
the console keeps it and sends it ahead of the notice. Where the stream
kept the whole stop, the notice follows a blank line, as it already did
when the terminal took the cursor write.

73c3323's message said standard error sends the notice with the
show-cursor write once the terminal drains. It does so only when its
buffer has room: one already full of a refused frame keeps neither, as
before that commit. The code and test comments now say so.

Tests: a new test refuses an update frame and Live's stop on a
stderr-shaped stream with a 1 KiB buffer, so that it does not depend on
the Python version's default, prints nothing before close, and refuses
the show-cursor write at close. It checks that the late notice is on a
line of its own, and it fails without the fix on Python 3.14 and 3.13.
Enumerating every refuse/accept pattern of the first 11 raw writes,
with and without a warning line, at the default, 1 KiB and 4 KiB
buffers, leaves the notice count and the cursor state unchanged in
every pattern and leaves no notice joined to a frame line on this path.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er has room

The guide said that when the terminal refuses the line saying the run
continues, or the write that shows the cursor again, the line saying the
run went on is printed and the cursor is shown when the run ends. That
holds when the terminal takes writes then, or when the stream that keeps
what the terminal refused, as standard error does, has room for them.
When its buffer is already full of a refused frame and the terminal
still refuses writes at close, the stream keeps neither: the late line
is lost and the cursor stays hidden, even after the terminal takes
writes again. 5cda204 corrected the same claim in the code comment.

The guide now says the stream sends the late line and the cursor write
only if its buffer has room, and that a buffer full of a refused table
can drop the line and leave the cursor hidden. The guide test asserts
the new sentence and fails on the old text.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sts draw in place

Rich reads TTY_INTERACTIVE when it builds a console, and
TTY_INTERACTIVE=0 makes it non-interactive even with force_terminal=True.
Live then stops redrawing the frame in place, so seven tests that drive
a forced terminal and a refusing stream failed in that environment on
Python 3.14 and 3.13: the late notice tests, the kept-notice tests, the
refused-first-frame test, the refused-from-an-update case of the
next-run test and 5cda204's new cut-frame test. CI does not set the
variable.

An autouse fixture in the module now removes TTY_INTERACTIVE, so these
tests draw the same frames wherever they run. The module passes with
TTY_INTERACTIVE unset, 0 and 1 on Python 3.14 and 3.13 (7 failed with
TTY_INTERACTIVE=0 before).

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rng1995
rng1995 merged commit e466e83 into main Nov 14, 2026
27 checks passed
@rng1995
rng1995 deleted the naren/fix-tier3-progress-followups branch November 14, 2026 17:49
rng1995 added a commit that referenced this pull request Nov 14, 2026
CHANGELOG.md was the only conflict: #548's Tier 3 progress entry and this
branch's Tier 2 catalog entry were both added at the end of Unreleased, Fixed.
Both are kept, with one blank line before 0.9.0.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant