[Tool Mode] wire runtime-signal sidecar in tool-mode curate + query paths#677
Conversation
…e and query read paths Adds bumpSidecarOnCurateWrite / bumpSidecarOnQueryRead helpers and wires them into the four touchpoints that previously left sidecar signals stale: the daemon's curate-html-direct task, the CLI curate-session writer, the SearchExecutor, and the QueryExecutor's executeToolMode return. Prereq for prune candidate generation which ranks topics by importance, recency, and accessCount.
|
Claude finished @RyanNg1403's task in 5m 45s —— View job PR Review: Tool Mode Runtime-Signal Sidecar Wiring
SummaryOverall: 3 / 5 — Right direction and the helper itself is clean, but two functional bugs (Windows path normalization, shared-origin leak) and a TDD gap need to land before merge. What's good (praise)
Blocking issues
Worth discussing
Nits
Inline comments posted on each finding. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a9b256684
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Five reviewer issues: 1. Access-hit scoring: bumpSidecarOnQueryRead now mirrors SearchKnowledgeService.mirrorHitsToSignalStore — applies recordAccessHits (bumps accessCount AND importance) and re-evaluates maturity via determineTier. Bumping accessCount alone would let prune ignore frequently-read topics. 2. Windows path normalization: curate-session.ts forward-slash-normalizes the sidecar key via .replaceAll(sep, '/') to match the daemon's curate-html-direct path. Without this, the same topic hashes to two different sidecar entries on Windows. 3. Shared-source filter: SearchExecutor now skips results with origin === 'shared' before bumping the sidecar — those paths belong to a different context tree and would either orphan an entry or collide with a same-named local topic. 4. QueryExecutor TDD coverage: three new tests verify executeToolMode bumps accessCount on matched paths, returns envelope unchanged when no store is wired, and skips the bump on empty matches. 5. Logger wiring: write call sites (daemon agent-process and CLI curate-session) now pass loggers into bumpSidecarOnCurateWrite so swallowed failures leave breadcrumbs. Executor read paths skip the logger by design (documented in the helper) to avoid stderr spam on bulk reads; the underlying RuntimeSignalStore retains its own logger.
|
Claude finished @RyanNg1403's task in 2m 18s —— View job Re-Review after
|
End-to-end testing on a real project (PR #677) revealed that SearchKnowledgeService already mirrors access hits to the sidecar via flushAccessHits -> mirrorHitsToSignalStore inside acquireIndex's cache-refresh path. The earlier explore-agent report missed this — it claimed the legacy bump was missing for tool-mode, which is why we added bumpSidecarOnQueryRead in the first place. With both bumps active, every tool-mode read scaled accessCount by ~2x and importance by ~2x. Observed in production: - Before fix: brv query caused accessCount +2, importance +6 (one call) - After fix: brv search caused accessCount +1, importance +3 (one call, canonical ACCESS_IMPORTANCE_BONUS) Topic maturity was prematurely promoting to 'core' tier as a result. Removed: - bumpSidecarOnQueryRead helper (no longer used) - SearchExecutor's runtimeSignalStore ctor param + bump call - QueryExecutor's runtimeSignalStore dep + executeToolMode wrapper - Daemon construction sites' runtimeSignalStore arg to those executors - All associated unit tests Kept (essential): - bumpSidecarOnCurateWrite — no equivalent legacy mechanism on tool-mode curate-html-direct or CLI curate-session writes - All write-path wiring (agent-process.ts case, curate-session.ts) Helper module docstring now explains why the read-side helper was removed so a future contributor doesn't re-add it.
|
Claude finished @RyanNg1403's task in 2m 42s —— View job Re-Review for
|
Summary
bumpSidecarOnCurateWrite/bumpSidecarOnQueryReadhelpers undersrc/server/infra/context-tree/with full unit-test coverage (best-effort, never throws, no-op on missing store).case 'curate-html-direct'(MCP brv-curate write path) — bumpsupdateCount+recency.curate-sessioncontinueSession (CLI brv curate write path) — bumpsupdateCount+recency.SearchExecutor— accepts optionalruntimeSignalStore, bumpsaccessCountper matched path on read.QueryExecutor.executeToolMode— same, wraps the existing tool-mode envelope with a post-bump step.daemonRuntimeSignalStoreinto both executors.Why
Tool-mode write/read paths are the only routes signal data flows through on tool-mode projects (the legacy daemon-LLM curate path is unreachable). Without this wiring, every tool-mode topic looks 'freshly created with no access history' regardless of real activity — blocking any signal-driven ranking (prune candidate generation, importance decay, etc).
The store API and schema were already on this branch — this PR only adds the call sites.
What this does NOT do
src/agent/infra/tools/implementations/curate-tool.ts(it already calls these helpers itself).update/delete/list.Test plan
tool-mode-sidecar-updaters.test.ts— 9 new tests covering both helpers (seed/update/no-op/error-swallow paths).search-executor.test.ts— +2 tests confirming bump-on-read and graceful behavior when store is absent.query-executor.test.ts— 30/30 tests still pass after theexecuteToolModewrapper.tsc --noEmitclean.npm run lint --quietclean on all changed files.