Skip to content

fix(tier3): keep the Rich progress frame at a fixed height - #420

Merged
rng1995 merged 17 commits into
mainfrom
naren/port-tier3-progress-rendering
Nov 12, 2026
Merged

rng1995 merged 17 commits into
mainfrom
naren/port-tier3-progress-rendering

Conversation

@rng1995

@rng1995 rng1995 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The interactive Tier 3 progress view (--progress rich, or auto in a terminal) now keeps one height for the whole run and draws only from progress events and heartbeats. Text the fixed frame cuts is printed in full elsewhere, and a drawing failure turns progress off without reporting the running stages as failed.

The closed plugin-evaluation PR #28 carried a version of this fix inside its larger change; this PR lands the generic part on its own.

  • Fixed height:
    • The Provider and Run plan rows are always shown. Until the plan resolves they read pending with resolving / preparing.
    • The title and all four columns use no_wrap with an ellipsis, so each row is one line.
    • Stages fill a fixed number of rows: at least 6 (_LIVE_MIN_EVENT_ROWS) and at least one per agent, padded with blank rows. The count only grows. An updated stage moves to the end, so the rows show the most recently updated stages.
    • Live is created with auto_refresh=False. Before, Rich also redrew at 8 Hz from its own thread, outside the reporter lock.
  • Nothing is hidden for good:
    • The Agents / models, Provider and Run plan lines are printed in full above the frame whenever one of them changes, so every agent's model and every plan value stay in the scrollback. They are printed with Rich markup, highlighting and emoji codes off, so a model ID such as ollama:llama:3.1-8b prints as is.
    • When the run ends, close() draws a final table before stopping Live. It lists every stage without padding and shows unresolved Provider and Run plan rows as - / not resolved. Its Detail column wraps in full when the width it is drawn at leaves that column at least 20 columns (_FINAL_DETAIL_MIN_WIDTH). In a narrower terminal each row stays on one line, as while running. Before, a 60-column terminal left the Detail column 4 characters wide and folded every detail into 4-character pieces.
    • A stopping agent's detail is now 2nd Ctrl+C skips wait; stopping Harbor jobs, up to 30s of environment cleanup (_HARBOR_RUN_STOPPING_DETAIL in runner.py). The hint comes first and is short. At 80 columns, next to the longest built-in stage label (Agent Runtime Preflight), the row still shows it with two columns to spare, so a legacy Windows console, which uses one column less, shows it too.
  • Drawing failures:
    • _heartbeat_loop catches a heartbeat() failure and calls a failure callback registered with the new set_failure_callback(). With no callback it sets the stop event. Either way the thread ends without a traceback. A failure while close() is already stopping the reporter calls nothing.
    • A write the terminal refuses (BlockingIOError, for example on a terminal another process made non-blocking) is a drawing failure like any other. It is not skipped: Rich keeps a refused frame and sends it again before the next one, so skipping would grow that backlog by one frame per heartbeat.
    • SafeProgressReporter registers its _disable hook as that callback, best effort: a reporter whose registration raises is wrapped as before. _disable calls the reporter's new close_after_failure() when it has one. That stops without marking running stages failed - interrupted before completion; the Rich reporter keeps its last frame and prints Tier 3 progress display stopped after a drawing error; the run continues.
    • A terminal that refuses a redraw usually refuses the stop that follows on the same thread, and with it the write that shows the cursor again. The failing thread stops Live, prints the notice and records which of the two the terminal refused, all in one hold of the reporter lock (_stop_live_after_failure). The run's final close() therefore either stops Live itself or finds that record, even when it runs while the heartbeat thread is still turning the display off.
    • With a record, close() first drops what the closing thread's Rich console still holds from refused writes (Console.begin_capture() then end_capture()). Rich would otherwise send it before that thread's next write. A refused frame or stop starts with cursor-up and erase-line controls sized to the frame that was on screen when drawing failed, so it would erase lines printed since, such as logged warnings, and draw the old frame over them. Then, when the stop was refused, close() shows the cursor and ends the frame's last line. When the notice did not reach the terminal, it prints Tier 3 progress display stopped after a drawing error; the run went on without it.
    • Rich's Live.start() stops Live itself when its first frame fails, then raises. When the terminal refused that stop too, the later stop has nothing left to do, so the record says the stop went through. close() therefore also shows the cursor when the output it drops holds Live's show-cursor write. No frame reached the terminal then, so it ends no line.
    • start() of a new run drops such a record, and the held output, when the run whose display failed was never closed.
    • close() and close_after_failure() share one _close(after_failure=...), which decides under the same lock hold whether to mark running stages. An agent update that reaches the reporter while a failed display stops is drawn as running, not as failed.
    • SafeProgressReporter.start() holds a wrapper lock while the reporter draws the plan, and _disable sets its flags under it. A heartbeat failure during a plan update waits for the update and then stops what it drew, instead of the update starting a new Live on a disabled wrapper. After _disable, is_active is False, and start() does nothing while disabled.
    • RichProgressReporter.close() resets the plan, rows, slot count and printed plan lines even when Live never started.
  • Docs: a paragraph on the rich view in "Tune the run" in docs/tier3-live-evaluation.mdx, and the --progress row in docs/cli-reference.mdx. CHANGELOG entry under Unreleased > Fixed.

Why

On main the Rich table grows as the plan resolves and stages arrive, and long details wrap. With the input of test_rich_progress_frame_height_stays_fixed_as_plan_and_events_grow (one agent, the plan resolving, 10 stages with long details), the frame goes from 7 to 62 lines at 80 columns and from 7 to 128 lines at 60 columns. Redrawing a frame whose height changes, from two threads, can leave repeated or jumbled frames on screen.

A fixed frame has to cut long rows. At 80 columns that would hide most of the Run plan row, every agent's model after the first, failure reasons, and the second Ctrl+C hint, which docs/tier3-live-evaluation.mdx promises in the progress view. The plan lines above the frame, the final table and the hint-first detail keep all of that visible.

When a redraw fails on the heartbeat thread, the thread ends with an uncaught exception printed to stderr. SafeProgressReporter never hears about it: the reporter stays active, Live stays attached and elapsed times stop updating. A failure on the caller's thread was already handled, but through close(), which reports every running stage as failed and redraws, so a one-off write error left a frame saying the running agents had failed while the run went on.

Kept from public

Tests

  • tests/test_tier3_progress.py adds 23 tests (29 with parameters):
    • the frame keeps its line count when the plan resolves and 10 stages with long details arrive (80 columns), and at 20 columns with a long skill name
    • the frame does not shrink when the plan's agent list shrinks from 8 to 1
    • Live gets auto_refresh=False and no refresh_per_second; after 7 stages and an update to the first, the six most recent stages are shown and the oldest is not
    • a failed Live start leaves no plan, rows, extra slots or printed plan lines after close()
    • the full Agents / models, Provider and Run plan lines are printed above the frame when they change and not again when unchanged, while the frame keeps one height at 80 columns
    • the plan lines print ollama:llama:3.1-8b and custom:rocket:proxy as is
    • with the stage sequence of a run stopped by Ctrl+C and Agent Runtime Preflight in the frame, every stopping agent row shows the runner's hint at 80 and at 78 columns, and every agent's model and the plan values the frame cuts are printed above it (two agents, and mini-swe-agent alone)
    • the final frame lists every stage (9 stages after a 6-row window), wraps a failure reason the running frame cut at 80 columns, and shows an unresolved plan as not resolved with no pending, resolving or preparing
    • the final frame wraps details at 76 columns, where its Detail column is exactly 20 wide, and keeps each of its 7 rows on one line, cut with an ellipsis, at 75 and 60 columns
    • SafeProgressReporter is inactive after a failure on an emit() that follows a successful start
    • a redraw failure on the heartbeat thread disables the wrapper from that thread, stops Live once and detaches it; no frame says failed or interrupted, the last one still says running, the stop line is printed, and later events no longer reach Live
    • with a real Rich Live on a terminal that refuses writes with BlockingIOError (4 cases: the heartbeat thread's redraw only; every heartbeat write; every thread's writes until the heartbeat thread has ended, then none; the redraw and the notice but not the stop): progress turns off, the heartbeat thread ends, later events are not drawn, nothing says failed or interrupted, and nothing reaches threading.excepthook. After close() the last \x1b[?25h comes after the last \x1b[?25l and the stop notice is printed exactly once, on a line of its own: on time when only the redraw is refused, otherwise the late notice. When only the redraw is refused, the agent still shows running
    • the same refusals on the caller's thread (an update and the stop refused, or an update and the notice refused), with three warning lines printed after progress turned off: close() writes no cursor-up or erase-line control after them, ends with the late notice, shows the cursor when the stop was refused, and the notice is printed exactly once
    • a run-end close() on another thread while the heartbeat thread's refused stop is in progress (started the first time that thread releases the reporter lock after the stop): the cursor is shown and the late notice is printed once, and a second run on the same reporter prints no notice
    • a reporter started again without close() after a refused update and stop: the new run shows none of the refused frame and no notice, and ends with the cursor shown
    • a real Live whose hide-cursor write the terminal takes, but whose first frame and its own stop it refuses (2 cases: the notice refused too, or taken): after close() the cursor is shown and the notice is printed exactly once, on a line of its own, with no cursor-up control sent at close. When the notice is refused, no frame and no blank line appear before the late notice
    • an agent update that reaches the reporter while a failed display stops (run from another thread the first time the stopping thread releases the reporter lock) is drawn as running, and no frame says failed or interrupted
    • a heartbeat failure reported while a plan update is drawing waits for it, then stops that Live; no second Live is created
    • a reporter whose set_failure_callback raises, and a proxy whose attribute lookup raises, are wrapped and receive events
    • a plain reporter whose heartbeat raises, with no wrapper, stops its thread, becomes inactive and raises nothing through threading.excepthook
  • Changed tests: test_safe_reporter_disables_broken_presentation_without_raising also checks that start() on a disabled wrapper, and a start() that fails, leave it inactive. test_second_interrupt_forces_running_agents_to_stop checks the full stopping detail, which now starts with the hint. test_rich_reporter_immediately_starts_one_live_box_and_keeps_stage_updates_inside_it expects the plan lines above the box.
  • Fail-before: with src/ from main and this PR's tests, tests/test_tier3_progress.py has 31 failed and 145 passed. The 31 are 28 of the 29 new test cases and the 3 changed tests. The registration test passes on main, which registers no callback; it fails on this branch's first version.
  • Each fix from review also has a test that fails on the commit before it: the heartbeat writes refused with BlockingIOError (the heartbeat thread kept running), the late agent update (drawn as failed - interrupted before completion), the hint at 78 columns (cut to Ctrl+C again skips wa…), the plan lines (ollama🦙3.1-8b), the final frame at 75 columns (22 table lines instead of 7), the refused stop (5 of the 6 refused-write cases fail: the cursor stays hidden or no notice is printed; the redraw-only case passes there too), the run-end close race and replayed frames (6 failed, 168 passed: both caller-thread cases, where close() wrote 28 cursor-up controls over the warnings or sent the refused on-time notice; the race test, where the cursor stayed hidden; the restart test, which showed the refused frame; and the every-heartbeat-write and every-thread cases, where the late notice followed the frame's last line), and the refused first frame and stop (1 failed, 175 passed: with the notice refused too, the cursor stayed hidden).
  • tests/test_tier3_progress.py: 176 passed. It also passes under --cov with -n 4. The 21 tests matching heartbeat, safe_reporter, races, would_block, callers_write, plan_update, run_end_close, new_run_without_close or refused_first_frame passed 8 runs in a row with -W error::pytest.PytestUnhandledThreadExceptionWarning, and 3 more under --cov with -n 4.
  • tests/test_tier3_progress.py, tests/reporting/test_terminal_polish.py, tests/test_cli.py, tests/test_evaluation_service.py, tests/tier3/test_skip_with_skill.py, tests/test_ci_workflows.py, tests/test_oss_packaging.py, tests/test_ci_change_classifier.py, tests/test_benchmark_rollout_docs.py, tests/test_harbor_claude_refusal_fallback.py, tests/tier3/test_private_loose_source.py, tests/ci/test_image_build.py, tests/test_tier3_public_runtime.py, tests/test_accuracy_arithmetic.py and tests/test_harbor_runner_status.py: 1176 passed, 2 skipped.
  • tests/test_tier3_max_cases.py, tests/tier3/test_workflow.py and tests/reporting/: 1823 passed.
  • ruff check and ruff format --check are clean on the changed Python files, git diff --check is clean, and scripts/check_oss_boundary.py passed.

🤖 Generated with Claude Code

rng1995 and others added 16 commits November 6, 2026 22:51
The interactive Tier 3 progress table changed height as the plan resolved
and stages arrived: the Provider and Run plan rows appeared later, every
stage added a row, and long details wrapped. Rich also redrew it from its
own refresh thread at 8 Hz. Redraws of a frame whose height changes can
leave repeated or jumbled frames in the terminal.

- Always render the Provider and Run plan rows, with a placeholder until
  the plan resolves.
- Keep each row on one line: the title and every column end in an
  ellipsis instead of wrapping.
- Show the most recently updated stages in a fixed number of rows, at
  least six and at least one per agent, padded with blank rows. The slot
  count never shrinks.
- Create Live with auto_refresh=False, so redraws come only from progress
  events and heartbeats, which hold the reporter lock.
- Reset the plan, rows and slot count on close even when Live never
  started.

A redraw failure on the heartbeat thread used to end the thread with a
traceback and leave the reporter active. The heartbeat loop now catches
it and calls a failure callback; SafeProgressReporter registers its
disable hook there, which closes the reporter and stops the live view
while the run continues. Without a callback the loop stops. A disabled
SafeProgressReporter no longer reports itself active, and start() is a
no-op once it is disabled.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Explain in the Tier 3 guide how the rich progress view keeps its height,
which stages it shows and what happens when drawing fails, note the
fixed-height table in the CLI reference, and add an Unreleased / Fixed
CHANGELOG entry.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a redraw failed, SafeProgressReporter turned progress off through the
reporter's close(), which reports every running stage as "failed -
interrupted before completion" and redraws. A one-off write error on the
heartbeat thread therefore left a frame saying the running agents had
failed while the run went on, and progress stayed off.

- PlainProgressReporter and RichProgressReporter get close_after_failure(),
  which stops without marking running stages failed. The Rich reporter keeps
  the last frame and prints one line saying the display stopped and the run
  continues. SafeProgressReporter._disable uses it when the reporter has it.
- The heartbeat thread skips a redraw that fails with BlockingIOError or
  InterruptedError (a write that would block on a terminal another process
  made non-blocking) and draws again on the next heartbeat.
- A heartbeat failure while close() is already stopping the reporter no
  longer calls the failure callback.
- Rich progress lines are printed without Rich's number highlighting.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
SafeProgressReporter checked its disabled flag before calling the reporter,
but not atomically with the heartbeat thread's _disable(). A plan update
waiting on the reporter lock while a heartbeat redraw failed could pass the
check after the reporter was closed, and then start a new Live on a
disabled wrapper. That frame stayed on screen, with stdout and stderr
redirected through it, until the run's final close().

- start() holds a wrapper lock while the reporter draws the plan, and
  _disable() sets its flags under the same lock. A failure reported from the
  heartbeat thread waits for the plan update and then stops what it drew.
  The reporter is closed outside the lock, because closing joins the
  heartbeat thread.
- Registering the failure callback is now best effort. A caller-supplied
  reporter whose set_failure_callback raises, or whose attribute lookup
  raises, is wrapped as before instead of failing the evaluation.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fixed-height frame cuts each row with an ellipsis. At 80 columns that hid
most of the Run plan row (concurrency, max agents, timeout, matrix trials,
containers, the scaled agent timeout), every agent's model after the first,
and the second Ctrl+C hint, which only appears in a stopping agent's detail.
On main these rows wrapped and stayed visible.

- The Rich reporter prints the Agents / models, Provider and Run plan lines
  in full above the frame whenever one of them changes. They stay in the
  scrollback; the frame keeps its height.
- The stopping detail is now a runner constant that starts with a short hint,
  "Ctrl+C again skips wait", so the row cut at 80 columns still shows it with
  the longest built-in stage label in the frame.
- close() also clears the record of printed plan lines, so the next run
  prints its plan again.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Live is created with transient=False, so its last frame stays in the
scrollback. That frame kept the six-row recent window, so earlier outcomes
dropped out of the record (for example a failed first agent, or a degraded
Docker images stage). Its details were cut with an ellipsis, and a run that
failed before the plan resolved left "pending / resolving" rows behind, as if
work were still in progress.

- close() updates Live with a final table before stopping it. That table
  lists every stage without padding rows, wraps the Detail column in full,
  and shows unresolved Provider and Run plan rows as "- / not resolved".
- After a drawing failure, Live keeps the last frame it drew instead, since
  drawing the final table could fail the same way.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Align the CHANGELOG entry, the rich view paragraph in
docs/tier3-live-evaluation.mdx and the --progress row in
docs/cli-reference.mdx with the progress fixes: the full plan printed above
the table, the final table listing every stage in full, the Ctrl+C hint
shown first, a blocked heartbeat write skipped, and what a drawing failure
leaves on screen.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A heartbeat redraw that failed with BlockingIOError or InterruptedError
was skipped so that the next heartbeat could draw again. Rich does not
drop a refused frame: it keeps it in the heartbeat thread's buffer and
sends it again, from the start, before the next one. A terminal that
refuses writes for a while therefore gets a backlog that grows by one
frame per heartbeat, and once the backlog is larger than one write can
take, it never drains while the reporter stays active.

Treat these errors like any other drawing failure: call the failure
callback, which stops the live view without marking running stages
failed and says that the run continues. The heartbeat thread then ends,
and its buffer with it.

The test drives a real Rich Live on a terminal that refuses heartbeat
writes once or every time, and checks that progress turns off and the
heartbeat thread ends.

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

close_after_failure() cleared the running stages under the reporter lock,
released it, and then called close(), which takes the lock again and
marks every still-running stage "failed - interrupted before completion".
An agent update that took the lock in between put its stage back, and
that stage was then drawn as failed in the frame Live leaves on screen.

close() and close_after_failure() now share one _close(after_failure=...)
path that decides under the same lock hold whether to mark the running
stages. After a drawing failure nothing is marked, so a late update is
drawn as running.

The test runs the late update from another thread the first time the
stopping thread releases the reporter lock.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
At 80 columns, with Agent Runtime Preflight in the stage window, the
Detail cell is 24 characters wide and "Ctrl+C again skips wait" filled it
with no column to spare. At 79 columns, or on a legacy Windows console,
which uses one column less, the hint was already cut.

The stopping detail now starts with "2nd Ctrl+C skips wait", two
characters shorter, so it still shows at 78 columns. The 80-column test
also renders the frame at 78 columns, so a longer hint fails before it
reaches the edge.

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

The Agents / models, Provider and Run plan lines above the Rich progress
frame are printed in full so that values the frame cuts stay readable.
They went through console.print with markup and highlighting off but
emoji replacement on, so a model ID such as "ollama:llama:3.1-8b" was
printed as "ollama", a llama emoji and "3.1-8b". The table cells are Text
objects and were already verbatim.

Print the lines with emoji=False too.

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

The final Rich frame, which stays in the scrollback, folded its Detail
column so that each detail is shown in full. Stage, State and Elapsed do
not wrap, so in a 60-column terminal they left the Detail column 4
characters wide and every detail folded into a stack of 4-character
pieces: the emulated full run left a 252-line table, against 134 lines
on main.

Rich gives a ratio column whatever width the other columns leave and
ignores its min_width, so the final frame is now drawn at render time:
it wraps its details only when the width it is drawn at leaves the
Detail column at least 20 columns wide, and otherwise keeps each row on
one line as while running. The emulated 60-column run now leaves 35
lines; at 80 columns and wider nothing changes.

The test renders the final frame at 76 columns, where the Detail column
is exactly 20 wide, and at 75 and 60 columns.

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

The entry sat at the end of Unreleased > Fixed, where open PRs #367 and
#386 also add their entries, so each of them conflicted with this
branch. It now sits in the middle of the same Fixed list, which no open
PR changes. The text is unchanged.

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

A terminal that refuses a heartbeat redraw (a write that would block)
usually refuses the stop that follows a few microseconds later on the
same thread. Rich then loses the queued show-cursor control with that
thread's buffer, the stop notice is skipped, and close() finds no Live
to stop, so the cursor stayed hidden after the run.

close_after_failure() now records when Live's stop or the notice under
the last frame was refused, with the thread it ran on. The run's final
close() then shows the cursor with Console.show_cursor(True) and prints
"...; the run went on without it." A notice that was refused on the
closing thread itself is not printed again: Rich still holds it for
that thread and sends it with the cursor write.

The refused-write test gains a terminal that refuses every thread's
writes until the heartbeat thread has ended, a case that refuses only
the notice, and the cursor and single-notice checks after close(). A
new test covers the same refusals on the caller's thread.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two gaps in how the run's close() finished a stop the terminal refused
after a drawing failure:

- The heartbeat thread recorded a refused stop, or a refused notice, in
  a second lock hold after the one that stopped Live, and wrote the
  notice outside the lock. A run-end close() that took the lock in
  between found no Live to stop and no record, so the cursor stayed
  hidden, and the record then reached the next run's close(), which
  printed the late notice in a healthy run. The stop, the notice and
  the record now share one lock hold, so close() either stops Live
  itself or finds the record. start() of a new run also drops a record
  left by a run that was never closed.
- close() showed the cursor through the same Rich console, which first
  sent everything that console held for the closing thread from refused
  writes: the refused frame and Live's stop, each led by cursor-up and
  erase-line controls sized to the frame on screen when drawing failed.
  Lines printed since then, such as logged warnings, were erased and
  overwritten. close() now drops that held output first, shows the
  cursor and ends the frame's last line when the stop was refused, and
  prints the late notice whenever the notice did not reach the
  terminal, so a refused notice is no longer sent as the on-time "the
  run continues" line at the end of the run.

Tests: the caller-thread refusal cases now print warnings before close()
and check that close() writes no cursor-up or erase-line control and
ends with the late notice. A new test closes the run from another
thread while the heartbeat thread's refused stop is in progress, and
another starts a reporter again without close() after a refused stop.
The stop-notice check also requires the notice on a line of its own.

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

Rich's Live.start() stops Live itself when its first frame fails, then
raises. When the terminal refused that stop as well, the write that shows
the cursor again stayed in the caller's Rich buffer. The stop that follows
the drawing failure then had nothing left to do and raised nothing, so the
record said the stop went through, and close() dropped the held write
without showing the cursor.

close() now also shows the cursor when the refused output it drops holds
that write. No frame reached the terminal then, so it ends no line.

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.

Reviewed the full production diff, callers, report/runner contracts and affected regression coverage; no actionable findings. Existing CI on reviewed head 406de3a: 20 successful checks, 2 skipped; no failed or pending checks. Fresh merge-tree verification against current main ce52a09 succeeds without conflicts. No code changes or local test rerun were needed.

Signed-off-by: Narendran Raghavan <[email protected]>

# Conflicts:
#	CHANGELOG.md

@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.

Resolved the new CHANGELOG conflict with main a0b65a9, preserving the progress-frame entry and the landed N/A-display entry. Focused frame, heartbeat, drawing-failure and cancellation coverage passed 23 tests; make lint and pinned Fern check passed. Fresh live-head and latest-main merge-tree checks passed before the normal fast-forward push. Final head bc0cc79.

@rng1995
rng1995 merged commit 3ef5fad into main Nov 12, 2026
27 checks passed
@rng1995
rng1995 deleted the naren/port-tier3-progress-rendering branch November 12, 2026 19:55
rng1995 added a commit that referenced this pull request Nov 12, 2026
Brings in main through b38b71b (#416, #417, #420, #422, #423, #428,
#429, #467). Merged without conflicts; CHANGELOG, docs, decoys.py and
eval_core/checks.py auto-merged with both sides' edits in separate hunks.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995 added a commit that referenced this pull request Nov 14, 2026
…p the running spinner moving (#548)

* fix(tier3): say progress stopped when a plan line is refused before the 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]>

* fix(tier3): keep the running spinner moving between redraws

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]>

* fix(tier3): move the running spinner one frame per redraw

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]>

* docs(changelog): note the Tier 3 progress plan-line and spinner fixes

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

* fix(tier3): print a refused plan line once on a buffered terminal stream

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]>

* fix(tier3): drop progress output still refused when the run ends

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]>

* fix(tier3): hold the progress stop notice while the terminal is still 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]>

* docs(changelog): note the one stop notice and dropped refused output

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]>

* fix(tier3): drop refused progress output at the end of every run

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]>

* docs(changelog): note that a refused final progress table is dropped

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

* docs(changelog): say standard error can still send refused progress output

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]>

* docs(tier3): say standard error can still send refused progress output

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]>

* docs(tier3): say the view drops refused output when any run ends

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]>

* test(tier3): find the progress CHANGELOG entry wherever it sits

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]>

* fix(tier3): print the late stop notice when the cursor write is refused

_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]>

* docs(changelog): drop the extra blank line after the progress entry

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]>

* test(tier3): accept a refused frame cut inside a character in the late 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]>

* fix(tier3): print one stop notice when the stream keeps a refused notice

_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]>

* test(tier3): pin that a notice after a refused first frame is not taken 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]>

* docs(tier3): say that standard error sends a refused notice it kept

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]>

* fix(tier3): start the late stop notice on its own line after a refused 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]>

* docs(tier3): say the late notice is kept only while the stream's buffer 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]>

* test(tier3): clear TTY_INTERACTIVE so the forced-terminal progress tests 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]>

---------

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