Skip to content

[rush-cli-client] Add agent output mode and honor useRushReporter on the daemon path - #6082

Merged
Sean Larkin (TheLarkInn) merged 3 commits into
mainfrom
thelarkinn-rushd-agent-reporter
Sep 24, 2026
Merged

Sean Larkin (TheLarkInn) merged 3 commits into
mainfrom
thelarkinn-rushd-agent-reporter

Conversation

@TheLarkInn

@TheLarkInn Sean Larkin (TheLarkInn) commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an opt-in agent output mode to rush-client on the daemon path. You turn it on with RUSHD_OUTPUT=agent, or it switches on automatically when the COPILOT_CLI agent marker is set. The client also no longer silently ignores the experiments.json useRushReporter setting. Without either of these, output is unchanged. Explicit reporter controls (--reporter, --output, --log-level, RUSH_REPORTER, RUSH_LOG_LEVEL) are routed to the native reporter path exactly as before.

Root cause

  • The daemon client could only print the legacy collated stream. Agents saw nothing for a long time: rush-lib had to load first, quiet verbosity hid progress, the queue position only showed on a TTY, and a no-op printed no summary.
  • useRushReporter: true (board bug 45) was never read by the client. Repositories that opted into the native reporter silently got legacy daemon output instead.

Fix

Review follow-up (A04, board #313/#333)

The first revision sent --reporter=ai to agent mode. That caused three regressions:

  • --reporter=ai --no-daemon printed legacy output;
  • --reporter=ai was dropped when the client fell back in-process;
  • --reporter=ai produced plain text instead of AI JSON records.

Fix: an explicit reporter keeps its pre-PR native routing, and agent mode is chosen only when no reporter was requested. On Linux, all three cases now print native ai.status and ai.final JSON with nothing in front of it.

Tests

  • Renderer: first line; final line on success, failure, no-op and queued runs; failure tails (stderr and stdout); pipe throttling; at most 3 TTY rows with width clipping.
  • outputSelection:
    • the order of the selection controls;
    • explicit reporter controls (--reporter=ai with and without --no-daemon, --output, RUSH_REPORTER=ai, RUSH_LOG_LEVEL) always get legacy;
    • useRushReporter gets legacy;
    • arguments after -- are ignored;
    • reading experiments.json (including commented-out settings) and finding rush.json from a nested folder.
  • Routing: --reporter=ai, --reporter ai, --reporter=ai --no-daemon and RUSH_REPORTER=ai all go native; useRushReporter true/false; the argv reaches the native path unchanged; rushx ignores useRushReporter.

Linux validation (WSL Ubuntu-24.04, Node 22)

rush build --to @rushstack/rush-cli-client (including lint) and rush test --only @rushstack/rush-cli-client pass.

Scenario runs used a synthetic 12-project workspace (mkws-synth), stdout piped, all in one lab invocation:

  • before = the unfixed rush-client
  • legacy = this PR, default output
  • agent = this PR, RUSHD_OUTPUT=agent

"First output" is the time to first output.

scenario before: first output / lines legacy: first output / lines agent: first output / lines agent final line
cold auto-start --to p01 3233 ms / 3 3905 ms / 3 52 ms / 4 SUCCESS 1/1 operations (1 from cache) in 4.4s
warm no-op none / 0 none / 0 44 ms / 3 SUCCESS 12/12 operations (12 no op) in 1.0s
1-file change 929 ms / 3 914 ms / 3 52 ms / 3 SUCCESS 12/12 operations (11 skipped, 1 success) in 1.5s
failing build (p05) 1144 ms / 18 1003 ms / 18 38 ms / 4 FAILURE 12/12 ... failed: p05 (build) + error TS2322 ...
queued behind a running build 8235 ms / 1 — 38 ms / 5, queue notice at 0.7 s (see note)

Line counts for legacy match before, so the default output is unchanged.

Explicit reporter runs after the review fix:

run result
build --reporter=ai (daemon enabled) native ai.status + ai.final JSON, 2 lines
build --reporter=ai --no-daemon native ai.status + ai.final JSON, 2 lines
build --reporter=ai, daemon unavailable (in-process fallback) native ai.status + ai.final JSON, 2 lines
RUSH_REPORTER=ai build native behavior, identical to main
RUSHD_OUTPUT=agent, daemon unavailable agent line, then fallback notice, then native legacy output

Queued note: in this workspace, a queued request that follows a source edit fails in every mode with The successor requested another restart; the single safe retry was exhausted. That problem exists without this PR and is out of scope here. With agent mode, the queue notice now appears at 0.7 s instead of nothing on the pipe for 8 s.

CI note: the first Windows run failed in rush-cli-client daemonLogs.test.ts, on the log-file "replace" case, with a 5 s jest timeout on Node 26. That test calls printDaemonLogAsync directly and does not load any file this PR changes, and it passed on Node 24 Windows in the same run. The same run also failed rush-reporter Performance.test.ts, which is in a package this PR doesn't touch. Both look like Windows flakes, and main has similar Windows failures.

Follow-ups (optional)

  • Render the native reporter over the daemon protocol, so useRushReporter repositories can use the daemon.
  • Read agent variables configured in rush.json for detection.
  • Agent output for rushx-client.

Fixes #6076

Came out of the automated rushd Linux analysis (Rushd Hive; board threads 45, 72, 184, 187, 313, 333; prototype by A04).

…the daemon path

Fixes #6076

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… agent mode only when no reporter is chosen

Addresses review: --reporter=ai (with or without --no-daemon, and on fallback) and RUSH_REPORTER=ai keep the native AI reporter JSON; agent mode writes nothing ahead of native reporter output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Agent summaries can miscount operations, omit relevant failure diagnostics, and skip output for supported argument forms.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 5 Medium severity · 1 Low severity

Open (6)
What changed in this PR

Adds agent-oriented daemon output while preserving native reporter routing.

Changes:

  • Adds compact agent progress rendering and output selection.
  • Honors useRushReporter through native routing.
  • Adds tests and documentation for routing and rendering.
File Description
common/​changes/​@rushstack/​rush-cli-client/​agent-reporter_2026-09-24-02-35.json Records the patch change.
apps/​rush-cli-client/​src/​AgentProgressRenderer.ts Implements agent progress output.
apps/​rush-cli-client/​src/​outputSelection.ts Selects output mode and reads reporter opt-in.
apps/​rush-cli-client/​src/​start.ts Starts early agent rendering.
apps/​rush-cli-client/​src/​launchClient.ts Integrates rendering with daemon execution.
apps/​rush-cli-client/​src/​routing.ts Routes reporter-enabled repositories natively.
apps/​rush-cli-client/​src/​test/​AgentProgressRenderer.test.ts Tests agent rendering.
apps/​rush-cli-client/​src/​test/​outputSelection.test.ts Tests output selection.
apps/​rush-cli-client/​src/​test/​routing.test.ts Tests native reporter routing.
apps/​rush-cli-client/​README.md Documents output modes and precedence.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread apps/rush-cli-client/src/AgentProgressRenderer.ts
Comment thread apps/rush-cli-client/src/AgentProgressRenderer.ts Outdated
Comment thread apps/rush-cli-client/src/launchClient.ts
Comment thread apps/rush-cli-client/src/outputSelection.ts Outdated
Comment thread apps/rush-cli-client/src/start.ts
Comment thread apps/rush-cli-client/src/AgentProgressRenderer.ts
…re tails, final line on rejection, admission-control command name, normalized RUSH_REPORTER, queue dedup

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@TheLarkInn
Sean Larkin (TheLarkInn) merged commit 23cb488 into main Sep 24, 2026
15 of 16 checks passed
@TheLarkInn
Sean Larkin (TheLarkInn) deleted the thelarkinn-rushd-agent-reporter branch September 24, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

[rush] rush-cli-client: no agent-oriented reporter on the daemon path, and the repository reporter opt-in (useRushReporter) is silently ignored

3 participants