Repository navigation
feat: long-running commands report progress on stderr - #6672
Merged
Merged
Conversation
An acting gc streams the stimd pass's phase lines to every request on the pass, engine install/use/update and remote update print their slow steps, and LLP 0030 records the rule. Fixes #6669.
Collaborator
Author
|
Sample: |
janicduplessis
marked this pull request as ready for review
November 29, 2026 03:10
janicduplessis
enabled auto-merge (squash)
November 29, 2026 03:11
This was referenced Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An acting
stim gcruns on this home's stimd. Until now the client heard only the actions the pass took. Between the request and the first action (measuring pressure, finding checkouts, sizing caches, planning) it printed nothing. With a few hundred registered projects that silence can last minutes, and a slow run looks hung.stim engine install|use|updateandstim remote updatewere also silent while they fetched, self-tested or waited.Maintainer decisions, quoted on #6669:
Solution
Progress reuses the format native builds already print:
phaseLine(label, text)fromcommand-output.ts, through gc's existingphase()helper. It is one line per phase plus a summary line, always on stderr, in JSON mode too. There is no TTY gate (an agent's stderr is never a TTY), no spinner and no carriage-return redraw.gc (acting).
runMaintenanceAtLeveltakes an optionalonPhase. OnlyrunGcPasspasses it, so--dry-run,--refreshand the storage report print exactly what they printed before.level,discover,measure,plan(with the action count),dormantandladder. A finalgc finished: N actions taken, X freed[, F failed] in Tline closes the run. The client prints onegcline before it asks stimd.gc.outputbesidegc.action. The client opts in withprogress: trueongc.run.disk-owner.ts. A request that joins a pass already under way hears the lines from the point it joined, after onegc joining a pass already under way ...line. A tick or lane pass prints none.done|failed|kept <kind> <target>) are unchanged.keptrows are already one per plan skip. Collapsing them into a count is left out of this PR.engine install/use/update print
engine fetching stim X from npm(or which directory or packages they add) andengine checking and self-testing stim X. The second line prints in the calling process before it hands the new build its ownengine-select, whose stderrrunFileAsynccaptures. remote update prints one line when it starts waiting on the remote machine, which can take up to 10 minutes.Rule. AGENTS.md invariant 7 gains the rule, and the new LLP 0030 holds it with both quotes and the gc transport design. The
factsguide topic (the output streams contract) andwebsite/docs/commands.mdget two short sentences each. Guide budgets are unchanged.Overlap with #6623 / #6625. Both PRs also touch
commands/gc.ts,daemon/client.ts,stimd/main.ts,stimd/threads.ts,guide/facts.tsandwebsite/docs/commands.md. This PR changes only a few lines in each:gc.ts: the acting pass'sonPhase, its summary and one client line.client.ts: theprogressopt-in, andgc.outputaccepted for non-headroom requests.main.ts: one argument.threads.ts: an optionaloutputargument, plus wrapping the pass operation's output.Nothing touches the report,
--dry-run,--refresh,stimd/gc-report.ts, DesktopReports or the report cache.Audit: commands that can run long
ios,androidcompiling/ok, device, install, launch); silent during the compile itselfmacosstartstopworktree add/warmworktree removeremovedtestrevivecisetup--json)doctor--fixprints phase linesgc(acting)gc --dry-runengine install/use/update/rollbackremote updateshareservices startdevice provisionremote addplugin testservice installstatsThe rows marked "not changed" with no or partial progress are follow-ups under the same rule. This PR does the gc acting run that #6669 names first, plus the two silent commands with an obvious seam.
Test plan
stimd-gc.integration.test.ts, new case: a real stimd runs an actinggc --json. Stdout holds exactly one parseable payload, and stderr carries ameasurephase line that only the stimd pass prints. With the stimd hook disabled, the case fails.stimd-gc.integration.test.ts, second new case: a rawgc.runwithoutprogressgetsgc.doneand nogc.output, so an older client never sees a message it would fail on. With the stimd guard removed, the case fails.gc-queue.test.ts: a request that joins a pass under way hears the join line and the pass's progress line, and its action listener still sees only actions.pnpm teston the gc, engine-store, remote-update, api-reports and disk-owner tests; the guide and guide-budget tests;pnpm run typecheck;oxlint;oxfmt --check;scripts/ref-check.mjs.STIM_HOME(its ownHOMEand engine root, one registered fixture cache, after a dry run showed nothing outside that home was in scope):stim gc --pressure criticalandstim gc --pressure critical --json. Output is in the first comment.Fixes #6669