[PR #7042] [MERGED] feat(cli): report opt-in command timings #7598

Closed
opened 2026-11-03 13:39:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7042
Author: @dhruvac29
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @gensokyo-dev

Base: main ← Head: feat/5484-cli-timings


📝 Commits (5)

  • f1dfc96 feat(cli): report opt-in command timings
  • b75b6bd fix(cli): time standalone MCP doctor
  • 67b5648 fix(cli): retain timing on doctor errors
  • 5251591 Merge remote-tracking branch 'origin/main' into fix/5484-cli-timings-followup
  • 0c3261d fix(cli): preserve formatted version output with command timings

📊 Changes

7 files changed (+178 additions, -15 deletions)

View changed files

📝 docs/cli.md (+9 -0)
📝 scripts/rea.mjs (+28 -9)
📝 src/cli.ts (+29 -3)
📝 src/cliBuiltinArguments.ts (+4 -2)
📝 src/cliOutput.ts (+5 -1)
➕ tests/acceptance/cliTimings.test.ts (+68 -0)
📝 tests/boundary/cli/mcpDoctorHelpCli.test.ts (+35 -0)

📄 Description

Summary

Fixes #5484. Adds opt-in --timings command-dispatch measurements on stderr while keeping JSON/Evidence stdout unchanged. Normal commands measure dispatch plus result delivery; the standalone production MCP doctor dispatcher also emits one versioned timing record, including on failure.

The follow-up synchronizes the PR with main aa6f6436c, retains the shared builtin-argument owner and CSV/TSV adaptation, and fixes a real stdout regression: adding --timings previously made --version --json print a bare version. The version-report selector now recognizes this presentation flag; a public CLI regression checks byte-identical JSON stdout. Root version reporting has no command interval and emits no timing record.

No provider, MCP schema, Evidence, target authority or dependency changes. This is CLI presentation within existing scope; a new provider/execution scope decision is not applicable.

Validation performed

Linux, Node 24.22.1 / npm 11.16.0, at most two test workers:

  • npm run test:focused -- tests/acceptance/cliTimings.test.ts tests/boundary/cli/mcpDoctorHelpCli.test.ts tests/boundary/cli/completions.test.ts: 13/13 passed on the final source, covering success, typed failure, formatted version output, standalone doctor timing, flag-shaped option values and public Bash completion.
  • npm run docs:check: passed, including 9 README consistency checks.
  • npm run check:fast: passed on final source.
  • Bounded GOMEMLIMIT=2GiB timeout --kill-after=5s 90s oxlint --type-aware --threads 1 on the four touched TypeScript files: passed, warnings only. Whole-repository typed lint was not rerun after its excessive resource cost in the preceding change.
  • git diff --check: passed.

Real-data and efficiency evidence

Ran public inspect-elf-notes /usr/bin/true --json with and without --timings, three times each. The real system ELF produced byte-identical JSON stdout in all six runs: 5,119 bytes / ~1,600 tokens. Timing adds one ~18-token stderr record only when requested, plus the flag's small input cost; token counts use tokenx, not a model tokenizer. Help/schema-discovery costs were not measured. The reported command intervals were 38–47 ms, explicitly separate from process startup.

Initial run / mean of two subsequent fresh-process runs:

Mode Elapsed seconds CPU seconds Sampled process-family peak MiB
default 2.174 / 2.468 2.358 / 2.676 208.5 / 210.6
timing requested 2.473 / 2.446 2.584 / 2.656 209.4 / 203.2

RSS sampled every 10 ms, CPU from wait4; filesystem cache state was uncontrolled and host load varied. These data do not establish a speedup or a precise micro-overhead. No caching was added. One earlier benchmark overlapped artifact regeneration and was discarded; the reported run was sequential after builds and documentation checks. No real deep-analysis provider was exercised.

Compatibility and limits

The flag defaults off. Timing records contain only version and duration, not target paths or data. Command timing does not claim provider phases, complete process lifetime or analysis-only duration. Stdout continues through the existing shared CLI/Evidence boundary.

Expected effects:

  • Documentation or usability only; no target interaction.

Author readiness

Human owner: @dhruvac29

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7042 **Author:** [@dhruvac29](https://github.com/dhruvac29) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `feat/5484-cli-timings` --- ### 📝 Commits (5) - [`f1dfc96`](https://github.com/morluto/rea/commit/f1dfc96629f6fc8686f82bb025033b59d420cafb) feat(cli): report opt-in command timings - [`b75b6bd`](https://github.com/morluto/rea/commit/b75b6bd2b79183373987cee6c649ad002926f174) fix(cli): time standalone MCP doctor - [`67b5648`](https://github.com/morluto/rea/commit/67b56489bf7c1294fe8c1f76e6e501509c45ecd1) fix(cli): retain timing on doctor errors - [`5251591`](https://github.com/morluto/rea/commit/5251591eb7de4dcb753e59f6056ce691f3abeea1) Merge remote-tracking branch 'origin/main' into fix/5484-cli-timings-followup - [`0c3261d`](https://github.com/morluto/rea/commit/0c3261d2f956940d5da8f35d2e83ec97e52f925c) fix(cli): preserve formatted version output with command timings ### 📊 Changes **7 files changed** (+178 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `docs/cli.md` (+9 -0) 📝 `scripts/rea.mjs` (+28 -9) 📝 `src/cli.ts` (+29 -3) 📝 `src/cliBuiltinArguments.ts` (+4 -2) 📝 `src/cliOutput.ts` (+5 -1) ➕ `tests/acceptance/cliTimings.test.ts` (+68 -0) 📝 `tests/boundary/cli/mcpDoctorHelpCli.test.ts` (+35 -0) </details> ### 📄 Description ## Summary Fixes #5484. Adds opt-in `--timings` command-dispatch measurements on stderr while keeping JSON/Evidence stdout unchanged. Normal commands measure dispatch plus result delivery; the standalone production MCP doctor dispatcher also emits one versioned timing record, including on failure. The follow-up synchronizes the PR with main `aa6f6436c`, retains the shared builtin-argument owner and CSV/TSV adaptation, and fixes a real stdout regression: adding `--timings` previously made `--version --json` print a bare version. The version-report selector now recognizes this presentation flag; a public CLI regression checks byte-identical JSON stdout. Root version reporting has no command interval and emits no timing record. No provider, MCP schema, Evidence, target authority or dependency changes. This is CLI presentation within existing scope; a new provider/execution scope decision is not applicable. ## Validation performed Linux, Node 24.22.1 / npm 11.16.0, at most two test workers: - `npm run test:focused -- tests/acceptance/cliTimings.test.ts tests/boundary/cli/mcpDoctorHelpCli.test.ts tests/boundary/cli/completions.test.ts`: **13/13 passed** on the final source, covering success, typed failure, formatted version output, standalone doctor timing, flag-shaped option values and public Bash completion. - `npm run docs:check`: passed, including 9 README consistency checks. - `npm run check:fast`: passed on final source. - Bounded `GOMEMLIMIT=2GiB timeout --kill-after=5s 90s oxlint --type-aware --threads 1` on the four touched TypeScript files: passed, warnings only. Whole-repository typed lint was not rerun after its excessive resource cost in the preceding change. - `git diff --check`: passed. ## Real-data and efficiency evidence Ran public `inspect-elf-notes /usr/bin/true --json` with and without `--timings`, three times each. The real system ELF produced byte-identical JSON stdout in all six runs: **5,119 bytes / ~1,600 tokens**. Timing adds one **~18-token** stderr record only when requested, plus the flag's small input cost; token counts use `tokenx`, not a model tokenizer. Help/schema-discovery costs were not measured. The reported command intervals were **38–47 ms**, explicitly separate from process startup. Initial run / mean of two subsequent fresh-process runs: | Mode | Elapsed seconds | CPU seconds | Sampled process-family peak MiB | | --- | --- | --- | --- | | default | 2.174 / 2.468 | 2.358 / 2.676 | 208.5 / 210.6 | | timing requested | 2.473 / 2.446 | 2.584 / 2.656 | 209.4 / 203.2 | RSS sampled every 10 ms, CPU from `wait4`; filesystem cache state was uncontrolled and host load varied. These data do not establish a speedup or a precise micro-overhead. No caching was added. One earlier benchmark overlapped artifact regeneration and was discarded; the reported run was sequential after builds and documentation checks. No real deep-analysis provider was exercised. ## Compatibility and limits The flag defaults off. Timing records contain only version and duration, not target paths or data. Command timing does not claim provider phases, complete process lifetime or analysis-only duration. Stdout continues through the existing shared CLI/Evidence boundary. Expected effects: - [x] Documentation or usability only; no target interaction. ## Author readiness Human owner: @dhruvac29 - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:39:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7598
No description provided.