Repository navigation
Log every retrieved skill's score, not just the winner's - #2529
Conversation
Investigation into #2276 found the bulk of its acceptance criteria already satisfied by ADR-038's two-stage routing (risk-tiered score bars, destructive-tool winner-only scoping, structural write-tool redundancy, pass^k repetition in the eval runner). The one real gap: `route()` and `find_skills` logged only the winning candidate's score, so a tiebreak (a near-tied runner-up) was indistinguishable from a skill scoring badly on its own core use case with no close competitor — two different defects needing different fixes. Adds `routing::all_candidate_scores`, unfiltered by the score gate, and wires it into both log sites alongside the existing top_score/ routed_skills fields. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Pragmatic Code Review — PR #2529Review Type: Initial Review (no prior review comments found) Requirements CheckThis PR targets exactly one item from issue #2276's acceptance criteria: "Per-skill retrieval scores observable for a turn" — the issue's own "prerequisite for any of them" section, which explicitly calls for logging every skill's score, not just
Code Review FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
Test CoverageTwo new unit tests in
Both are well-isolated (no external state, pure function over a constructed Verified locally:
Security & Performance
Style/ConsistencyNew code matches Recommendation: APPROVESmall, correctly-scoped, mechanical observability addition that does exactly what issue #2276 asked for as a prerequisite. The "unfiltered by score gate" distinction — the entire reason this function exists rather than just reusing |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Code Review SummarySmall, well-scoped observability follow-up from the #2276 investigation. It adds an FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
Verification performed
Recommendation: APPROVE. The two "Suggested Improvements" are worth a follow-up look but do not block this narrow, well-tested, net-positive change. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval on this self-authored PR). Full findings in the review comment above.
Both PR #2529 reviews suggested a dedicated test for the all_scores field's unfiltered-by-threshold behavior in skill_ops.rs, mirroring the existing coverage on routing.rs's all_candidate_scores. Extracted the inline formatting into format_all_scores so it's testable without find_skills's live NodeService/NodeEmbeddingService dependencies, and added two tests: inclusion of a low-scoring result, and empty input. Other review suggestions (eager tracing::info! field evaluation, duplicated formatting logic across the agent/core crate boundary, comma-escaping in skill names, doc comment length) were left as-is — all pre-existing patterns already shared by the adjacent routed_skills field, not regressions this PR introduces, and not worth new abstraction for two five-line call sites. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Address-review summaryBoth reviews reached APPROVE with zero critical findings. Triaged the suggestions: Addressed:
Skipped (with reasoning):
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The only change made was additive test coverage plus an extract-function refactor with no behavior change (the formatting logic is byte-for-byte identical to what was inline before, just now named and testable). All 26 |
Summary
Investigation for #2276 (skill retrieval / routing safety). Full findings posted as a comment on the issue: #2276 (comment)
The short version: this issue's measurements were taken at
d393ad19, but the destructive-tool-leak defect it describes (delete_nodeoffered on turns with no deletion intent) was already fixed before that commit, byb5c892b0(#2244/#2240) — an ancestor ofd393ad19. Since then, ADR-038's two-stage routing pipeline (packages/agent/src/local_agent/routing.rs) has landed in full: risk-tiered score bars (read/mutating/destructive), destructive tools scoped to only the retrieval winner, a structural test requiring every write tool to have ≥2 owning skills (so a retrieval miss on one skill degrades rather than strands the turn), and--runs/pass^k repetition in the eval runner for exactly the "is this routing flip stable across reps" check the issue asks for.Almost every acceptance criterion in #2276 is already satisfied by work already on
main. The one real, mechanical gap:route()(agent_loop.rs) andfind_skills(skill_ops.rs) logged only the winning candidate's score (top_score), never the full set of retrieved candidates' scores. That makes two different failure modes indistinguishable from ordinary logs:This PR adds that missing piece:
routing::all_candidate_scores— every retrieved candidate's name and score, unfiltered by the score gate (unlike the existingrouted_skill_names, which only lists gate-clearing candidates).agent_loop::route()'s"two-stage routing overhead"log line asall_scores.all_scoresfield added tofind_skills's"find_skills executed"log line inskill_ops.rs, for the same reason on that path.Test plan
cargo test -p nodespace-agent --lib local_agent::routing— 64 passed, including 2 new tests forall_candidate_scorescargo test -p nodespace-core --lib ops::skill_ops— 24 passedcargo build -p nodespace-agent -p nodespace-core— cleanbun run quality:fix— no issues (clippy, eslint, svelte-check, tsc all clean)bun run test:all— full suite green, no new failures vs. baseline (4929 frontend tests + full Rust workspace)🤖 Generated with Claude Code