Skip to content

feat(load): progress lines, --load-interval time series and --load-warmup - #2916

Merged
cliffhall merged 6 commits into
v2/mainfrom
v2/feat/2838-load-progress-intervals
Nov 5, 2026
Merged

cliffhall merged 6 commits into
v2/mainfrom
v2/feat/2838-load-progress-intervals

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Part of #2838 (items 1–3). The issue stays open for items 5, 7 and 8, which follow in one more PR; items 4 and 6 landed in #2915, and item 9 is filed as #2910–#2914.

What

Progress (item 1). Every --load-progress <sec> (default 5), a line goes to stderr:

[load 12.0s] 1234 calls (1230 ok, 4 failed), 102.3/s, p50 12.1 / p99 40.2 ms
  • It shows the totals so far, plus the completion rate and the successful-call p50/p99 over the last interval. It is prefixed warm-up or stage N when that applies.
  • In the one-shot CLI it is on by default, and --quiet turns it off.
  • In mcpdo, the daemon writes each report as a new one-way load-progress frame on the rpc call's socket, ahead of the response. This uses a new optional ElicitationChannel.notify, and the client gets an onLoadProgress option. The front end prints it to stderr only with --format text: --format json strips progressMs before sending, so the daemon emits nothing.

Time series (item 2). --load-interval <sec> adds intervals[], the run's calls bucketed by completion time.

  • Buckets are half-open, (start, end], so a completion on a boundary counts in the interval it finished.
  • Empty intervals are included, so the series has no gaps.
  • Each bucket carries the usual counts, rates, latencies and tallies. Buckets use small recorders that switch to the histogram early (200 exact samples).
  • A stepped run carries intervals per stage.

Warm-up (item 3). --load-warmup <sec> first runs a window at the same concurrency, rate and connections, whose calls are discarded. It holds to its deadline, and then the measured window runs.

  • warmup reports durationMs, requests, ok and failed.
  • A warm-up that stops early (breaker, interrupt) ends the run: the measured window starts with that stop already in place, so it runs nothing and reports the same reason.
  • {{seq}} keeps counting across the two windows.
  • Refused with --load-steps / --load-ramp (load_flag_conflict).

mcpdo's text summary adds a warm-up line and one line per interval.

Tests

  • New clients/cli/__tests__/load-progress.test.ts. It covers option resolution and the refusal. On a fake clock: warm-up exclusion, timing and seq; a warm-up that stops the run; interval bucketing with a gap; boundary handling and per-stage series; progress contents, labels and the no-success case; the line format. End to end: progress on stderr plus intervals plus a warm-up, --quiet, the refusal, and requires---load.
  • mcpdo: daemon progress frames (relayed; none without progressMs or without notify), the channel's notify (written before the response, dropped once the socket is gone), flag resolution, text rendering, and a live-daemon run showing progress in text mode and none in JSON.

Docs: CLI README (flag rows plus a "Watching a run" section), mcpdo README, skills/mcpdo/SKILL.md. npm run local:gate green.

🤖 Generated with Claude Code

cliffhall and others added 2 commits November 5, 2026 07:32
…rmup (#2838)

Items 1-3 of #2838:
- Progress: a stderr line every --load-progress seconds (default 5) with the
  totals and the last interval's rate and p50/p99; --quiet turns it off.
  mcpdo relays it from the daemon as one-way load-progress frames, shown in
  --format text only.
- --load-interval <sec>: an intervals[] time series by completion time.
- --load-warmup <sec>: a warm-up window left out of every statistic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label Nov 5, 2026
@cliffhall
cliffhall requested a balanced review from Copilot November 5, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Progress notifications can exhaust daemon memory for slow clients, while staged text output omits interval data and a timing-sensitive test can fail on correct behavior.

3 open issues
What changed in this PR

Adds progress reporting, interval statistics, and warm-up windows to the shared load engine and both CLI clients, implementing items 1–3 of #2838.

Changes:

  • Adds periodic stderr progress, including daemon-to-client progress frames for mcpdo.
  • Collects completion-time interval summaries and excludes warm-up calls from measured statistics.
  • Adds flag handling, documentation, and engine, CLI, and daemon tests.
File Description
skills/​mcpdo/​SKILL.md Documents intervals, warm-up, and text-mode progress.
core/​cli/​handlers/​load-test.ts Implements warm-up windows, interval buckets, and progress hooks.
clients/​mcpdo/​src/​daemon/​server.ts Relays load progress through the caller’s channel.
clients/​mcpdo/​src/​daemon/​protocol.ts Defines the load-progress frame.
clients/​mcpdo/​src/​daemon/​ipc-glue.ts Adds one-way channel notifications.
clients/​mcpdo/​src/​daemon/​client.ts Handles progress frames through a callback.
clients/​mcpdo/​src/​connection/​mcp.ts Registers the three new load flags.
clients/​mcpdo/​src/​connection/​load-flags.ts Resolves intervals, warm-up, and progress options.
clients/​mcpdo/​src/​connection/​format-human.ts Formats warm-up and interval summaries.
clients/​mcpdo/​src/​connection/​dispatch.ts Prints progress and disables it for JSON output.
clients/​mcpdo/​README.md Documents flags and output behavior.
clients/​mcpdo/​__tests__/​load.test.ts Tests options, formatting, and live progress output.
clients/​mcpdo/​__tests__/​daemon-load.test.ts Tests progress-hook setup and frame relay.
clients/​mcpdo/​__tests__/​daemon-ipc-glue.test.ts Tests notification ordering and closed sockets.
clients/​cli/​src/​cli.ts Wires flags and quiet-aware stderr progress.
clients/​cli/​README.md Explains progress, intervals, and warm-up semantics.
clients/​cli/​__tests__/​load-progress.test.ts Tests engine behavior and CLI integration.

Review effort: Balanced

Comment thread clients/mcpdo/src/daemon/ipc-glue.ts Resolved
…ming test

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

Copy link
Copy Markdown
Member Author

Copilot round 1 (review 5785138028), all three fixed in 1106d7d:

  • Unbounded progress-frame backlog for a slow client: frames are now dropped at the stream buffer cap.
  • Timing-sensitive interval count in an end-to-end test: it now asserts conservation, not an upper bound.
  • Stepped runs' intervals missing from mcpdo text output: they are now rendered under each stage.

local:gate green. Requesting round 2.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Warm-up reporting uses the requested rather than actual elapsed duration, and progress reporting in both frontends ignores stderr backpressure, risking unbounded memory growth.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Drop progress reports while stderr is backpressured

clients/​cli/​src/​cli.ts:2202

When stderr is piped to a slow or non-reading consumer, each progress tick keeps buffering another line even after write() returns false, so frequent reports over a long run can exhaust the frontend's memory. Drop advisory reports while process.stderr.writableNeedDrain is true to keep reporting nonblocking and bounded. Apply the same guard in clients/mcpdo/src/connection/dispatch.ts:146; the daemon's socket-buffer cap does not bound the frontend's stderr queue.

Medium severity Report actual warm-up duration after early termination

core/​cli/​handlers/​load-test.ts:818

The warm-up reports its requested duration rather than the time it actually ran. For example, if --load-warmup 60 trips the breaker after 50 ms, this returns durationMs: 60000, and mcpdo prints a 60-second warm-up despite the early stop. Use warm.elapsedMs here so the reported duration also accounts correctly for early termination and in-flight calls draining past the deadline.

3 resolved since last review

Review effort: Balanced

…warm-up's actual duration

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

Copy link
Copy Markdown
Member Author

Copilot round 2 (review 5785305896): no inline comments. Both findings were in the "previously missed issues" block, so they are answered here. Both fixed in 7f00a50:

  • Progress writes ignore stderr backpressure: both front ends (cli.ts writeLoadProgress, mcpdo dispatch.ts onLoadProgress) now skip a line while process.stderr.writableNeedDrain is true, so reporting stays non-blocking and bounded. Tested in each by holding stderr backed up for a run.
  • Warm-up reports its requested duration: warmup.durationMs is now the warm-up's actual elapsedMs, shorter on an early stop and longer when calls drain past it. Tested.

local:gate green. Requesting round 3.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Warm-up unnecessarily retains interval data with memory use proportional to its duration, and premature elapsed-time rounding can report zero throughput for a nonempty final bucket.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Disable interval collection during the warm-up

core/​cli/​handlers/​load-test.ts:810

The warm-up inherits intervalMs through ...options, so runWindow() retains a bucket for every warm-up interval and computes the full time-series summary, only for warm.intervals to be discarded. A long warm-up with fine intervals therefore consumes memory proportional to its length even when the measured run is short. Clear intervalMs in the warm-up options so only the measured window collects the series.

Medium severity Use the unrounded end time for bucket throughput

core/​cli/​handlers/​load-test.ts:1194

Rounding elapsedMs before computing the bucket duration can give a nonempty final bucket zero throughput. For example, with 1000 ms intervals and a final completion at 1000.001 ms, that completion lands in bucket 2, but its end is rounded down to its start (1000), so both throughput fields become 0. Keep the unrounded end for rate calculations and round only the serialized offsets.

Review effort: Balanced

…al rates

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

Copy link
Copy Markdown
Member Author

Copilot round 3 (review 5785464078): no inline comments. Both findings were in the "previously missed issues" block, so they are answered here. Both fixed in e29cb43:

  • The warm-up keeps a time series it throws away: the warm-up window now runs with intervalMs cleared, so only the measured window builds buckets. A test confirms the measured series is unaffected; the discarded buckets are not observable from outside, so it cannot fail on the old code.
  • Rounded elapsedMs zeroes a final sliver bucket's rate: bucket rates now use the unrounded end, and only the reported startMs/endMs are rounded. A regression test covers a completion at 1000.001 ms on 1000 ms intervals.

local:gate green. Requesting round 4.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because an unpublished finding identifies help text recommending an unsupported --quiet option that fails with an unknown-option error.

No open issues 🎉

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 4 (review 5785597578): no inline comments. The headline flagged help text pointing at an unsupported --quiet. Fixed in 6386cb6:

  • mcpdo's --load-progress help now says the line is shown with --format text only, and that --format json prints none, which is how mcpdo actually silences it. I had copied the old text from the one-shot CLI, where --quiet does exist. A test checks tools/call --help.

local:gate green. Requesting round 5.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the load-engine and CLI changes.

No open issues 🎉

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot review loop closed: round 5 (review 5785719044) was clean, with no inline comments, no headline finding and no suppressed block. All findings from rounds 1–4 were fixed.

@cliffhall
cliffhall merged commit 467966d into v2/main Nov 5, 2026
12 checks passed
@cliffhall
cliffhall deleted the v2/feat/2838-load-progress-intervals branch November 5, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants