Skip to content

fix(installer): keep download progress inside the terminal (ROCMAI-770) - #847

Merged
johnl-amd merged 9 commits into
mainfrom
ROCMAI-770-installer-progress-display
Nov 17, 2026
Merged

johnl-amd merged 9 commits into
mainfrom
ROCMAI-770-installer-progress-display

Conversation

@johnl-amd

@johnl-amd johnl-amd commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • install.sh measures the terminal itself (stty size on fd 2) and passes that width to curl, reserving the final column, so a COLUMNS inherited from a wider window can no longer make the progress bar overrun the right margin and wrap.
  • A terminal too narrow to size a bar now says so instead of downloading in silence.
  • wget's interactive branch moves from --show-progress to -nv --show-progress: the request logging goes, the bar stays, and a failure still reports its own reason.
  • Three @lifecycle scenarios cover the width fix, the narrow-terminal path and the wget fallback.

Risk: low. The change is confined to how fetch() draws progress; the download, checksum and signature paths are untouched.

Root cause

curl takes its bar width from COLUMNS in preference to asking the terminal. Resizing a window after the shell starts leaves that value too large, so every refresh ran past the right margin and wrapped. The carriage return ending each frame then returned to the start of the wrapped row rather than the bar's, so each redraw painted one row lower and a single download arrived as a stack of partial bars with its percentage torn across two rows.

Changed since the first round of review

Thanks for the reproductions, they found a real hole and two regressions.

  • The percentage assertion could not fail on this bug, and is now rewritten. It read the raw pty byte stream, where an over-wide bar arrives as one intact frame with a whole 100.0% in it; the tearing only exists once a terminal has drawn the bytes. It now renders the capture through vt100 and asserts on physical rows. Note for anyone reusing this: screen().contents() stitches a wrapped row back onto its parent and reports a 96-column line on an 80-column screen, so it hides exactly this. rows() is what works. The scenario now fails on the unfixed script with 11 progress rows where three downloads should leave three.
  • Redirect pre-resolution is dropped. It shortened the bouncing bar from roughly three frames to one, which is small because most of that wait is curl connecting rather than following hops, and it cost a HEAD per asset including both sidecars. It also never fell back as its own comment claimed: curl prints url_effective even when the probe fails, so the original URL was never restored. Removing it leaves the width fix, which is where the reported stacking came from, and that is fully covered by a test.
  • 0×0 terminals no longer lose their bar. A pty whose size was never set reports 0 0, which was taken as a measured width and suppressed the bar where curl had previously drawn one at its own default. Treated as unmeasured now.
  • The tput fallback read the wrong descriptor. It sizes from its own stdin, which is the pipe under curl ... | sh, so it returned ncurses' 80-column default instead of the terminal. It reads fd 2 now, like the stty call beside it.
  • A zero-padded COLUMNS crashed dash. 080 passes a digit check but is an octal literal to POSIX arithmetic. Leading zeros are stripped by hand; 10# would have been a worse fix, since it is not POSIX and dash rejects it too.
  • loopback_http.rs's doc comment no longer claims to serve only the Windows scenario.
  • The Windows build was broken and is fixed. path_shadowing_out called std::os::unix::fs::symlink, which has no Windows counterpart, and the Windows lifecycle lanes compile this target even though every scenario reaching it is @requires-os:linux. The one call with no portable spelling is now behind #[cfg(unix)], verified by compiling the construct for x86_64-pc-windows-msvc as well as the host.

Still true and deliberate: curl draws a frame or two of its bouncing bar while waiting for response headers. That is unavoidable from here, and it now redraws in place on one row.

Changed since the second round of review

  • Three claimed behaviours had no test that could fail. Each sits behind the width-measurement chain, so a pty with a real size never reached it. lifecycle-35 now pipes the installer into a shell (the shape it ships in: stdin a pipe, only stderr a terminal), which is the whole reason the width is read from fd 2; deleting that redirection previously kept every scenario green. lifecycle-36 stands in a stty shim reporting 0 0. lifecycle-37 hides stty and tput so the COLUMNS fallback is actually consulted. Each was confirmed to fail with its own fix reverted.
  • Those scenarios run at 100 columns rather than 80 on purpose: ncurses answers 80 when it cannot read a terminal, so at this suite's usual width a wrong measurement is indistinguishable from a right one.
  • The merge with main renumbered this PR's scenarios (38 onward as of the latest merge, main having since taken 32 to 37) and routed the narrow-terminal notice through feat(install): prettier progress output + completion banner #207's info(). It also made the test's progress-output matching load-bearing: feat(install): prettier progress output + completion banner #207's get-started block prints rocm install sdk # ..., which the old "any #" match counted as a bar.
  • Assertions now read the width the run actually used instead of a module constant, and docs/testing.md names the new coverage.

Before / after

80-column terminal with COLUMNS=96, rendered from the installer's own byte stream. Before, 32 rows for three downloads:

#=#=-#
##O#-  #
#=#=-#  #
-#O#- #   #
#
####
########
...
################################################################################
######### 100.0%

After, 3 rows:

######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%

Test plan

The three scenarios run in the Linux "Acceptance install lifecycle" step of the build-and-test job, which sets E2E_INCLUDE_LIFECYCLE=1. They are tagged @requires-os:linux, so the Windows lifecycle lanes skip them.

E2E_INCLUDE_LIFECYCLE=1 E2E_ONLY_LIFECYCLE=1 cargo xtask e2e

Each was confirmed to fail with the behaviour it covers reverted: the width scenario against the unfixed script, the narrow-terminal one with the notice removed, and the wget one with -nv reverted to plain --show-progress.

The wget scenario shadows curl out of PATH with a directory of symlinks rather than dropping PATH entries, because curl shares /usr/bin with sh, tar, awk and everything else the run needs. It requires wget on the host and says so if it is missing.

Manually, in a real terminal (the bar is only drawn when stderr is a tty, so a piped run takes the quiet path and shows nothing either way):

COLUMNS=96 ROCM_CLI_INSTALL_DIR=/tmp/p/bin ROCM_CLI_CONFIG_DIR=/tmp/p/cfg \
  ROCM_CLI_UPDATE_SHELL_PATH=0 sh install.sh nightly

Known conflict

PR #207 adds lifecycle-28 through lifecycle-31 to this same feature file. The suite enforces sequential per-feature numbering in declaration order, so the numbers cannot be moved out of the way in advance; whichever PR merges second renumbers. Both also touch install.sh and lifecycle_steps.rs.


  • Searched tests/e2e-cucumber/expectations.toml for the fixed ticket ID; no xfail rows reference it or the installer's progress output.
  • N/A — no new subcommand or subsystem.
  • The one new user-facing message (the narrow-terminal notice) is asserted by lifecycle-33 together with the state it describes: the notice is present and no bar was drawn.

curl takes its progress-bar width from COLUMNS in preference to asking
the terminal, so a value inherited from a wider window -- what a shell
leaves behind when its terminal is resized after it starts -- made every
refresh run past the right margin and wrap. The carriage return ending
each frame then landed a row below the bar, so a single download painted
a stack of partial bars with a percentage torn across two rows instead
of one bar updating in place.

Measure the terminal and pass that width down, reserving the last column
so the line stays clear of the margin. Resolve the download URL up front
as well: release assets redirect to a signed host and the redirect
responses carry no Content-Length, so curl drew its unknown-size
"bouncing" bar for every hop before the real one began.

wget's branch had a smaller version of the same problem: --show-progress
without -q interleaves the bar with request logging.

Covered by lifecycle-28, which drives the installer under a pseudo-
terminal narrower than COLUMNS and fails on the unfixed script with all
seven progress frames reaching or exceeding the terminal width.

Signed-off-by: John Lybeck <john.lybeck@amd.com>
@johnl-amd
johnl-amd requested a review from a team as a code owner November 3, 2026 07:24

@jussielo-amd jussielo-amd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for tracking this down. The root-cause write-up is clear, and I could reproduce both the bug and the fix. Reviewed at 5dd0add.

Reproduction. I ran main's install.sh and this PR's side by side in a real terminal (tmux, 80x24, COLUMNS=96) against a throttled loopback release server with a fake bundle. On main the screen ends up with 35 stacked partial bars and two torn ######### 100.0% rows. With this PR each download is a single 79-column bar ending in a whole 100.0%. It also holds with COLUMNS unset and in a 22-column pane. Over a redirecting route the PR is clean, while main shows the bouncing-bar fragments. Part of that main behaviour comes from my test server (a 302 with no Content-Length), so I'd treat it as illustrative, not as proof of a production hang. When the server rejects HEAD, resolve_download_url falls back to the original URL and the download still works. So the fix does what the description says. My findings below are about what the tests prove, plus one regression.

Blocking

  1. then_percentage_not_split can't fail on this bug (lifecycle_steps.rs, and the matching step in install_lifecycle.feature). run_installer_pty reads the pty master with read_to_end and never renders the bytes. Wrapping happens only when a terminal emulator draws an over-wide line, so the raw stream from the unfixed script is still one over-wide frame per redraw. 100.0% stays whole in it, so completed >= 1 passes. No \r/\n-delimited segment can equal 0% or .0%, so the orphan loop passes too. The torn ######### 100.0% rows I saw on main exist only after the stream is rendered. The step text says "each completed download", but the code checks >= 1, and the PR body says the scenario asserts an unsplit percentage. I haven't run the scenario with the fix reverted, so this comes from reading the code and from what the rendered screens showed. The suite already has what's needed: tui_driver.rs spawns under portable-pty, parses into a vt100 grid and asserts on the visible screen, and paced_download.rs exists because a plain ServeDir finishes too fast to observe intermediate frames. Feeding the pty bytes into a vt100::Parser sized PTY_ROWS x PTY_COLS and asserting on the screen would cover both the width and the percentage claims, for example exactly one 100.0% row per download and no row ending mid-number. Otherwise I'd drop the step and the claim.

  2. The URL pre-resolution and the wget change have no test, and the scenario title says "one progress bar". The loopback server is a plain ServeDir with no redirect, so resolve_download_url returns its input and the scenario can't tell whether it exists. Replacing it with printf '%s\n' "$1" should leave all three Then-steps green, though I haven't run that mutation. In my runs the function does matter: over a redirect, main shows bouncing fragments and the PR draws clean bars. wget is never exercised because the runner has curl. Could you add a redirecting route to the loopback router (3xx with no Content-Length, target serves the bundle) and assert on the rendered screen? Otherwise please narrow the scenario title and say in the PR body that redirect resolution and wget are manually verified only. The body should also name the lane that runs this scenario, which is the Linux "Acceptance install lifecycle" step in build-and-test.

Non-blocking

  1. A terminal that reports size 0x0 now downloads with no progress at all (install.sh, progress_bar_width). stty size prints 0 0, so width="0" is non-empty and the tput and COLUMNS fallbacks never run. The -le 21 test then returns empty and fetch takes the quiet path. I checked this by running the extracted function under a pty with its size set to 0x0: the result is empty, even with COLUMNS=120, while tput cols on the same pty returns 80. Before this change curl still drew a bar there. Unsized ptys are common, for example docker run -t without a resize. Treating 0 as unmeasured, e.g. case "${width}" in ""|0) width="" ;; esac right after the stty call, restores the fallback chain. The e2e matrix covers only the stale-COLUMNS row, so tests for the other states would be worthwhile (see follow-ups).

  2. At 21 columns or fewer the download is silent and nothing says why (observed at 20 columns). One line such as "terminal too narrow for a progress bar, downloading quietly" would help.

  3. wget -q drops wget's own error text in interactive runs. After a 404 or DNS failure the user sees only failed to download <url>, whereas the curl branch keeps curl's error line. -nv may keep errors while still dropping the request chatter. I haven't tested that.

  4. Heads-up on a collision: open PR #207 also adds a scenario numbered lifecycle-28 to install_lifecycle.feature (it adds lifecycle-28 through lifecycle-31, a different scenario). Whichever lands second will need to renumber. Both PRs also edit install.sh, lifecycle_steps.rs and docs/testing.md, so expect conflicts there. #207's base is older than main, so I haven't checked whether it conflicts today.

For you to decide

  • The HEAD probe adds one request per download, two over a redirect, including the tiny checksum and signature files. I saw 6 HEADs for 3 GETs on the redirecting route. As the PR body notes, a frame or two of the bouncing bar still appears while curl waits for headers, so the gain is smaller than the code suggests. If a HEAD fails at a later redirect hop with -f, %{url_effective} is probably that hop's URL, which is then used for the GET, so "falls back to the original URL" isn't exactly what happens. I couldn't pin that down.
  • An alternative to measuring in shell is launching curl with COLUMNS unset so it asks the terminal itself. That would drop most of progress_bar_width. I couldn't check whether curl reserves the last column on that path.

Follow-ups, for separate issues rather than this PR. I searched the repo's issues and PRs, and the search is lossy, so "not found" means not found by keyword.

  • A shared helper that runs a script under a pty and returns the rendered screen, for installer scenarios. #368 (closed) did this for the download spinner and proposed reusing tui_driver.rs, but no open issue covers install.sh. This would also unblock finding 1.
  • Shell-level tests for installer helpers such as progress_bar_width (sourced under pty sizes 0x0, 21, 22, and with stty/tput missing). I found no issue. #572 mentions that the installers stay shell but not testing them.
  • A question for the owners: the comment above the pinned keys says release-channel installs always verify, but because the pinned key is always resolved, [ -n "${public_keys}" ] also forces a .sig fetch on nightly and custom channels. Is that intended? I couldn't find an issue. #830 (draft) hardens the pinned-key CI check and doesn't touch channel policy.
  • The archive, checksum and signature downloads all draw identical, unlabelled bars. #207 adds ==> step markers to both installers and doesn't touch the curl invocation, so a "Downloading archive" label might fit there.

Not covered. My sandbox runs all stopped at the .sig fetch (404), so I never saw an install complete or the end-of-install screen. I also did not run the PR's e2e scenario, so the revert and mutation points above come from reading the code and from rendered runs. CI looked green at the time I checked, apart from lanes still queued.

@nowycondro nowycondro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Automated review (Claude Code) · 5dd0add

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change (base 6eeec620…head 5dd0adde). Implements the fix for ROCMAI-770 ("Installer: download progress bars render garbled in the terminal"); the ticket (status: In Progress) is otherwise unrelated to any other open work, and the change is scoped to exactly that bug.

Blocking

  • progress_bar_width() treats an unmeasured (0×0) terminal as "measured and very narrow," silently suppressing the bar where curl previously drew one — install.sh:52-73 (the stty size branch at line 55 through the <= 21 check at line 70). stty size on a pty whose window size was never set (common for a freshly-opened pty under some container/detached-pty setups, e.g. docker run -t before any resize) prints 0 0 with exit 0, so width="0", which is non-empty and passes the digit check, so the tput/COLUMNS fallbacks never run and [ 0 -le 21 ] suppresses the bar entirely. Verified directly: I opened a pty with TIOCSWINSZ set to all zeros and ran the extracted progress_bar_width() body under it — it returned empty. I then ran real curl -fL --progress-bar against the same 0×0 pty with no COLUMNS override (the pre-PR behavior) and it drew a normal bar at its own ~80-column default. So this is a genuine regression for that case, not present on main. Fix: treat width of 0 the same as empty before the digit/threshold checks, so it falls through to tput/COLUMNS/default instead of short-circuiting.
    Confidence 95 · logic

  • The tput fallback measures the wrong file descriptor — install.sh:57-61. The function's whole premise is measuring fd 2 (stderr), matching fetch()'s [ -t 2 ] gate (stty size <&2 does this correctly at line 55). But tput cols sizes from fd 0, not fd 2 or fd 1. In the installer's primary intended invocation (curl ... | sh), fd 0 is the pipe from curl, not the user's terminal, while fd 2 is the real tty. Confirmed empirically with an fd-swap pty harness: with a 100-column pty on fd 2 and a non-tty on fd 0, tput cols returns ncurses' 80-column default every time; moving the same pty onto fd 0 makes it correctly report 100. This only fires when stty is absent/fails (narrow trigger — stty is near-universal on Linux), but when it does, it silently reintroduces exactly the "wrong/stale width" class of bug this PR exists to remove. Fix: tput cols <&2 or an equivalent fd redirection so the fallback measures the same descriptor the rest of the function does.
    Confidence 85 · logic

  • resolve_download_url() can return a URL already known to be broken, instead of falling back to the original — install.sh:84-91, specifically the fallback condition at line 86 (if [ -n "${resolved}" ]). The comment says the probe is best-effort and falls back to the original URL "if it fails," but the code only checks whether curl -w '%{url_effective}' produced some text, not whether the HEAD actually succeeded. Verified against a real GitHub release-asset URL that returned a non-2xx at the final redirect hop: curl exited non-zero (-f triggered, exit 22) but still printed url_effective for the failing hop. That value is non-empty, so resolve_download_url returns it, and the subsequent real curl -fL download is then handed a URL that is already a dead end — with no further redirects left to retry — rather than falling back to the original URL and re-walking the chain fresh, which might succeed. DNS/connect-level failures are unaffected (those echo the original URL). This matters more given the script's ROCM_CLI_DOWNLOAD_BASE override for mirrors, which are more likely than github.com to misbehave on HEAD. Fix: check curl's own exit status (or %{http_code}) from the probe, not just whether it printed something.
    Confidence 85 · logic

  • The new then_percentage_not_split assertion cannot detect the bug it's named for, and the Gherkin step it backs ("each completed download reports its percentage on one row") is unproven — tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:1817-1843, built on progress_frames at lifecycle_steps.rs:1748-1753. run_installer_pty (line 1675) captures the raw, unrendered pty byte stream via read_to_end. Terminal line-wrapping (what visually tears a percentage across two rows) is performed by a terminal emulator rendering bytes it receives — curl itself writes one continuous line with no extra \r/\n inserted just because it exceeds some nominal width, and the kernel pty doesn't insert any either. I reproduced this directly (and a second, independent review pass reproduced it separately): running a real curl --progress-bar against a local file under an 80-column pty with a stale COLUMNS=96 (i.e. exactly what the unfixed script would do) produces a single intact ...100.0% frame 96 characters wide — never split, never leaving an orphaned "0%"/".0%" on its own row. The same holds with COLUMNS=79 (the fixed behavior). Both "bug present" and "bug fixed" pass this assertion identically, so it provides no discriminating signal; it can only fail for an unrelated reason (e.g. a crash before completion). Its sibling assertion in the same Then-step, then_progress_fits_terminal (lifecycle_steps.rs:1783-1816, checking raw frame width >= 80), is a sound, verified proxy for the real bug — I confirmed it actually fails against the unfixed behavior and passes against the fixed behavior — so the scenario as a whole is not worthless, but the percentage-specific claim in its name and comments is not backed by what the code checks.
    Confidence 90 · logic · Fix: either drop then_percentage_not_split's unprovable claim, or feed the captured bytes through a real terminal emulator (e.g. a vt100-style grid sized PTY_ROWS×PTY_COLS) and assert on the rendered screen instead of the raw stream.

  • resolve_download_url — the redirect-resolution half of this fix — has no automated coverage — tests/e2e-cucumber/src/loopback_http.rs:47-48. LoopbackServer is tower_http::ServeDir, which always answers 200 directly; no scenario in the suite exercises an HTTP redirect (confirmed by reading the file and searching the suite for redirect handling). So lifecycle-28 can only ever exercise resolve_download_url's no-op path (resolve succeeds trivially, same URL in/out); the behavior it exists to fix — the "bouncing" bar during a redirect chain — is validated only by the author's manual testing claimed in the PR body, not by the new e2e scenario, despite the PR body's "verified ... over the loopback fixture" phrasing reading as if that fixture covers it too.
    Confidence 80 · architectural · Fix: add a redirecting route to the loopback router (3xx, no Content-Length, pointing at the real file) and assert the rendered bar stays single-frame; or narrow the PR text to say this element is manually-verified only.

  • A CI check is currently red at this commit, for an unrelated scenario — E2E tests (Strix Halo, Windows, current) (job 125783667347, workflow run 41596063720) failed with 'runtime-resolve-canonical-release' was expected to pass on this host but FAILED — a regression. That scenario concerns pip-index/wheel-runtime resolution, not the installer or progress bars, and runs on a self-hosted hardware lane separate from the required build-and-test/E2E tests (GitHub-hosted) jobs, which are green. It is very likely a pre-existing/environmental flake unconnected to this diff, but per this review's own rule a red check is flagged regardless — worth a rerun or maintainer sign-off before merge so it isn't mistaken for a non-issue.
    Confidence 85 · architectural

Non-blocking

  • A COLUMNS value with a leading zero crashes the arithmetic fallback — install.sh:66-73. The digit-only validation (*[!0-9]*) accepts 080 as valid, but $((width - 1)) is POSIX arithmetic expansion, which treats a leading-zero literal as octal; dash (the default /bin/sh on Debian/Ubuntu) hard-errors ("Illegal number: 080") before any download runs. Reproduced directly under dash with stty/tput both unavailable and COLUMNS=080 set. Real-world trigger requires that specific stacked combination (no stty, no tput, and a zero-padded COLUMNS), so it's narrow, but it is a genuine crash rather than a degraded-but-working fallback.
    Confidence 80 · mechanical · Fix: strip leading zeros, or force base-10 ($((10#${width} - 1))).

  • Scenario-ID collision with another open PR — tests/e2e-cucumber/features/install_lifecycle.feature:361 adds lifecycle-28. Open PR #207 (base predates current main) independently adds lifecycle-28 through lifecycle-31 to the same feature file, and also touches install.sh and lifecycle_steps.rs. Whichever PR merges second will need to renumber and will likely conflict on these same files. Not a defect in this PR by itself, but worth flagging now rather than at merge time.
    Confidence 85 · mechanical

Decisions for the author

  • One HEAD request per asset is added whenever a progress bar would be drawn — tradeoff. resolve_download_url runs inside fetch()'s interactive branch (install.sh:97-113), so every call — including the small checksum and signature sidecar fetches, which don't need redirect pre-resolution to render a clean bar — pays one extra HTTPS round trip (two, over an actual redirect). The PR body already acknowledges this as a deliberate best-effort cost; confirm it's intentional for the sidecar files too, or scope the pre-resolution to the archive download only.

Positive signals

  • The <= 21 / width - 1 threshold is exactly tuned to curl's own behavior: I verified empirically that curl ignores COLUMNS of 20 or below (falling back to its own default) and honors 21 and up, so the script never hands curl a value curl would silently ignore.
  • Using a real PTY (portable_pty) rather than a plain pipe for lifecycle-28 is the right call for a TTY-gated code path — a piped harness would never reach the bar-drawing branch at all, as the PR's own comments note.
  • The code comments in progress_bar_width/resolve_download_url explain why, not just what (the COLUMNS='' blanking for tput, the reserved column), which made this review faster.

Deployment notes

  • Purely a script-behavior change (TTY-gated); no state, config, or protocol migration involved.
  • Interactive installs now make 1-2 extra HTTPS requests per downloaded asset (see tradeoff above) — negligible bandwidth, small latency add, worth knowing if install telemetry/timing is watched.
  • See the CI finding above: confirm the Strix Halo Windows hardware-lane failure is unrelated before relying on "CI is green" as a merge signal.

What this covered

Read completely: install.sh (both before and after, full file), tests/e2e-cucumber/features/install_lifecycle.feature (new scenario plus surrounding context), tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs (all new code plus ~100 lines of surrounding E2eWorld/state-plumbing context), tests/e2e-cucumber/src/loopback_http.rs (full file), AGENTS.md (full), relevant sections of docs/testing.md and .github/workflows/ci.yml/e2e-selfhosted.yml. Reviewed against commits 6eeec620…5dd0adde; re-checked the PR head immediately before publishing and it had not moved.

Fan-out: two independent workers reviewed, respectively, install.sh and the new test code, each blind to this report and to each other; both ran their own empirical pty/curl reproductions rather than reasoning from the diff alone, and their findings are folded in above (several independently cross-confirmed my own reproductions of the same bugs).

Did not run: the full cargo xtask e2e / cargo test --workspace gate locally (not attempted in this environment, given sandbox weight; relied on direct reproduction of the specific extracted logic instead, each cited inline). History/prior-changes passes found nothing to add — this is a single, newly-authored commit with no prior review rounds visible to this pass by design (see below).

One process note on independence: this review's required duplicate-review check (listing existing PR reviews to confirm none is already mine) returned the full body of the existing maintainer review via the GitHub API, which has no field-filtering option — this could not be avoided from this side. No finding above was sourced from or anchored to that text; everything here was independently (re-)derived from the code and, where marked, confirmed by direct execution. Where a finding's substance overlaps with that review, it does so because the same defect is independently reachable from the code, not because it was read there first. Not reconciled against that review's content, or any other discussion thread, here.


🤖 Generated with Claude Code

@tomastola tomastola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔴 Automated review · pr-review-watcher · 5dd0add

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change.
Fixes progress-bar wrapping in the installer (ROCMAI-770). The ticket itself could not be retrieved for this review, so whether it asks for anything beyond this was not checked.

The width fix in install.sh works: measured in an 80×24 pty with COLUMNS=96, curl's frames go from 90–96 columns to 79, under both sh and dash. The blocking issues are in the test, and in the new redirect probe, which barely helps and has no test.

Blocking

  • The step "each completed download reports its percentage on one row" passes with the fix reverted — tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:1820-1843, tests/e2e-cucumber/features/install_lifecycle.feature:367
    The step looks for two things in the raw bytes from the pty: a frame containing 100.0%, and no row that is just 0% or .0%.

    • Why it can't fail: wrapping happens in the terminal emulator. A wrapped bar adds no \r or \n to the byte stream, so the "stray tail" this step looks for can never appear in the raw bytes.
    • Run: the old curl call (COLUMNS=96 curl -fL --progress-bar) in an 80×24 pty drew frames 90–96 characters wide, one of them contained 100.0%, and no row was a bare 0% or .0%. Both assertions pass with the bug present.
    • Also: the step's name says "each" download, but it only checks completed >= 1.
    • Rule broken: AGENTS.md §3, "A new test is shown to fail when the code it covers is broken."

    Confidence 100 · logic · Fix: feed the bytes through vt100::Parser::new(PTY_ROWS, PTY_COLS, 0) (the e2e crate already uses it for TUI tests) and assert exactly one progress row per download on the rendered screen. Otherwise, delete the step.

  • New installer behaviour that no test exercises — install.sh:84-91 and :104 (redirect probe), install.sh:70-72 (terminal too narrow, quiet download), install.sh:57-62 (tput fallback), install.sh:120 (wget -q)

    • Redirect probe: lifecycle-28's LoopbackServer serves files directly, with no redirects, so resolve_download_url hands back its input unchanged. Replacing the call with "${url}" would leave the test green.
    • Other branches: the test uses an 80-column pty on a host with stty and curl. It never reaches the 21-column cutoff, the tput path or the wget branch.
    • What the test does catch: the "stays within the terminal" step fails without the fix — it sees 96-column frames on the old code, and 80-column frames if the - 1 is dropped.
    • Rule broken: AGENTS.md §3 (and checklist item 14): new behaviour covered by a test that fails when it breaks.

    Confidence 85 · logic · Fix:

    • Redirect probe: add a 302 route to the loopback server and assert something about the redirected download — or drop the probe entirely (see Decisions for the author), which removes most of this finding.
    • Narrow terminal: add a pty narrower than 22 columns and assert no progress frames.
    • wget: add a case that takes curl off PATH, the way path_without_openssl already takes openssl off it.

Non-blocking

  • CI is not green on 5dd0add, but the red is not this PR's — E2E tests (Strix Halo, Windows, current) failed in serve scenarios ("no 'resolved model' in output") after HTTP 404s fetching upstream lemonade-sdk/llama.cpp release zips. The same job fails the same way on main (the two most recent main runs today), so it is not caused by this change. The Strix Halo Ubuntu lanes were cancelled at their 45-minute timeout, and W7900 / MI300X were still queued when this was written.
    Confidence 100 · logic · Fix: none in this PR; re-run once the upstream asset or the lane is fixed.

  • The fallback that both the probe's comment and the PR description promise doesn't happen — install.sh:82-83, 85-90

    • Claim: if the probe fails, the original URL is used.
    • What happens: curl prints %{url_effective} even when the request fails — a 404 returns the same URL, a refused connection returns http://127.0.0.1:1/x. So resolved is never empty and the else branch can't run.
    • Consequence: if a later redirect hop rejects HEAD, the GET goes to that hop's URL instead of starting from the original.
    • Which to change: the code, to match the documented intent, which is the safer behaviour.

    Confidence 100 · logic · Fix: if resolved="$(curl -fsSIL … )" && [ -n "$resolved" ]; then …; else printf '%s\n' "$1"; fi

  • The probe's comment claims more than it does — install.sh:81, "Resolving first means the bar starts at a percentage of a known size."
    Downloading the real v0.2.1 asset from GitHub in an 80-column pty: 3 bouncing frames (#=#=#, ##O#-#, ##O=# #) without the probe, 1 (#=#=#) with it. The PR description is right ("curl still draws a frame or two of the bouncing bar"); the comment should say the same.
    Confidence 100 · mechanical · Fix: reword the comment.

  • A doc comment this change made out of date — tests/e2e-cucumber/src/loopback_http.rs:33-34 says the server exists "for the Windows native-HTTP install scenario"; it now also backs lifecycle-28 on Linux.
    Confidence 70 · mechanical · Fix: "for the install lifecycle scenarios".

Decisions for the author

  • Whether to keep the redirect probe at all — non-blocking-improvement
    • Cost: an extra HEAD request (following redirects) before every interactive download, plus an untested branch and the fallback bug above.
    • Benefit: bouncing frames go from 3 to 1 on a real GitHub download.
    • Why that's small: with the width fix, those frames already redraw in place on one row. The stacked bars in the report came from the width, and the width fix alone solves that.
    • Suggestion: dropping resolve_download_url makes the change smaller and fully covered by the width test. Keeping it is fine if the fallback is fixed and the test gains a redirect route.

Positive signals

  • stty size <&2 measures the terminal through stderr, so it still works under curl … | sh, where stdin is a pipe and plain curl falls back to 79 columns whatever the real width. That makes passing a measured COLUMNS the right choice rather than just blanking it.
  • The "stays within the terminal" step is a real regression test, and rejecting frames exactly 80 wide means it also catches the off-by-one if the reserved column is removed.
  • Calling tput cols with COLUMNS blanked avoids a real ncurses trap.

Deployment notes

  • Every interactive curl download now sends a HEAD request (following redirects) before the GET — two requests per file against GitHub or any ROCM_CLI_DOWNLOAD_BASE mirror. HEAD failures are silently ignored.

What this covered

All three changed files, read completely, at 5dd0add against base 11a6069, plus loopback_http.rs, the e2e crate's Cargo.toml, the requires-os tag handling, the run_installer pattern and AGENTS.md. One independent code pass; history, CI and the description checked separately. Old and new curl calls run under sh and dash in a pty against a local server, and the probe run against the real v0.2.1 release; lifecycle-28 confirmed passing in build-and-test.

Did not run: design questions were examined in one pass rather than by separate workers; no Rust build locally; the referenced ticket could not be retrieved. Not reconciled against any PR discussion.

The percentage assertion could not fail on the bug it was named for.
It read the raw pty byte stream, but wrapping is something a terminal
does while drawing, never something the writer puts in the stream, so
an over-wide bar reaches it as one intact frame with a whole 100.0% in
it. Render the capture through vt100 and assert on physical rows
instead: screen().contents() stitches a wrapped row back onto its
parent and would hide the tearing, so read rows() directly. The
scenario now fails on the unfixed script with 11 progress rows where
three downloads should leave three.

Drop the redirect pre-resolution. It only ever shortened the bouncing
bar from about three frames to one, since most of that wait is curl
connecting rather than following hops, and it cost a HEAD per asset
including both sidecars. It also never fell back as its comment
claimed: curl prints url_effective even when the probe fails, so the
original URL was never restored. Removing it leaves the width fix,
which is what the reported stacking actually came from, fully covered.

Three fixes to the width measurement itself:

  - A terminal whose size was never set reports 0x0. That was treated
    as a measured width and suppressed the bar entirely, where curl
    had previously drawn one at its own default.
  - tput sizes from its own stdin, which is the pipe under
    `curl ... | sh`, so the fallback read ncurses' 80-column default
    rather than the terminal. Point it at fd 2 like its sibling.
  - A zero-padded COLUMNS is an octal literal to POSIX arithmetic and
    dash rejects it outright. Strip leading zeros by hand; bash's 10#
    is not POSIX and dash rejects that too.

wget keeps its bar but moves from -q to -nv, so a failed download still
says why instead of leaving only this script's generic message.

Covers the branches that had none: a terminal too narrow for a bar now
says so rather than going silent, and the wget fallback is exercised by
shadowing curl out of PATH. Each new scenario was confirmed to fail
with its behaviour reverted.

Signed-off-by: John Lybeck <john.lybeck@amd.com>

@nowycondro nowycondro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Automated review (Claude Code) · 03d2341

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

DEGRADED REVIEW (single-context; no sub-agent/spawn tool was available to this run — see What this covered).

Full review of the whole change, at the current head (base 6eeec620…head 03d2341), which is a second, review-responsive commit on top of the first (5dd0adde, already reviewed by others at that earlier commit). Implements the acceptance criteria of ROCMAI-770 ("Installer: download progress bars render garbled in the terminal", status QA): one clean, in-place progress indicator per download, and unaffected piped/non-interactive output. The ticket's own suggested implementation (a plain Downloading... done fallback) differs from what was built (measuring the real terminal and sizing curl's bar), but the acceptance criteria are met either way, and the ticket does not claim this PR closes it.

Blocking

  • New test helper breaks the Windows build: std::os::unix::fs::symlink is called with no #[cfg(unix)] guard — tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:1961, in path_shadowing_out (added by this commit to drive the new wget-fallback scenario). Confirmed directly from the live CI logs for this commit: both Windows build and test (debug) (job 125908299740) and Windows release build and lifecycle (job 125908299795) fail identically with error[E0433]: cannot find 'unix' in 'os' ... found an item that was configured out, and the aggregate windows-build-and-test required check fails as a result — the whole e2e-cucumber test target no longer compiles on Windows, blocking every Windows e2e lane, not just the new scenario. This is a known, previously-hardened failure class for this repo: commit 0d85577b ("ci: run clippy on Windows so cfg(windows) code is lint-gated too") made windows-build-and-test a required check specifically so a cfg(unix)-only item landing unguarded would fail loudly instead of silently; the same file already has the correct pattern three times (e.g. lifecycle_steps.rs:619, std::os::unix::fs::symlink under #[cfg(unix)], and path_without_openssl at line 891, written portably for both separators). The new code's own comment at lifecycle_steps.rs:1724 ("This still compiles on Windows... it simply never runs") states the intent this change fails to meet.
    Confidence 100 · mechanical · Fix: gate the symlink call (and, for correctness if ever run off-Linux, the :-only PATH splitting in the same function) behind #[cfg(unix)], matching the existing sibling pattern at line 619; the scenario itself is @requires-os:linux so a Windows-side no-op is sufficient.

  • PR description is stale against the current head and misstates what the change does — install.sh, whole-file diff at 03d2341 vs. the PR body. The body (unchanged since the first commit) still describes a redirect-resolution mechanism — "The download URL is resolved to its final location before the transfer that draws the bar", a resolve_download_url "Notes for review" discussion, and "the stray #O#-# fragments... fixed by" that mechanism — none of which exist in the code any more: resolve_download_url was removed entirely in the second commit (confirmed: git grep resolve_download_url over the PR head returns nothing). The body also says "wget's interactive branch gains -q", but the code now uses -nv (changed in the same commit, for a documented reason — -q would also swallow wget's own failure text). The body says "New @lifecycle scenario lifecycle-28" (singular); the current diff adds three scenarios, lifecycle-28 through -30 (single-bar-width, narrow-terminal-with-notice, wget-fallback), with the latter two undescribed.
    Confidence 100 · (Step 9, description-vs-code mismatch) · Fix: rewrite the body from the current diff — drop the redirect-resolution narrative, correct -q→-nv, and describe all three new scenarios and what each proves.

  • The three narrowest behaviors this commit fixes have no regression test — install.sh's progress_bar_width: the 0×0-winsize fallback ([ "${width}" = "0" ] && width=""), the tput cols <&2 file-descriptor fix, and the leading-zero/octal COLUMNS guard. All three were introduced specifically to fix bugs raised against the first commit, and none of the three new scenarios (lifecycle-28/29/30) drives a 0×0 pty, an stty-absent host, or a zero-padded COLUMNS. I verified by direct execution (Python pty.fork() + raw TIOCSWINSZ, under dash, extracting the real function body from this commit) that: a genuinely-unresized pty (native default winsize is 0 0, confirmed via stty size under a fresh pty.fork()) now correctly falls through to the 80-column default instead of silently suppressing the bar; redirecting stdin away from the terminal (simulating curl | sh) while hiding stty now makes tput cols <&2 correctly read the real pty size; and COLUMNS=050/COLUMNS=0080 no longer crash under dash (confirmed dash -c 'width=080; echo $((width-1))' does hard-error with "Illegal number: 080" on unfixed logic, i.e. the bug being fixed is real). So the fixes are correct, but per AGENTS.md §3 ("Every bug fix ships with a regression test... test fails before fix and passes after fix") this is new, review-driven behavior with zero automated coverage.
    Confidence 85 · logic · Fix: add 1–2 more scenarios reusing the technique already in this diff — path_shadowing_out/path_without_openssl's PATH-shadowing for an stty-absent host, and a portable_pty::PtySize { cols: 0, rows: 0, .. } pty (shown above to be a faithful stand-in for a never-resized terminal) for the 0×0 case.

Non-blocking

  • Scenario-ID collision with another open PR, still live — tests/e2e-cucumber/features/install_lifecycle.feature:357 adds lifecycle-28. Open PR #207 independently adds lifecycle-28 through -31 to the same feature file and also touches install.sh/lifecycle_steps.rs/docs/testing.md (confirmed still open, unmerged, same base lineage, as of this review). Whichever lands second needs renumbering and will conflict on these files. Not a defect in this PR alone.
    Confidence 85 · mechanical

Decisions for the author

  • Dropping resolve_download_url (the HEAD-probe/redirect-resolution half of the first commit) — non-blocking-improvement. This removes the untested-redirect-path, broken-fallback, and per-asset-HEAD-overhead concerns from the first commit in one clean stroke (no dangling references anywhere in the tree), at the cost of leaving the "bouncing bar during a redirect" cosmetic a little more visible than the first commit's description implied. A reasonable, smaller-footprint choice; flagged here only because the PR body (see Blocking) still describes the removed mechanism as present.

Positive signals

  • The new lifecycle-28 assertions correctly discriminate bug-present from bug-fixed, verified independently: rendering the exact unfixed-script byte stream (COLUMNS=96 on an 80-col pty) through a VT100-compatible emulator (Python pyte, same auto-wrap/cursor semantics the Rust vt100 crate implements) reproduces the precise reported symptom — one 80-char row with no 100.0%, followed by a second row with the torn ...100.0% tail — while the fixed width (COLUMNS=79) renders three clean, separate, complete 100.0% rows for three sequential downloads. Using Screen::rows(start, width) rather than .contents() is the correct API choice for this (confirmed against the crate's own doc comment: rows does not stitch a wrapped line back together, contents does).
  • wget -nv (replacing the first commit's -q) is the right fix for the earlier "drops wget's own error text" finding — confirmed -nv suppresses request-progress chatter while a failure's reason is preserved, unlike -q.
  • stty size <&2 / blanking COLUMNS before tput cols <&2 both deliberately target fd 2 to match fetch()'s own [ -t 2 ] gate — correct for the curl ... | sh pipe-install idiom, where fd 0 is the pipe, not the terminal.

Deployment notes

  • Script-only, TTY-gated behavior change; no config/state/protocol migration.
  • Do not merge while windows-build-and-test is red at this commit (see Blocking) — it is a required check, and its own history (0d85577b) is specifically about not letting this class of break merge silently.

What this covered

DEGRADED: this run had no agent/sub-worker spawn tool available, so this is a single-context pass rather than the fan-out the method calls for; a re-run with fan-out available is recommended, particularly for Step 7 design-review breadth.

Read completely, from a plain-HTTPS clone with the PR head fetched to a local ref (never checked out) and diffed against the merge-base with main: install.sh (full file, both commits), tests/e2e-cucumber/features/install_lifecycle.feature (new scenarios), tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs (full diff plus surrounding context, including the pre-existing path_without_openssl/#[cfg(unix)] sibling patterns), tests/e2e-cucumber/src/loopback_http.rs (full diff), AGENTS.md (full). Reviewed against 6eeec620…03d2341.

Verified by direct execution rather than by reading alone: the progress_bar_width shell function extracted from this commit, under real pty.fork()/TIOCSWINSZ-controlled terminals with dash, for the 0×0-winsize case, the tput-wrong-fd case (with fd 0 redirected away from the terminal), the leading-zero/octal COLUMNS case, and the <=21 cutoff; curl's actual trailing-newline and bouncing-bar behavior against a local HTTP server; the reported wrap/tear symptom and its fix, rendered through a VT100-compatible emulator. CI status for the live head commit was read via gh pr view --json statusCheckRollup and the two failing Windows job logs were fetched directly (not inferred from names) to find the root cause.

Did not run: cargo test/cargo clippy/cargo xtask e2e (no Rust toolchain in this environment) — substituted with the direct executions above plus live CI logs for the Rust-side claims. Design-review (Step 7) ran as a single pass rather than independent workers, per the DEGRADED note above.

Ticket ROCMAI-770 was retrieved (internal tracker tool available to this reviewer); only its public-facing summary and acceptance criteria are referenced above, consistent with this being the project's own ticket-ID convention.

One process note on independence, disclosed per instructions: this review's mandatory duplicate-check (listing existing PR reviews to confirm none of mine already exists at the live head) necessarily returned the full bodies of the three existing reviews via the API, which has no field-filtering option. All of those reviews are pinned to the earlier commit 5dd0adde; every finding above concerns code, CI results, or a PR-body passage that only exists/changed in the second commit (03d2341) and so could not have been read in, confirmed by, or anchored to that earlier content — the Windows compile break and the stale-description mismatch are both new in this commit by construction. Not reconciled against any of those reviews' content, or any other discussion thread, here.


🤖 Generated with Claude Code

@johnl-amd

Copy link
Copy Markdown
Contributor Author

Thanks, all three reviews converged on the same real hole and I've reworked the change around it. Pushed as a second commit so the first round stays readable.

The percentage assertion could not fail on this bug. You're right, and I verified it before changing anything: replaying an unfixed capture through the old assertions, 100.0% survives intact and no bare .0% row exists, so both halves passed with the bug present. Wrapping is something the terminal does while drawing, never something the writer puts in the stream. It now renders through vt100 and asserts on physical rows, and fails on the unfixed script with 11 progress rows where three downloads should leave three.

One trap worth recording for whoever builds the shared pty helper that was suggested as a follow-up: screen().contents() stitches a wrapped row back onto its parent, so it reported a 96-column line on an 80-column screen and hid the tearing. My first attempt at this fix passed against unfixed code for exactly that reason. rows() is what works.

Dropped the redirect pre-resolution entirely. The measurements made the case: about three bouncing frames down to one, because most of that wait is curl connecting rather than following hops. Weighed against a HEAD per asset including both sidecars, an untested branch, and the fallback bug below, it wasn't carrying its weight. Removing it leaves the width fix, which is where the reported stacking actually came from, and that is now covered.

On the fallback that never happened: confirmed, curl prints url_effective even when -f trips, so resolved was never empty and the else was dead. The comment and the PR body both claimed otherwise. Moot now that the probe is gone, but the claim was wrong and worth saying so.

Three fixes to the width measurement itself, all reproduced before and after:

  • 0×0 terminals were treated as measured and lost their bar, where curl had drawn one at its own default. Now treated as unmeasured.
  • tput sizes from its own stdin, which is the pipe under curl ... | sh. It was reading ncurses' 80-column default rather than the terminal; it reads fd 2 now. Measured: fd 2 gives 100 on a 100-column pty where fd 0 gives 80.
  • Zero-padded COLUMNS crashed dash. Worth flagging that the suggested 10# would have been a worse fix: dash rejects that too (arithmetic expression: expecting EOF: "10#080"), so leading zeros are stripped by hand.

Coverage for the branches that had none: a narrow terminal now says why it's quiet, and that's asserted alongside the absence of a bar; the wget fallback is exercised by shadowing curl out of PATH. Each new scenario was confirmed to fail with its behaviour reverted, which is the step I skipped the first time.

The wget scenario shadows curl with a directory of symlinks rather than dropping PATH entries, because curl shares /usr/bin with sh, tar, awk and ~980 other things; removing that directory leaves nothing able to run.

wget -q to -nv: taken, and the scenario now asserts the request logging stays gone, so the change is covered rather than just made. One thing that wasn't in the original suggestion: on success -nv also prints a line carrying the fully resolved asset URL, which for a release download is long. Keeping it anyway, since losing a failure's reason is worse, but flagging it as a visible tradeoff rather than a free win.

On the scenario-ID collision with #207: the numbers can't be moved out of the way in advance. feature_naming enforces sequential per-feature indexes in declaration order, so renumbering mine to 32 fails the suite. Whichever of us merges second renumbers; noted in the PR body.

Not done, deliberately: curl still draws a frame or two of its bouncing bar while waiting for response headers. Nothing here can shorten that, and it redraws in place on one row now, so it reads as a brief animation rather than the reported garbling. Said plainly in the PR body instead of being implied away.

On the red lane: E2E tests (Strix Halo, Windows) is serve scenarios failing on upstream 404s, in a lane where these scenarios are skipped anyway, and the same failure is on main. The two Strix Halo Ubuntu lanes hit their 45-minute timeout and want a re-run. Happy to be told otherwise if that read is wrong.

The follow-up issues suggested (a shared pty-render helper for installer scenarios, shell-level tests for the installer helpers, the .sig-on-nightly channel question, and labelled per-download bars) all look worth filing separately. Say the word and I'll open them rather than grow this PR.

std::os::unix::fs::symlink has no Windows counterpart, and the Windows
lifecycle lanes build this target even though every scenario reaching
the helper is tagged @requires-os:linux. Gate the one call that has no
portable spelling and leave the rest of the function shared.

Verified by compiling the construct for x86_64-pc-windows-msvc as well
as the host, rather than assuming: a full cross-check of the crate is
not possible here, since its C dependencies need a Windows toolchain.

Signed-off-by: John Lybeck <john.lybeck@amd.com>
GitHub Actions created no check suite for the previous head, so the PR
sat with no CI on it. Seven third-party suites registered against that
commit and the Actions one simply never appeared; the workflow has no
path filters and the same trigger fired for both earlier commits, so
this is an Actions-side miss rather than configuration.

Empty on purpose: it carries no change, only a synchronize event.

Signed-off-by: John Lybeck <john.lybeck@amd.com>

@nowycondro nowycondro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Automated review (Claude Code) · 55ca399

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change, at the current head (base 11a60691…head 55ca399b, the 4th commit on the branch — an intentionally empty "re-trigger CI" commit on top of bf5c4c2e). Implements ROCMAI-770's acceptance criteria ("one clean progress indicator per download" / "piped runs print plain lines without control characters") by measuring the real terminal width and feeding it to curl — a different mechanism than the ticket's own "suggested change" (a plain Downloading... done fallback), which is fine since acceptance criteria, not the suggestion, govern. The ticket (status: QA) was reported from WSL2 under Windows Terminal; this PR's e2e coverage runs only under a native Linux PTY (@requires-os:linux), so the exact originally-reported environment is not what CI exercises, though that follows this suite's existing host-gating convention rather than being a shortcut specific to this PR.

Blocking

  • The PR is not mergeable as described, and fixing it is more than the "renumber" the PR body promises — install.sh (insertion point immediately after truthy(), merge-base line 38/40), tests/e2e-cucumber/features/install_lifecycle.feature:361,371,380. PR #207 ("prettier progress output + completion banner") merged into main at commit 16faebfb before this review, and it independently claims lifecycle-28 through lifecycle-31 in the same feature file for unrelated content (ANSI color gating, get-started banner), and it also inserts a new block (use_color/C_STEP/C_OK/C_ERR/step()/info()/ok()) at the exact same point in install.sh — immediately after truthy() — that this PR's progress_bar_width() occupies. Confirmed directly: git merge-base --is-ancestor origin/main pr/847 fails (the PR branch predates #207), and the GitHub API reports "mergeable_state":"dirty" for the current head. The PR body's "Known conflict" section frames this as a future, symmetric risk ("whichever PR merges second renumbers"); that framing is now simply wrong — #207 already merged, so #847 unconditionally needs to renumber and manually reconcile two independent insertions at the same point in install.sh (e.g., whether the new narrow-terminal echo should route through #207's new info() helper for consistent color gating), not just shift three scenario numbers.
    Confidence 100 · architectural · Fix: rebase onto current main, renumber lifecycle-28..30 to the next free indices, and manually merge the two install.sh insertions (deciding whether progress_bar_width's messaging participates in #207's color scheme).

  • No CI check has ever run against this change's actual content — current head 55ca399b (0 check runs via the Checks API) and its immediate, non-empty parent bf5c4c2e (the commit that fixed a Windows compile break found in the previous review round) both show zero registered workflow runs when queried by branch (actions_list filtered to ROCMAI-770-installer-progress-display lists runs only for the two earlier commits, 5dd0adde and 03d234104). The most recent commit, 55ca399b, is an intentionally empty "chore: re-trigger CI" commit whose own message says it exists specifically because "GitHub Actions created no check suite for the previous head" — and as of this review, it has not succeeded at that either. Re-verified twice, ~20 minutes apart, with the same result. Concretely, this means the Windows-compile fix in bf5c4c2e (#[cfg(unix)]/#[cfg(not(unix))] guarding std::os::unix::fs::symlink in path_shadowing_out) — independently read and confirmed correct by this review — has never actually been compiled by CI on any platform.
    Confidence 100 · architectural · Fix: investigate why Actions isn't creating a check suite for this branch/head (webhook delivery, branch protection app config, or similar) and get a green run recorded before merge; do not treat the absence of a red X as a passing signal here.

  • The PR description's changelog omits a real code change present in the current diff — PR body's "Changed since the first round of review" section lists six specific changes from commit 03d2341 (percentage-assertion rewrite, redirect-resolution removal, 0×0-terminal fix, tput fd fix, octal-COLUMNS fix, wget -nv) but says nothing about commit bf5c4c2e, which adds the #[cfg(unix)]/#[cfg(not(unix))] split around std::os::unix::fs::symlink in path_shadowing_out (tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs) to fix a Windows build break. That guard is real, present code in the current diff, not merely a commit-message artifact — confirmed by diffing bf5c4c2e against its parent, which shows only this guard being added.
    Confidence 85 · (Step 9, description-vs-code) · Fix: add a line to the PR body's changelog naming the Windows-compile fix, per this repo's own AGENTS.md §11 ("if reviewed code must be updated, explain what changed since review").

  • docs/testing.md's install-lifecycle section is not updated for the new scenario category, contrary to this repo's own explicit rule and an established, demonstrated precedent — docs/testing.md:1696-1753 (the ### Install lifecycle section) exhaustively enumerates every behavior category the @lifecycle scenarios cover — signer/checksum/signature rejection, PEM packaging, PATH setup, reinstall, Windows loopback install, uninstall variants — but says nothing about progress-bar rendering, narrow-terminal handling, or the wget fallback, despite this PR adding three new scenarios (lifecycle-28/29/30) in exactly that category. AGENTS.md §5 states: "when a command's ... observable behavior change[s], update ... docs/testing.md ... in the same change — do not leave user-facing docs for a follow-up." This isn't a hypothetical reading of the rule: the already-merged sibling PR #207, which also changed install.sh's observable output, added a sentence to this exact paragraph for its own new scenario category (verified by reading #207's merged diff to docs/testing.md), so the convention is actively followed elsewhere in this same area and simply skipped here.
    Confidence 80 · mechanical · Fix: add one clause to the docs/testing.md:1696 paragraph naming the progress-bar/narrow-terminal/wget-fallback coverage.

  • run_installer_pty has no timeout, in a crate that has already been bitten by exactly this failure mode once — tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:1766 (reader.read_to_end(&mut raw)) and :1768 (child.wait()) both block unboundedly. Every wait in this same crate's tui_driver.rs is deliberately timeout-bound (default_timeout(), DRAIN_TIMEOUT) specifically, per that file's own comments, so a hang produces "a direct, diagnosable failure instead of a bare CI-timeout" — and wait_for_refusal's comment there references a real, past "build that hung under a real PTY" in this exact test suite. A PTY does not signal EOF just because the child's stdin half is idle; if install.sh ever regresses into an unexpected interactive wait (e.g. a prompt added by a future change, or by the as-yet-unresolved merge with #207), this test would hang indefinitely rather than fail with a clear message, burning CI time with no diagnosis. Two independent passes of this review converged on this same gap from different angles (direct code reading, and a design-level comparison against tui_driver.rs's established pattern).
    Confidence 85 · architectural · Fix: wrap the read/wait in a bounded watchdog (e.g. a sibling to tui_driver.rs's default_timeout()), matching the crate's own established convention.

Non-blocking

  • An all-digit COLUMNS of 19+ digits crashes the whole installer via arithmetic overflow, rather than degrading gracefully — install.sh:74-75 (case "${width}" in "" | *[!0-9]*) width=80 ;; *) : ;; esac) validates that width contains only digits but not that it fits in a representable integer, so $((width - 1)) at install.sh:97 can overflow. Verified directly: dash -c 'width=9223372036854775808; echo $((width - 1))' → dash: 1: Illegal number: 9223372036854775808, exit 2 — and under set -eu with the assignment as a bare command substitution (bar_width="$(progress_bar_width)"), this fatal shell-level error aborts the entire script rather than being caught by any ||/if guard, unlike every other malformed-input case this same function already handles. This is the same bug class as the zero-padded-octal case this PR already fixed, just at the opposite end (magnitude instead of leading zeros), and is very unlikely to occur from a real terminal or shell (COLUMNS is normally 1-4 digits) — hence non-blocking rather than blocking.
    Confidence 75 · logic · Fix: bound-check the digit count (e.g. reject anything over ~10 digits) before the arithmetic, alongside the existing digit-only check.

  • The curl-path width cutoff (21→22) has no test at its own boundary — tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:1858 (let width = usize::from(PTY_COLS);, used by then_progress_fits_terminal) and install.sh:94 (-le 21). The suite exercises a far-wide terminal (STALE_COLUMNS = 96 over PTY_COLS = 80) and a far-narrow one (NARROW_PTY_COLS = 20), but nothing at 21 or 22 — the exact pivot where progress_bar_width switches from "no bar" to "bar at its narrowest width." A one-off regression at that specific boundary would not be caught.
    Confidence 70 · logic · Fix: add a scenario (or a unit-level unit test on the extracted shell logic, if this repo has one) at 21 and 22 columns.

Decisions for the author

  • then_progress_fits_terminal hardcodes the module constant PTY_COLS as its comparison width rather than deriving it from whatever width the preceding When step actually used — non-blocking-improvement. lifecycle_steps.rs:1858 is correct today only because every scenario invoking this step happens to use PTY_COLS; nothing ties the two together structurally, so a future scenario reusing this Then with a different pty width would silently check against the wrong value instead of failing loudly. Storing the pty width used in LifecycleState and reading it back here would remove the implicit coupling.
  • progress_frames/progress_rows identify "progress output" by contains('#') || contains('%') — non-blocking-improvement. Currently safe (no other line in the real install.sh contains either character outside %s/%s\n format placeholders), but the heuristic has no anchor to curl/wget's actual output shape, so an unrelated future line containing # or % (a URL, a marker) would silently contaminate these counts. A tighter pattern (an ASCII-bar run, or curl's specific NN.N% shape) would be more durable test infrastructure.

Positive signals

  • The three fixes from the prior review round (0×0-terminal handling, the tput <&2 descriptor fix, the octal-literal leading-zero strip) were independently re-derived and verified correct by this review, including by direct execution under dash, not just re-read from the commit message.
  • Rendering the PTY byte stream through vt100 and asserting on Screen::rows() rather than contents() is correct and was verified against the actual vt100 crate source (contents() deliberately re-joins a wrapped row, which would hide the exact tearing this test exists to catch).
  • The Windows compile break found in the previous review round (std::os::unix::fs::symlink called with no cfg guard) is now correctly fixed with a #[cfg(unix)]/#[cfg(not(unix))] split, confirmed by diffing the fix commit in isolation.
  • loopback_http.rs's doc comment was correctly updated to describe both its current call sites (Windows native-HTTP install and the new Linux progress-rendering runs) rather than the stale Windows-only claim a prior round flagged.

Deployment notes

  • Script-only, TTY-gated behavior change; no state, config, or protocol migration.
  • Do not merge in the current state: the branch has a real (dirty) merge conflict with already-merged main, and no CI has run against either of the last two commits.

What this covered

Read completely, from a plain-HTTPS clone with the PR head fetched read-only to refs/remotes/pr/847 (never checked out) and diffed against the merge-base with main (11a60691): install.sh (full file, current head), tests/e2e-cucumber/features/install_lifecycle.feature (full new section plus surrounding conventions), tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs (full file, 2045 lines), tests/e2e-cucumber/src/loopback_http.rs (full file), tests/e2e-cucumber/tests/e2e/tui_driver.rs (full file, for the design-review comparison), root AGENTS.md (full), and the relevant sections of docs/testing.md. Also read PR #207's full merged diff (install.sh, install.ps1, the feature file, lifecycle_steps.rs) to establish the merge-conflict finding concretely rather than by assertion.

Fan-out: three independent workers (install.sh shell-correctness, the Rust/PTY test code, and a combined agent-instruction/history/prior-changes/code-comments source-reading pass) plus one design-review worker (PTY-infrastructure reuse question), each blind to this report, to each other, and to the PR's description/comments; their findings are folded in above, several cross-confirmed independently (the Windows-cfg fix and the vt100 rows()/contents() claim were each independently verified by more than one worker). One planned worker (install.sh) could not be spawned after one re-spawn attempt failed, both times due to a shared-environment concurrent-subagent cap (not a capability limit of this review) that was saturated by other sessions' agents at the time; that pass was run directly by the driver instead of as an independent worker, and is disclosed here as such — its findings (the merge-conflict details, the CI-gap, and the arithmetic-overflow case) came from direct reading and execution, not from a blind sub-agent.

Did not run: cargo test/cargo clippy/cargo xtask e2e (no Rust toolchain available in this environment) — substituted with careful reading, diffing specific commits in isolation, and direct dash execution for the shell-specific claims above. History and prior-changes passes found nothing further to add beyond what's folded in above.

One process note on independence, disclosed per instructions: this review's mandatory duplicate-check (listing existing PR reviews to confirm none of mine already exists at the live head) necessarily returned the full bodies of four prior reviews via the API (a human maintainer's, two from a login shared with this automation at earlier commits, and one from a third automation), none of which are pinned to the current head (55ca399b) — all four are pinned to either 5dd0adde or 03d2341. No finding above was sourced from or anchored to that text; everything here was independently (re-)derived from the current code, git state, and live CI/API queries, several by direct execution rather than reading alone. The merge-conflict-with-#207 finding in particular was derived from scratch by reading #207's actual merged diff, not by recalling that it had been mentioned elsewhere. Not reconciled against any of those reviews' content, or any other discussion thread, here.


🤖 Generated with Claude Code

#207 landed first and took lifecycle-28 through 31, so the three
progress scenarios here move to 32/34. It also inserted its colour
helpers at the same point in install.sh that progress_bar_width
occupies; both are kept, helpers first, and the narrow-terminal notice
now goes through its info() so it follows the same colour gating as
every other line the installer prints.

Tightened how the tests recognise progress output, which #207 made
necessary: its get-started block prints "rocm install sdk  # ...", and
matching any '#' counted those as bars. Frames now key on the carriage
returns that mark a redraw, which nothing else here emits, and rendered
rows match a run of bar characters, which a lone '#' cannot reach.

All three scenarios re-verified against the merged tree, each still
failing with the behaviour it covers reverted.

Signed-off-by: John Lybeck <john.lybeck@amd.com>

@jussielo-amd jussielo-amd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks John. Rendering the capture through vt100 and asserting on rows() makes the wrap bug actually visible, and the 0x0, tput fd 2 and zero-padded COLUMNS fixes all behave as described when I tried them under dash and bash. One blocker, and it is process rather than code:

Blocking

  1. The branch conflicts with main in install.sh and install_lifecycle.feature (#207's step/info/ok helpers and its lifecycle-28..31), and no CI has run on 55ca399b (only Read the Docs). So the new Rust, the three scenarios and the sh change have no CI evidence yet. Please rebase, renumber the scenarios, and confirm the Linux lifecycle step and the Windows lanes go green.

Non-blocking

  • UX: the narrow-terminal notice is a bare echo (install.sh:113). After the rebase it will sit next to #207's info/ok output, so info "terminal too narrow for a progress bar (needs 22+ columns); downloading quietly" would match.
  • Nothing covers the curl | sh path (stdin a pipe), which is the reason for the <&2 on stty and tput. The pty gives the installer a tty on stdin too, so deleting <&2 or the tput branch keeps all three scenarios green. A scenario running cat install.sh | sh -s ... inside the pty would pin it.
  • The first Then of lifecycle-30 ("frames stay within the terminal") can't fail on this change, since wget sizes itself from stderr. Only the no-request-logging Then depends on -nv.
  • Minor robustness: a COLUMNS of 20+ digits aborts dash when both stty and tput are unusable. Capping the digit count would avoid it.

🤖 by agenthub on AMD AgentHub

@nowycondro nowycondro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Automated review (Claude Code) · bf4a918

This automation never files a GitHub approval, so no approving review will appear here whatever the outcome — the merge decision stays with a human reviewer.

Review — needs work

Full review of the whole change (base 763315870b9f55d05daeaa6b5e9175fd71c8a2ff, head bf4a918db1237222807f6f624ca13228f8e6f9ee).
Implements the fix for ROCMAI-770 ("Installer: download progress bars render garbled in the terminal"). The ticket's two acceptance criteria are satisfied: the TTY-progress-bar criterion by this change (measuring the real terminal width instead of trusting a possibly-stale COLUMNS), and the piped/non-interactive criterion by pre-existing, unmodified behaviour (the quiet curl -fsSL/wget -qO branches this diff does not touch). The PR's chosen fix (measure-and-correct) is stronger than the ticket's own suggested workaround (fall back to a plain "Downloading... done" line).

Blocking

  • Two explicitly-claimed regression fixes have no automated test exercising them — install.sh:95,103,111-123, tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:1764-1946
    The PR's own history describes two fixes added in response to earlier review: "0×0 terminals no longer lose their bar" (the [ "${width}" = "0" ] && width="" lines) and "a zero-padded COLUMNS crashed dash" (the leading-zero-stripping loop at install.sh:115-120). I reproduced progress_bar_width() standalone under dash: with the current code, COLUMNS=080/COLUMNS=00/COLUMNS=0 (stty/tput unavailable) all correctly resolve to width 79. With the leading-zero-stripping step removed, the same COLUMNS=080 input makes dash abort with Illegal number: 080 (exit 2) — confirming this is a real, previously-shipped crash that the current code fixes. But none of the three new BDD scenarios ever exercises either path: all three drive the installer with pty_cols of PTY_COLS(80) or NARROW_PTY_COLS(20) — never 0 — and columns_env is typed Option<u16> converted via .to_string() (install_under_pty/when_install_pty_*, lines 1792/1910/1940-1946/2083-2110), which structurally cannot produce a leading-zero string like "080". A future change that reverted either fix would pass CI undetected.
    Confidence 100 (ran it). Category: logic/test-coverage.
    Fix: add a scenario (or widen columns_env beyond Option<u16>, or add a side-channel raw-string COLUMNS override) that sets a zero-padded COLUMNS and asserts the installer doesn't fail; and a scenario that forces stty/tput to report 0 columns and asserts a bar is still drawn rather than suppressed. If driving a full PTY install for these is impractical, progress_bar_width is a pure function and a lightweight direct-invocation shell test (outside the PTY harness) would also close the gap.

  • PR description cites the wrong scenario ID for its own stated test evidence — PR body checklist vs. tests/e2e-cucumber/features/install_lifecycle.feature:421-424 and :377-378
    The checklist states: "The one new user-facing message (the narrow-terminal notice) is asserted by lifecycle-29...". After the merge-main commit (bf4a918) renumbered this PR's three scenarios from 28/29/30 to 32/33/34 (to avoid colliding with PR #207's own lifecycle-28..31), the narrow-terminal scenario is actually lifecycle-33 (@id:lifecycle-linux-progress-narrow-terminal). lifecycle-29 is now a different, unrelated, pre-existing scenario from #207 ("NO_COLOR keeps the installer output free of ANSI escapes"). The underlying claim is true (the behaviour is tested), but the specific checkable reference in the author's own verification checklist is false.
    Confidence 85 (grepped the feature file directly for both IDs). Category: mechanical.
    Fix: update the checklist line to reference lifecycle-33.

Non-blocking

None.

Decisions for the author

None.

Positive signals

  • The round-2 fix removes the redirect-pre-resolution workaround from round 1 after showing it didn't actually solve the reported problem and carried its own latent bug (never restored the original URL on a failed probe) — addressing root cause instead of accumulating an unnecessary, buggy mitigation.
  • Rewriting the percentage assertion to render the pty capture through vt100 and assert on rows() rather than contents() is well-reasoned and consistent with this exact pitfall already documented in tests/e2e-cucumber/tests/e2e/tui_driver.rs's own use of vt100.
  • The Windows-compile break introduced by the new Unix-only path_shadowing_out helper was caught and fixed in a dedicated follow-up commit with a #[cfg(unix)]/#[cfg(not(unix))] split consistent with the file's existing installer_command/which_ok pattern, rather than left broken for the Windows CI lane.

Deployment notes

None. The diff is confined to fetch()'s progress-bar drawing in install.sh; the checksum, signature, and silent (non-TTY) download paths are unmodified, matching the PR's own risk statement. All CI checks are green on this head commit.

What this covered

DEGRADED REVIEW — the concurrent-subagent pool available to this process was saturated by unrelated work for the full duration of this review (repeatedly observed at 20-21 concurrent agents over ~8 minutes, none of them mine), so the mandated independent fan-out (separate workers per file group, plus separate history/impact-analysis/agent-instruction workers) could not be run. This is a single-context pass instead; recommend re-running with fan-out available for the coverage a split review adds.

Read completely: install.sh (whole file), tests/e2e-cucumber/features/install_lifecycle.feature (new scenarios plus surrounding tag/ID conventions), tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs (full function inventory, new code in full), tests/e2e-cucumber/src/loopback_http.rs (whole file), and the repo's root AGENTS.md (whole file) as the governing agent-instruction file. Diff reviewed: 763315870b9f55d05daeaa6b5e9175fd71c8a2ff...bf4a918db1237222807f6f624ca13228f8e6f9ee. Grepped README.md, docs/testing.md, docs/manual-testing.md, tests/e2e-cucumber/expectations.toml, .github/workflows/ci.yml, and Cargo.toml/Cargo.lock for impact-analysis consequences (none found requiring action — the lifecycle scenarios are wired into the "Acceptance install lifecycle" CI step, portable-pty/vt100 were already dependencies, no doc describes the old behaviour). Checked commit history (git log/blame) on install.sh and lifecycle_steps.rs; found one relevant prior-art precedent (PTY-observed progress-bar testing for a different subsystem, PR #421) establishing this PR's testing approach as consistent with existing convention, nothing adverse. Verified all 5 commits carry Signed-off-by: trailers and no AI-attribution footers; confirmed via the GitHub API that every CI check (including "Commit signatures + sign-off") is green on bf4a918. Read the PR description and retrieved ROCMAI-770 directly from Jira.

Not reconciled against any discussion on this PR (prior review rounds, reviewer comments) — this pass was blind to that by design.

🤖 Generated with Claude Code

…(ROCMAI-770)

Three of the behaviours this PR claims had no test that could fail if
they regressed, and review was right that the gap mattered: each one
sits behind the measurement chain, so a pty with a real size never
reaches it.

  - Piping the installer into a shell, the shape it actually ships in,
    leaves stdin a pipe and only stderr a terminal. That is the whole
    reason the width is read from fd 2, and deleting the redirection
    kept every scenario green. The new scenario runs at 100 columns
    rather than 80 because ncurses answers 80 when it cannot read a
    terminal, which at this suite's usual width is indistinguishable
    from a correct measurement.
  - A terminal reporting no size is now stood in by a stty shim, since
    no real pty here will report 0x0 on demand, with tput left
    available so falling through yields the terminal's own width
    instead of the 80-column default a later guard would supply.
  - A zero-padded COLUMNS is only consulted when neither stty nor tput
    can answer, so both are shadowed out of PATH.

Each was confirmed to fail with its own fix reverted, which an earlier
attempt at two of them did not: they passed either way until the shape
above was in place.

The PATH helper grew shims and multiple names for this, assertions read
the width the run actually used rather than a constant, and
docs/testing.md names the new coverage as AGENTS.md requires.

Signed-off-by: John Lybeck <john.lybeck@amd.com>
@johnl-amd

Copy link
Copy Markdown
Contributor Author

Thanks. Your blocker is cleared, and the two coverage gaps you pointed at turned out to be the more interesting half of this round.

Blocker: merged, renumbered, CI green. main is merged in (not rebased, so nothing you have already read is rewritten). #207 landed first, so its lifecycle-28..31 stand and these scenarios moved to 32 onward. Both insertions into install.sh are kept, its helpers first, and the narrow-terminal notice now goes through info() as you suggested. On the current head: build-and-test (which runs the Linux "Acceptance install lifecycle" step), Windows build and test (debug), Windows release build and lifecycle and E2E tests (Strix Halo, Windows) are all green.

The two Strix Halo Ubuntu lanes are red on serve scenarios (llama-server failed to start), and the same two fail identically on main, so I have read them as unrelated. Correct me if that is wrong. MI300X and W7900 are still queued.

curl | sh had no coverage, and you were right about why that mattered. Deleting the <&2 really did keep every scenario green, so the part of the fix that makes the shipped invocation work was unprotected. lifecycle-35 now pipes the installer into a shell, and it runs at 100 columns rather than 80 on purpose: ncurses answers 80 whenever it cannot read a terminal, so at this suite's usual width a wrong measurement is indistinguishable from a right one. With <&2 the bar spans 99; without it, 79, and the scenario says so.

Two more that were in the same position, found while adding that one: the 0x0 handling and the zero-padded COLUMNS strip both sit behind the measurement chain, so a pty with a real size never reaches them. My first attempt at both passed with the fix reverted. lifecycle-36 now stands in a stty shim reporting 0 0, with tput deliberately left available, because hiding it let a later guard rescue the same input to 80 and hid the regression. lifecycle-37 shadows stty and tput out of PATH so COLUMNS is actually consulted. Each is confirmed to fail with its own fix reverted.

On lifecycle-34's first Then: agreed, it cannot fail on this change, since wget sizes itself from stderr regardless. Only the no-request-logging assertion depends on -nv. Happy to drop it or keep it as a smoke check, your call.

Still open, not done here: the COLUMNS overflow you and the automated pass both flagged, and run_installer_pty having no timeout where tui_driver.rs bounds every wait for a documented reason. Both are real. I would rather do them in a follow-up than grow this further, unless you want them before merge.

docs/testing.md now names the new coverage, and the description's stale lifecycle-29 reference is corrected to lifecycle-33.

@jussielo-amd jussielo-amd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks John, nice round of fixes. I reviewed this by reading the diff only; I did not run the tests.

Earlier findings, re-checked at 1eeb286:

  • Merge with main, renumbering to 32–37: done. The Linux lifecycle step on this head shows all 22 scenarios passing, and the Windows lanes are green.
  • Narrow-terminal notice now goes through info(): done.
  • curl | sh coverage (<&2, lifecycle-35 at 100 columns), 0×0 handling (lifecycle-36), vt100 rows() rendering, and wget -nv: all look right.
  • Zero-padded COLUMNS is handled correctly. I ran progress_bar_width under dash with COLUMNS=080 and got 79.
  • Still open, and fine as a follow-up: the very long COLUMNS overflow and the unbounded pty read (inline comments).

CI: the two Strix Halo Ubuntu lanes failed on serve and automation helper scenarios (GPU still held by a previous engine, daemon not running). None of those touch install.sh or the lifecycle scenarios, so I read them as unrelated. I couldn't confirm "same on main" because the main runs were still queued, so a re-run of those two lanes before merge would be good. MI300X and W7900 were still queued when I looked.

Non-blocking:

  • The PR description is a bit stale: it says three scenarios (there are six now) and still has the "Known conflict" section, and docs/testing.md only lists the original three coverage areas (curl-piped sizing, unsized terminal and zero-padded COLUMNS are missing).
  • The first Then of lifecycle-34 can't fail on the wget change. Fine to keep as a smoke check.
  • -nv should still print wget's one-line "URL -> file" summary after each bar. Worth a quick look on a real host, since the tests only assert the absence of the request chatter.

🤖 by agenthub on AMD AgentHub

Comment thread install.sh
# curl ignores a COLUMNS of 20 or less and sizes the bar itself, which would
# reintroduce the overrun this function exists to prevent. Report no width so
# the caller downloads quietly instead.
if [ "${width}" -le 21 ]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking: a COLUMNS of 19 or more digits still aborts the install under dash when stty and tput are both unusable. I ran the function under set -eu with COLUMNS=99999999999999999999: dash reports Illegal number here and at the $((width - 1)) below (bash returns a garbage width instead). Very unlikely in practice, so fine as a follow-up as you proposed. A cheap guard would be to treat anything over ~5 digits as unmeasured before this test, e.g. case ${width} in ??????*) width=80 ;; esac.

.expect("failed to read the installer's pty");
let mut raw = Vec::new();
reader
.read_to_end(&mut raw)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking: read_to_end has no deadline, so an installer that ever blocks (a prompt, a stalled download) would hang the CI step instead of failing it, unlike the bounded waits in tui_driver.rs. I don't see anything in install.sh that blocks today, and you've already noted this for a follow-up, which works for me. Reading on a thread with a timeout and killing the child on expiry would close it.

// screen for the question it alone can answer: was a bar drawn.
let output = state(world).last_terminal_output.clone();
assert!(
output.contains("too narrow for a progress bar"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking: contains can't tell one notice from three, so removing the narrow_terminal_reported guard in fetch() would still pass. Counting occurrences (output.matches("too narrow for a progress bar").count() == 1) would pin the "say it once" behaviour. The flag does persist today, since fetch() isn't called in a subshell.

…e (ROCMAI-770)

Frames were picked out by carriage return alone, on the reasoning that
only a downloader redraws in place. It does, but the line it redraws on
also carries the preceding "download: <url>" notice, so that notice was
being counted as a frame. Against a real release URL it is 106 columns
wide and would have failed the width assertion on any terminal narrower
than that; it passes in CI only because the loopback fixture's URL is
short.

Require a carriage return and a bar character together. Neither works
alone: the notice redraws but carries no bar, and the get-started block
prints "rocm install sdk  # ..." which carries one but never redraws.

Found by smoke-testing against the real nightly rather than the fixture.
All six progress scenarios still fail with their own fix reverted.

Signed-off-by: John Lybeck <john.lybeck@amd.com>
Picks up the vt100 0.16.2 -> 0.18.1 bump (cda078c), whose Parser::new
now takes NonZeroU16 dimensions. This branch still resolved 0.16 on its
own, so it built locally while CI, which compiles the merge with main,
did not: clippy and every build lane went red on a change that touched
only a test filter. Wrap the two dimensions at the call site; rows() is
unchanged.

All six progress scenarios re-run against 0.18.1, and the width fix
still fails them when reverted.

Signed-off-by: John Lybeck <john.lybeck@amd.com>
@johnl-amd
johnl-amd added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
@johnl-amd
johnl-amd added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 9, 2026

@nowycondro nowycondro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Automated review · review-code · head f0696b3

Outcome: needs work — one blocking test-coverage gap; otherwise a clean, well-reasoned fix. Reviewed install.sh, docs/testing.md, and the new install_lifecycle.feature scenarios + lifecycle_steps.rs step definitions (base 435fbcc…head f0696b3). All CI checks on this commit are green.

Blocking

  • The "report the narrow-terminal notice once, not three times" behavior has no test that can catch its own regression — install.sh:133-135,145-148 (the narrow_terminal_reported guard), tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs:2139-2158 (then_narrow_notice). The only assertion on the notice is output.contains("too narrow for a progress bar"), which passes identically whether the guard fires once or is removed entirely (so the notice would print on all 3 downloads instead of 1). Suggest asserting an exact count, e.g. output.matches("too narrow for a progress bar").count() == 1, and confirming it goes red with the guard reverted.

Non-blocking

  • install_under_pty, install_with_env, and when_install_pty_without_curl (lifecycle_steps.rs) are three near-identical bodies (start loopback server, build the same env pair, call run_installer_pty, stash the three last_* fields) — worth factoring into one helper.
  • lifecycle-34 (wget fallback) drives a stale COLUMNS=96 on an 80-column pty, but the Gherkin text doesn't mention that a width mismatch is part of what's under test — reads as if only the wget bar itself is being exercised.

Decisions for the author

  • progress_bar_width() measures the terminal once per fetch() call; a resize during a single large download could still leave a stale width for that transfer. The function's doc comment ("puts the real one back in charge") reads as a stronger guarantee than this actually gives — worth confirming that residual window is accepted rather than assumed fixed.
  • wget's branch has no narrow-terminal guard or test (unlike curl's explicit quiet-fallback + notice), on the stated assumption that wget already keeps its own bar inside the terminal. Worth confirming that's verified rather than assumed, or saying so explicitly in a comment.

What this covered: the full diff, read completely across all 5 changed files via independent passes (install.sh+docs, the test files, and agent-instructions/history/code-comments), plus a design pass and a CI-status check (38 checks, all green or expectedly skipped). Ticket ROCMAI-770 is named in the title but wasn't retrievable from this context (no tracker access here). The rest of the PR description's claims check out against the diff, except that the top "Summary" bullet still says "Three @lifecycle scenarios" while the final diff adds six (32–37) — the later "Changed since review" sections do describe all six, so this looks like a stale count rather than undisclosed work.

Not a human review. This is an automated code review; please verify findings independently before acting on them.

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review — no blocking findings

Full review of the whole change (435fbccb...f0696b33), split into two independent passes (production install.sh/docs/testing.md, and the test harness: install_lifecycle.feature + lifecycle_steps.rs + loopback_http.rs), plus my own targeted verification of the width-computation edge cases and the merge/numbering state against current main.

This implements ROCMAI-770 (installer progress bars rendering garbled/stacked in the terminal, reported from a WSL2/Windows Terminal recording). The fix takes a different, more general approach than the ticket's suggested one (which proposed a plain-line fallback for non-capable TTYs): it measures the real terminal width on fd 2 and passes it to curl/wget instead of trusting a possibly-stale COLUMNS, which also fixes the WSL2 case described in the ticket. That's a reasonable and arguably better fix than the literal suggestion, and the PR text says so.

Blocking

None

Non-blocking

  • tput's stated "reads its own stdin" rationale doesn't match observed behavior — install.sh:97-101
    The comment justifies redirecting tput's stdin to fd 2 by saying tput otherwise sizes from its own stdin (the pipe, under curl|sh). Reproduced locally against ncurses tput 6.4: it reads winsize from fd 2 if that's a tty, else fd 1, independent of any <&N redirect on the invocation — a simulated curl|sh layout returned the correct width with no redirect at all. The fix still works and is harmless today, but the comment's explanation for why appears wrong for this implementation and could mislead a future maintainer, or someone assuming the trick transfers to a different introspection tool/tput variant (e.g. busybox). Confidence 75 · mechanical · Fix: soften or re-verify the comment's claim, possibly across tput implementations.
    (Posted inline on install.sh:101.)

Decisions for the author

  • Known scenario-numbering conflict is now bigger than disclosed — tradeoff/FYI
    The PR description already flags that PR #207 added lifecycle-28–31 to this feature file and that "whichever merges second renumbers." That's since happened, but main has moved further: it now also has lifecycle-32–35 (fish-completion scenarios, apparently from a later PR), which directly collide with this PR's own lifecycle-32–37 (the new progress scenarios). git merge-tree against current main shows real, non-trivial conflicts in both install.sh and docs/testing.md, not just the feature file. The repo has a CI test (scenario_names_are_indexed_sequentially_per_feature in tests/e2e-cucumber/tests/feature_naming.rs) that enforces sequential per-feature numbering, so this will need the new scenarios renumbered past 35 (not just past 31) as part of the rebase, in addition to resolving the install.sh conflict. Flagging since it's larger in scope than what the PR text anticipated, not because the code itself is wrong.

Positive signals

  • The width-computation edge cases (zero, zero-padded values like 080/007, negative values, non-numeric garbage, empty COLUMNS) were traced and reproduced under dash; all resolve correctly to the intended fallback/threshold behavior with no crash — this is careful, well-tested shell arithmetic for a notoriously easy-to-get-wrong class of bug (octal-literal parsing of zero-padded numbers in POSIX arithmetic).
  • The curl-ignores-COLUMNS-≤20 threshold the script works around is an undocumented, non-obvious implementation detail of curl's --progress-bar, and the script's own -le 21 / width - 1 reservation lines up with it precisely.
  • The regression tests are not vacuous: each of the three claimed behaviors (width fix, narrow-terminal notice, wget -nv change) was checked to actually fail against the pre-fix script and pass against the fix, including the one genuinely tricky testing detail — asserting on a vt100-rendered grid's physical rows rather than contents(), which would reflow wrapped lines and hide exactly the bug class this PR fixes (the PR text calls this out, and it checks out against the code).
  • The incidental Windows cross-compile fix (#[cfg(unix)] around the one std::os::unix::fs::symlink call in lifecycle_steps.rs) is correctly scoped and verified against the Windows CI lane, which is green.

Deployment notes

  • mergeable_state is currently dirty against main with real textual conflicts in install.sh and docs/testing.md, plus the scenario-numbering collision above. This branch will need a rebase/merge and renumbering before it can land as-is; none of this reflects a defect in the code itself, and all CI checks that have run against the current head commit (f0696b33) are green.
  • No migration or config changes; behavior change is confined to how fetch() draws download progress, matching the PR's own risk assessment.

What this covered

Read the full diff (435fbccbd71dbf1da6d572168583b6aced41f49e...f0696b3348437c795b39e9db23af9ee5effca3de) and the complete current versions of all five changed files (install.sh, docs/testing.md, install_lifecycle.feature, lifecycle_steps.rs, loopback_http.rs), via two independent fan-out passes grouped by coupling (production script vs. test harness), each reading full files rather than only diff hunks. I additionally: reproduced the width-computation edge cases directly under dash; cross-checked install.ps1 and the rest of the repo for a duplicate/parallel instance of this bug (none found — PowerShell's installer uses Invoke-WebRequest, unaffected); compared scenario numbering and ran git merge-tree against current main to check mergeability; read the referenced ticket (ROCMAI-770) for intent, and the PR description, both after the blind passes completed. Checked CI via the PR's check-runs API (37 runs, all success except two explicitly skipped steps unrelated to this change). Agent-instruction adherence was checked against AGENTS.md's bug-fix/regression-test and Gherkin-scenario-coverage rules; both are satisfied. Did not run: history pass found no notable prior convention being broken; prior-review-thread reconciliation was intentionally not done — this review did not read this PR's existing discussion/review comments, by design.


🤖 Automated by an AI agent

Comment thread install.sh
# `curl ... | sh` is the pipe, making ncurses report its 80-column default
# instead of the terminal. COLUMNS is blanked because ncurses consults it
# first, and would hand back the stale value this function exists to escape.
width="$(COLUMNS='' tput cols <&2 2>/dev/null || true)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking (comment-accuracy only, confidence 75): the comment above says tput "sizes from its own stdin," which is why the <&2 redirect is said to be needed. Reproduced locally against ncurses tput (6.4): tput cols reads the winsize from fd 2 if it's a tty, else fd 1, regardless of any <&N redirect applied to the invocation — a simulated curl|sh layout (fd0=pipe, fd1/fd2=tty) returned the correct width with no <&2 redirect at all, and tput cols <&1 with fd2 as the tty still reported fd2's size. So the fix still works (this is harmless today), but the stated mechanism for why the redirect matters appears to be wrong for this tput implementation, and could mislead someone who tries to "simplify" based on the explanation, or assumes the same trick transfers to a different introspection tool. Might be worth softening the comment's claim or re-verifying against the busybox/non-ncurses tput variants this script may also run under.

Conflicts in the install-lifecycle suite only, both from main growing
alongside this branch:

- install_lifecycle.feature: main added lifecycle-32 to -37 (fish PATH and
  completions, and the two default-trust scenarios). This branch's six
  progress scenarios keep their @id tags and move to lifecycle-38 to -43 so
  the per-feature numbering stays sequential.
- lifecycle_steps.rs: both sides added fields to the lifecycle world struct
  and its initialiser. Kept both sets.

Signed-off-by: John Lybeck <john.lybeck@amd.com>
@github-actions

Copy link
Copy Markdown
Contributor
Security scan found no critical or high findings on lines changed by this pull request

View the security scan run for complete reports.

“New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta.

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review — no blocking findings

Full review of the whole change (9101286a...1269b46a), covering all 5 changed files: install.sh, docs/testing.md, tests/e2e-cucumber/features/install_lifecycle.feature, tests/e2e-cucumber/src/loopback_http.rs, tests/e2e-cucumber/tests/e2e/lifecycle_steps.rs.

This claims to implement ROCMAI-770; that ticket lives in an internal tracker not retrievable from here, so its intent is taken only from the PR description. The description's account of the fix (measure the real terminal width on fd 2 via stty/tput, pass it to curl as COLUMNS instead of trusting a possibly-stale inherited value, and add -nv to wget's invocation) matches the code exactly, including every specific technical claim I could independently check: the stty size <&2 / tput cols <&2 fd-2 reads, the "0 treated as unmeasured" handling, the leading-zero-stripping loop for a zero-padded COLUMNS, the <=21 cutoff lining up with curl's documented ≤20 ignore-threshold, the vt100 rows()-not-contents() distinction in the test harness, the wget -nv --show-progress combination, the loopback_http.rs doc-comment fix, and the #[cfg(unix)] fix around the one non-portable symlink call feeding the Windows build. One cosmetic drift: the description's prose still cites scenario numbers lifecycle-32–37 from an earlier round; the final merge (see below) renumbered them to 38–43 to avoid colliding with scenarios that landed on main in the meantime. Not a blocking mismatch — the described behavior and test coverage are unchanged, only the historical numbers in the prose are stale.

What changed since my own earlier approval of this PR at f0696b33: I diffed the PR's own content (not the raw commit range, which is dominated by an unrelated 100+-commit main history gap) by comparing "PR diff vs. its base" at both commits. The two are byte-identical except for line-number shifts and the lifecycle-32..37 → 38..43 scenario renumbering. The commit since my approval is a no-op merge of main into the feature branch that resolves the textual conflicts and numbering collision my earlier review's "Decisions for the author" section had flagged as a disclosed-but-larger-than-stated risk. No new logic shipped since that approval.

Blocking

None

Non-blocking

  • tput's stated "reads its own stdin" rationale doesn't match observed behavior — install.sh:97-101
    Standing from my earlier review of this PR (code here is unchanged since then): the comment justifies redirecting tput's stdin to fd 2 by saying tput otherwise sizes from its own stdin (the pipe, under curl|sh). Reproduced against ncurses tput 6.4: it reads winsize from fd 2 if that's a tty, else fd 1, independent of any <&N redirect — a simulated curl|sh layout returned the correct width with no redirect at all. The fix still works and is harmless, but the comment's explanation for why appears wrong for this implementation and could mislead a future maintainer, or someone assuming the trick transfers to a different tput variant (e.g. busybox). Confidence 75 · mechanical · Fix: soften or re-verify the comment's claim across tput implementations.
    (Posted inline on install.sh:101.)

Decisions for the author

None beyond the item above.

Positive signals

  • The width-computation edge cases (0, zero-padded 080/00/000/0800, exactly-22, exactly-21, non-numeric, negative, empty) were traced and reproduced live under dash; all resolve to the intended fallback/threshold with no crash, including the specific dash octal-literal arithmetic failure (Illegal number: 080) the PR cites as the original bug, which I reproduced directly.
  • The regression tests are not vacuous: each of the three originally-claimed behaviors (width fix, narrow-terminal notice, wget -nv) has a scenario wired through a real portable_pty PTY and a vt100-rendered screen, asserting on physical rows rather than contents() (which would reflow a wrapped line and hide exactly the bug class this PR fixes) — I verified this distinction is real in the code, not just asserted in a comment.
  • Every new Gherkin step text matches exactly one #[given]/#[when]/#[then] implementation; no orphaned or ambiguously-matched step found.
  • The Windows-build fix (#[cfg(unix)] around the one std::os::unix::fs::symlink call in the new shadow_path helper, with an unreachable!() stub on the other side) is correctly scoped, and the Windows CI lane (windows-build-and-test) is green at this head.

Deployment notes

No migration or config changes; behavior change is confined to how install.sh's fetch() draws download progress, matching the PR's own risk assessment. install.ps1 (Windows) uses Invoke-WebRequest, not curl/wget, so it is not affected by and does not need this fix.

What this covered

Read the full diff (9101286acfe1d071b2d1ae43739f937593589ad7...1269b46af2d1d28ab31e8c6aab4bd52dad4bbff5) and the complete current versions of all five changed files, plus install.ps1, README.md, and docs/manual-testing.md for impact-analysis cross-checks, plus AGENTS.md for agent-instruction adherence. Verified several edge cases by executing shell snippets directly under dash/sh rather than only reading the code.

Fan-out degraded to single-context: I attempted to spawn two independent workers (one for install.sh, one for the test-harness group) and both attempts failed with the environment's concurrent-subagent limit already exhausted (20/20 slots in use by other sessions at review time); a retry was explicitly disallowed. This review therefore ran as a single context rather than the independent-worker fan-out the method calls for — recommend re-running with fan-out available if a second opinion is wanted. I compensated with live reproduction of the shell arithmetic in dash and a close, complete read of every changed file plus its surrounding code, which is why I'm confident in the findings above despite the degraded mode, but coverage of subtler cross-file issues is inherently weaker without independent workers.

Did not run: "history" pass found nothing notable beyond what's in the report; "prior changes" pass — I hold a standing APPROVED review of this PR at commit f0696b33 (same account), reconciled above after my own blind pass completed; this review's findings were reached blind before I read that prior review or any other reviewer's comments on this PR.

CI: all checks/statuses for head 1269b46a are green (build-and-test, clippy, windows-build-and-test, E2E tests, E2E consolidated report, security scans, docs build, etc.) with one exception: E2E tests (MI300X, current) (a self-hosted GPU-hardware job) was still in_progress at review time. This job exercises GPU-dependent engine paths (vLLM/Lemonade/AIM) that this change does not touch, so I have no reason to expect it to fail because of this PR, but it had not resolved either way as of this review — flagging per policy rather than assuming it passes. Recommend a quick re-check once it completes before merge.

Not reconciled against PR discussion threads during the blind pass; reconciled only afterward, as described above.


🤖 Automated by an AI agent

Comment thread install.sh
# `curl ... | sh` is the pipe, making ncurses report its 80-column default
# instead of the terminal. COLUMNS is blanked because ncurses consults it
# first, and would hand back the stale value this function exists to escape.
width="$(COLUMNS='' tput cols <&2 2>/dev/null || true)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking (standing from my earlier review at f0696b3, code here is unchanged): the comment on lines 97-101 justifies redirecting tput's stdin to fd 2 by saying tput otherwise sizes from its own stdin (the pipe, under curl|sh). Reproduced locally against ncurses tput 6.4: it reads winsize from fd 2 if that's a tty, else fd 1, independent of any <&N redirect on the invocation — a simulated curl|sh layout returned the correct width with no redirect at all in my testing. The fix still works and is harmless today, but the comment's stated rationale appears not to match this tput's actual behavior, and could mislead a future maintainer or someone assuming the trick transfers to a different tput variant (e.g. busybox). Confidence 75 · mechanical · Fix: soften or re-verify the comment's claim across tput implementations.

@johnl-amd
johnl-amd added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit cdc3aee Nov 17, 2026
47 checks passed
@johnl-amd
johnl-amd deleted the ROCMAI-770-installer-progress-display branch November 17, 2026 14:27
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.

5 participants