Skip to content

dream(performance): #3183 wire real cold-start measurement, remove fabricated V2-vs-V3 benchmark (evaluated, ACCEPT-scoped) - #3184

Merged
ruvnet merged 3 commits into
mainfrom
dream/2026-09-05-performance
Sep 5, 2026
Merged

dream(performance): #3183 wire real cold-start measurement, remove fabricated V2-vs-V3 benchmark (evaluated, ACCEPT-scoped)#3184
ruvnet merged 3 commits into
mainfrom
dream/2026-09-05-performance

Conversation

@ruvnet

@ruvnet ruvnet commented Sep 5, 2026

Copy link
Copy Markdown
Owner

1. Hypothesis

Given the CLI cold-start benchmark suite (v3/@claude-flow/performance/benchmarks/startup/cli-cold-start.bench.ts), which currently reports a "V2 vs V3" speedup and other headline numbers purely from hardcoded setTimeout() delays without exercising any real code path, when the suite is rewired to call its own pre-existing (but dead) measureColdStart() function — spawning a real node bin/cli.js child process — and the fabricated V2-vs-V3 comparison is removed rather than "fixed" (no V2 binary remains to compare against), then the suite should report a genuine measured wall-clock number reflecting actual current CLI behavior for at least one real subcommand, subject to: (1) existing tests remain green; (2) the fix touches only the benchmark/test harness and one documentation table, not production CLI code; (3) $0 evaluation cost, zero LLM calls; (4) the honest scope limitation (measures --version only) is disclosed rather than hidden.

2. Candidate

  • cli-cold-start.bench.ts: exported measureColdStart() (was private and dead — zero call sites before this diff); added runRealColdStartMeasurement() + CLI_BIN_PATH; wired the real measurement into runColdStartBenchmarks(); removed the "V2 vs V3 Comparison Simulation" block (setTimeout(100) vs setTimeout(20), no code between them — a "5.00x speedup" guaranteed by construction on every run).
  • __tests__/cli-cold-start.test.ts (new): 4 deterministic Vitest assertions.
  • ADR-STATUS-SUMMARY.md: corrected 2 rows in the Performance Targets table (CLI Startup — was "✅ Achieved" fed by the fabricated benchmark; HNSW — an already-known-false 150x-12,500x figure one row up, same table, same defect class).

3. Evaluation Receipt

Real evaluator: Vitest 4.1.8, deterministic, zero LLM calls, $0 cost.

Baseline vs. candidate isolated via git stash of just the .bench.ts file (test file kept): all 4 new tests fail against baseline (measureColdStart/runRealColdStartMeasurement/CLI_BIN_PATH not exported pre-fix; fabricated-pattern guard also fails) and pass against candidate.

Full @claude-flow/performance suite: 99/99 passing (95 pre-existing + 4 new; pre-existing 95 identical both ways). tsc --noEmit: zero errors.

Real measured number: node bin/cli.js --version, 5 runs — mean 54.65ms, min 51.94ms, max 57.92ms. Well under the 500ms target.

4. Baseline Comparison

Baseline Candidate
measureColdStart exported/callable No (dead code) Yes
Real subprocess-based number reported No Yes (54.65ms mean, n=5)
"V2 vs V3 Speedup" 5.00x, guaranteed by construction every run Removed — no fabricated replacement
New regression tests 4/4 pass
Full package suite 95/95 99/99
tsc --noEmit clean clean

5. Darwin Lineage

Skipped — scope mismatch (dead-code-wiring fix with a binary "called or not" evaluation, not a tunable parameter with a search space). Confirmed real Darwin interface via npx ruvector harness darwin --help tonight (JSON genome config + --execute).

6. Flywheel Evidence

No signed @metaharness/flywheel bundle (deterministic Vitest evidence targets a different evaluation shape than the LLM-task corpus that tooling replays/verifies) — consistent with every accepted night since 2026-08-18. Evidence retained as: 4 new tests + linked issue + gist + stash-isolated baseline/candidate result.

7. Reward Hack Check

Manual checklist (no standalone reward-hack CLI reachable this session): no test weakened (purely additive), no gold-label leakage (none exists in this code), no cherry-picking (full 99-test suite both ways), no seed manipulation (real subprocess timing, variance disclosed via min/max), zero cost, no undocumented caching. The one real limitation (--version only, not full CLI init) is disclosed in-code and in the linked issue/gist, not hidden.

8. Security Review

runRealColdStartMeasurement() spawns a fixed, hardcoded command with shell: false (unchanged from the pre-existing helper) — no user-controlled input reaches the spawned args. Dev/benchmark tooling only, no new production-facing surface.

9. Regression Analysis

No production CLI code touched. ADR-STATUS-SUMMARY.md changes are documentation-only. Full package test suite green (99/99), tsc --noEmit clean, pre-existing 95 tests identical pass/fail both sides of the stash isolation.

10. ADR

None — scoped wiring/correctness fix + one doc-table correction, consistent with repo convention for this class of finding (no ADR for 08-24/08-25/08-30's similar fixes).

11. Research Gist

docs/dream-cycle/dream-gist-2026-09-05.md (this branch) — full competitor analysis, external sources (arXiv:2606.20695, Pebblous 2026 benchmark-trust-crisis report, Qdrant/Milvus/LangGraph/CrewAI/OpenAI comparisons), and this cycle's security (plugin supply-chain enforcement gap) and hive-mind (Raft election safety gap) scan findings, neither implemented tonight (out of scope for the performance DEEP surface, documented as follow-ups).

12. Issue

#3183

13. Witness

Field Value
Session commit db4991967c45c6f72133dff0bb80b0a492960fc1
Gist SHA-256 (pre-witness content) 0aae2712a54567521f308721205cbcbded0dadada2ab052810476b8e94d60fce
Witness stamp 04f903bab9006e79cf201c498058d028d66a0de7d6ef17e97325638336d1e98c

14. Merge Policy

Human review required. Do not self-merge. Do not autonomously promote Flywheel state.


🤖 Generated with RuFlo

https://claude.ai/code/session_01YQUz3bkMpqgtLXgkYa1LFF


Generated by Claude Code

@ruvnet ruvnet mentioned this pull request Sep 5, 2026

ruvnet commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

CI red — not this PR's failure, confirmed via base-branch reproduction.

All 8 failing checks (Audit root (critical-blocking), Security & Code Quality, Test Suite (ubuntu-latest), 🚀 Integration Test Setup, and the queued/failed smoke-test matrix jobs) fail at the same root step: npm install at the repo root errors with ETARGET No matching version found for @claude-flow/mcp@3.0.0-alpha.10. This is a workspace-internal package version pinned in root package.json that isn't resolvable via plain npm install outside the workspace-link context.

Confirmed pre-existing and unrelated to this diff:

Not re-running: this is a deterministic ETARGET failure with a known cause and no fix available to apply, not a flake — a re-run would reproduce the same error.

This PR's own diff (v3/@claude-flow/performance/**) was validated locally instead: full @claude-flow/performance suite 99/99 passing, tsc --noEmit clean, baseline-fails/candidate-passes confirmed via git stash isolation (details in the PR description and linked issue #3183/gist). Tracking #3095/#3101 for when this PR is actually mergeable against CI.


Generated by Claude Code

@ruvnet
ruvnet force-pushed the dream/2026-09-05-performance branch from 530334e to af6ad1c Compare September 5, 2026 14:27
ruvnet added a commit that referenced this pull request Sep 5, 2026
…s dropped by the July helper sync

tests/hook-handler-runwithtimeout.test.cjs failed with "runWithTimeout is
not a function" on the first Test Suite runs after #3203 (#3177, #3184).
cb1e93e (2026-06-15) had guarded the hook dispatch behind
`require.main === module` and exported { runWithTimeout,
INTELLIGENCE_TIMEOUT_MS } for that test; the 2026-07-04 helper sync
(a5f86ad) replaced both copies of hook-handler.cjs with the packaged
build and dropped the guard and the exports, so require()-ing the helper
ran main() (stdin read + process.exit) and exposed nothing.

Both copies (repo dogfood + v3/@claude-flow/cli) restored identically;
direct invocation still prints usage and exits 0. The helpers manifest
is re-signed at publish (prepublishOnly), as the guard workflow expects.

node --test tests/hook-handler-runwithtimeout.test.cjs
  tests/context-persistence-hook.test.mjs: all pass, 0 fail.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_019xHM4rAH4aaShb4DTr1n6s
ruvnet added a commit that referenced this pull request Sep 5, 2026
 (embedding width; hook-handler exports) (#3204)

* test(context-hook): assert the hash embedding width is EMBEDDING_DIM (384), not the legacy 768

tests/context-persistence-hook.test.mjs still expected createHashEmbedding
to return 768 values; the hook has defaulted to 384 (the ONNX
all-MiniLM-L6-v2 width, EMBEDDING_DIM) since February so hash-fallback
blobs stay comparable with ONNX vectors. The mismatch was hidden while
the Test Suite job died at ETARGET (fixed in #3203) and surfaced on the
first PR runs after it (#3177, #3184). Assert EMBEDDING_DIM and pin it
to 384; fix the stale "768-dim" docstring on the blob store.

node --test tests/context-persistence-hook.test.mjs: 66 pass, 0 fail.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_019xHM4rAH4aaShb4DTr1n6s

* fix(hooks): restore hook-handler's require.main guard and test exports dropped by the July helper sync

tests/hook-handler-runwithtimeout.test.cjs failed with "runWithTimeout is
not a function" on the first Test Suite runs after #3203 (#3177, #3184).
cb1e93e (2026-06-15) had guarded the hook dispatch behind
`require.main === module` and exported { runWithTimeout,
INTELLIGENCE_TIMEOUT_MS } for that test; the 2026-07-04 helper sync
(a5f86ad) replaced both copies of hook-handler.cjs with the packaged
build and dropped the guard and the exports, so require()-ing the helper
ran main() (stdin read + process.exit) and exposed nothing.

Both copies (repo dogfood + v3/@claude-flow/cli) restored identically;
direct invocation still prints usage and exits 0. The helpers manifest
is re-signed at publish (prepublishOnly), as the guard workflow expects.

node --test tests/hook-handler-runwithtimeout.test.cjs
  tests/context-persistence-hook.test.mjs: all pass, 0 fail.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_019xHM4rAH4aaShb4DTr1n6s

* chore(helpers): re-sign helpers manifest after hook-handler.cjs test-surface restore

The packaged hook-handler.cjs changed in this branch (require.main guard +
runWithTimeout exports), so helpers.manifest.json still carried main's hash
and helper-signing.test.ts ("hashes match the actual shipped helper files")
failed in Test Suite (ubuntu-latest), run 33972961703. Re-signed with the
ruflo helpers key via RUFLO_HELPERS_SIGNING_SECRET; no other file changed.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_019xHM4rAH4aaShb4DTr1n6s
claude and others added 3 commits September 5, 2026 11:16
Ledger-append step silently failed again for 10 consecutive nights
(3rd occurrence of this failure class, first flagged 2026-08-19).
Verified via git ls-remote + GitHub MCP issue/PR search before
concluding this (all 10 nights ran to completion: real branch, issue,
and draft PR each) rather than inferring failure from a sparse table.
2026-08-20..08-23 is a separate, confirmed-genuine 4-night gap where
the pipeline did not run at all.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01YQUz3bkMpqgtLXgkYa1LFF
…ed V2-vs-V3 benchmark (evaluated, ACCEPT-scoped)

cli-cold-start.bench.ts's own measureColdStart() (a real,
spawn-based process timer) was never called anywhere in the file.
Every reported number instead came from setTimeout() delays,
including a "V2 vs V3 Speedup: 5.00x" that was guaranteed by
construction (setTimeout(100) vs setTimeout(20), no code between
them) regardless of any real behavior.

- Export measureColdStart(), add runRealColdStartMeasurement() and
  CLI_BIN_PATH; wire the real spawn-based measurement into the suite.
- Remove the fabricated V2-vs-V3 comparison outright (no V2 binary
  remains to honestly compare against).
- Add a deterministic Vitest regression test (4 assertions); fails
  against baseline (functions not exported, fabricated pattern still
  present), passes against candidate — confirmed via git-stash
  isolation. Full @claude-flow/performance suite: 99/99 passing.
  tsc --noEmit: clean.
- Real measured number: node bin/cli.js --version, 5 runs, mean
  54.65ms (min 51.94 / max 57.92) — well under the 500ms target.
  Caveat disclosed in-code: --version is the one subcommand that
  succeeds without a built dist/ in this worktree; this is not a
  full-CLI cold-start measurement.
- Correct the two stale "Achieved" claims this fed in
  ADR-STATUS-SUMMARY.md's Performance Targets table (CLI Startup,
  and the already-known-false HNSW 150x-12,500x figure one row up).

Darwin: skipped, scope mismatch (dead-code-wiring fix, not a
tunable parameter). Flywheel: no signed bundle, deterministic
Vitest evidence retained instead. Follow-ups documented in tonight's
gist: same anti-pattern in agent-spawn/mcp-server-init/cli-warm-start
bench files (not touched, kept to one conceptual change); a Raft
election safety gap and a plugin supply-chain enforcement gap found
by tonight's scan roles (hive-mind, security) but out of scope for
the performance DEEP surface.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01YQUz3bkMpqgtLXgkYa1LFF
@ruvnet
ruvnet force-pushed the dream/2026-09-05-performance branch from af6ad1c to 8b3927d Compare September 5, 2026 15:16
@ruvnet
ruvnet marked this pull request as ready for review September 5, 2026 15:38
@ruvnet
ruvnet merged commit 33a2c3e into main Sep 5, 2026
114 of 115 checks passed
@ruvnet
ruvnet deleted the dream/2026-09-05-performance branch September 5, 2026 15:57
ruvnet added a commit that referenced this pull request Sep 7, 2026
Patch release covering the six commits landed since 3.38.21:
- #3221 gate EnhancedModelRouter's forwarded modelId on tier match
- #3169 wire embedding-cosine into SmartRetrieval's MMR step
- #3184 wire real cold-start measurement, drop the fabricated V2-vs-V3 benchmark
- #3177 bound two ReDoS patterns, stateless PII regexes, O(P) confidence pass
- #3204 fix two stale main-tree Test Suite failures
- #3203 add v3/@claude-flow/mcp to the root npm workspaces

3.38.22 is intentionally skipped: @claude-flow/cli's publish for that version
stuck in npm's "staged" state (published umbrellas, cli 404) and the registry
refused to republish over it even after unpublish, so all three packages moved
to .23 together to restore version lockstep.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_01Ff2xRKvYrqXJhefvcapfE1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants