Repository navigation
fix: show a download meter when adding packages in a sandbox - #1583
Conversation
In-session min add only printed a static "fetching" line while bytes downloaded. Paint the existing fetch progress as a bar the in-sandbox helper redraws in place. Co-authored-by: Cursor <cursoragent@cursor.com>
Clear the meter instead of leaving its last frame in scrollback, keep finished downloads in the totals so the fill never moves backwards, scope an add's meter to the packages it installs, re-read the terminal width per paint, and paint the same meter for in-box min build.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 5 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change adds a sandbox progress reporter for package installation and builds. It formats fetch and build status, relays progress frames through the helper, and redraws those frames on terminal output. ChangesSandbox progress reporting
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Build as Install or build events
participant Relay as sandbox_progress::relay
participant Progress as SandboxProgress
participant Helper as __min_rpc
participant Terminal as Terminal output
Build->>Relay: Forward operation events
Relay->>Progress: Refresh progress and render messages
Progress->>Helper: Write bar: and msg: frames
Helper->>Terminal: Redraw meter and print messages
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change adds a live download and build progress meter to 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
A rabbit watches fetch bytes flow, Comment |
|
Approved: no findings at Nothing to do. Clobber: none: |
Treat a zero reported length as unknown, give a finished unknown-length download the size it received, and reset the totals once no download is in flight. Measure the progress line against the terminal stdout writes to, and keep narrow widths instead of assuming 80 columns.
Summary
In-session
min addprinted a staticfetching <pkg>line per package and nothing while the bytes downloaded. The in-sandbox helper path (SessionChannel::install→/run/minenv_sock→env_min_helper.sh) only ever carried one-shotmsg:lines, so it could not animate.This adds a
bar:line to that protocol, painted from the byte progress the sessionOpTrackeralready records:bar:clears the row.bar:in place on a TTY, clears it before anymsg:/error:and at exit (no stale partial frame left in scrollback), and drops it when stdout is a pipe or log. Width is re-read per paint so a resize does not wrap the row.min add's meter is scoped to the added packages and their build/runtime closure, so a task building in another shell on the same session does not take it over.FetchSource/FetchIndexname no package and remain unscoped.min buildgets the same meter via the sharedsandbox_progress::relay.Testing
cross clippy -p minimald --all-targets --target aarch64-unknown-linux-musl -- -D warnings: clean.cross test -p minimald: all pass except twonsenter::testscases (a_shim_that_is_no_longer_on_disk_is_named_as_the_failure,the_registered_shim_overrides_current_exe_and_yields_to_an_explicit_one), which fail identically on unmodifiedmainunder cross.sandbox_progressunit tests: meter formatting, monotonic totals, fetch→extract handoff, zero/unknown lengths, reset after an idle gap, scoping, clear-on-finish, repaint-after-message, andrelayend to end.msg:lines).just e2e(macOS, HVF):session e2e OK, including the in-sandboxmin add jqproof over a real pty.min add rustin-box over a real pty (cold cache). 149 in-place meter paints, e.g.Fetch sqlite +2 [> ] 1.39 MiB / 419 MiB→Fetch rust [================] 419 MiB / 419 MiB; zero backward steps in the byte count; final screen shows only thefetching …/Installed rustlines, no leftover meter frame.Checklist
BREAKING CHANGE:footer present if this is a breaking change