Repository navigation
Measure search_skills end-to-end latency on local 7B model - #1282
Conversation
Introduces packages/agent/tests/search_skills_latency.rs: a real-model integration bench that measures wall-clock and per-phase token cost for three turn scenarios (conversational / single-skill / multi-skill), each run N=10 times, with results written to nodespace-docs/development/benchmarks/search-skills-latency.md. Key finding: Gemma 4 8B consistently bypassed search_skills and called downstream tools directly. Latency is 1–1.5s (conversational), ~6.8s (single-skill intent, 5 tool rounds), ~9.5s (multi-skill, 10 rounds). No fast-path optimization is warranted — the latency driver is downstream tool-call round trips, not skill discovery overhead. Co-Authored-By: Claude <[email protected]>
Code Review — PR #1282: search_skills end-to-end latency benchmarkOverall: This is a net positive change. The harness is well-structured, gracefully skips when no backend is available, and the manually enriched report in `nodespace-docs` meets the spirit of the acceptance criteria. There is one correctness bug in the report path calculation, one misleading doc comment, a missing list marker in the generated markdown, and a moderate concern around methodology validity — none of which are blockers given the WARN fallback and the manually committed `nodespace-docs` report. Approving with the expectation that the path bug is fixed before the next benchmark run. Findings[Improvement] Report path calculation is wrong for both execution contextsFile: `packages/agent/tests/search_skills_latency.rs`, lines 611–613 The comment claims to navigate `packages/agent → packages → nodespace-core → nodespace`, but the `.join("../../../..")` (4 levels up) resolves to different wrong directories depending on where the test is run:
The primary checkout needs 3 levels (`../../..`); the worktree needs 6 levels (`../../../../../..`). These are irreconcilable with a single static path. The WARN fallback silently fires in both contexts and the auto-generated report is never written to the correct location. Concrete evidence: Two copies of the report exist on disk — one at `.claude/nodespace-docs/...` (auto-generated, 3,720 bytes, 21:12) and the correct one at `nodespace-docs/development/benchmarks/search-skills-latency.md` (manually curated, 6,743 bytes, 21:25). The benchmark wrote to the wrong place; the developer hand-wrote the correct version separately. Recommended fix: Walk up from `CARGO_MANIFEST_DIR` searching for a `nodespace-docs` sibling, rather than using a hardcoded level count: ```rust Alternatively, accept a `NODESPACE_DOCS_DIR` env var as an escape hatch. [Improvement] Scenario 2 and 3 never actually exercise `search_skills` — results measure direct tool-call routing, not the named costFile: `packages/agent/tests/search_skills_latency.rs`, lines 523–578 The issue asks to measure "how many extra ms per turn vs the current router." Across all 30 runs in scenarios 2 and 3, `search_skills` was called 0 times — the model went directly to downstream tools. The harness correctly detects and reports this, and the hand-written analysis in `nodespace-docs` handles it well. However, the scenario descriptions in the auto-generated report still say "Model calls search_skills once" and "calls search_skills twice," which is factually incorrect for any run where the model bypasses it. This is partly a model behaviour issue (Gemma 4 8B is tool-savvy enough to skip the routing step), but the harness has no mechanism to verify or enforce that a scenario actually exercised the named path. For a benchmark intended to isolate `search_skills` overhead, a post-run assertion or at minimum a clear `WARN` when the expected call count differs from actual would make the harness self-auditing: ```rust The hand-written report addresses this honestly. The code harness should surface it too. [Improvement] Misleading `--features testing` in the doc commentFile: `packages/agent/tests/search_skills_latency.rs`, line 12 The run command in the module doc comment recommends: Unlike its peer `ollama_integration.rs`, this binary does not use any `testing`-gated APIs (`set_system_prompt` is not called). The `--features testing` flag is unnecessary and creates confusion about whether the bench compiles without it. The Cargo.toml entry correctly omits `required-features`, so the flag should be dropped from the doc comment. Nitpicks
Acceptance Criteria Status (Issue #1152)
|
malibio
left a comment
There was a problem hiding this comment.
Approving with the path-calculation bug and misleading doc comment flagged in the detailed review above as pre-merge fixes. The harness structure, skip logic, stats calculations, and the manually committed nodespace-docs report all meet the acceptance criteria. The finding that Gemma 4 8B bypasses search_skills entirely is architecturally significant and is handled honestly in the hand-written analysis.
- Fix report path: replace hardcoded level-count with find_docs_benchmarks_dir() that walks up the directory tree searching for the nodespace-docs sibling, working correctly in both primary checkout and worktree layouts - Add WARN when scenarios 2/3 never call search_skills (self-auditing) - Fix percentile_wall_ms() panic on empty vec with early return guard - Add date timestamp to build_report() for self-documenting reruns - Fix missing bullet prefix on search_skills line in Methodology section - Update scenario descriptions to describe intent rather than prescribing behavior (avoids factual mismatch when model bypasses search_skills) - Remove --features testing from doc comment (this binary doesn't use any testing-gated APIs) Co-Authored-By: Claude <[email protected]>
Address-Review SummaryAll reviewer recommendations addressed. One skipped (with rationale). ✅ Addressed (6)
⏭️ Skipped (1)
No re-review neededAll changes are mechanical (path fix, guard, formatting, warn emission). No logic or architectural changes introduced. |
* Add search_skills end-to-end latency benchmark harness (closes #1152) Introduces packages/agent/tests/search_skills_latency.rs: a real-model integration bench that measures wall-clock and per-phase token cost for three turn scenarios (conversational / single-skill / multi-skill), each run N=10 times, with results written to nodespace-docs/development/benchmarks/search-skills-latency.md. Key finding: Gemma 4 8B consistently bypassed search_skills and called downstream tools directly. Latency is 1–1.5s (conversational), ~6.8s (single-skill intent, 5 tool rounds), ~9.5s (multi-skill, 10 rounds). No fast-path optimization is warranted — the latency driver is downstream tool-call round trips, not skill discovery overhead. Co-Authored-By: Claude <[email protected]> * Address review feedback on search_skills latency bench (PR #1282) - Fix report path: replace hardcoded level-count with find_docs_benchmarks_dir() that walks up the directory tree searching for the nodespace-docs sibling, working correctly in both primary checkout and worktree layouts - Add WARN when scenarios 2/3 never call search_skills (self-auditing) - Fix percentile_wall_ms() panic on empty vec with early return guard - Add date timestamp to build_report() for self-documenting reruns - Fix missing bullet prefix on search_skills line in Methodology section - Update scenario descriptions to describe intent rather than prescribing behavior (avoids factual mismatch when model bypasses search_skills) - Remove --features testing from doc comment (this binary doesn't use any testing-gated APIs) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
Closes #1152