Repository navigation
Description
Context
Found by the #3646 spike. brain_graph returns { edges: [], nodes: [] } both for a path that does not exist and for an existing document with no links. On Pi this is explicit (graph, packages/ui-backend-pi/src/brain-access.ts:276-281, "brain_graph has always returned an empty walk for an absent path"). Over MCP it is the result of (walkLinks, packages/core/src/lib/link-walk.ts:39-124). An agent cannot tell a mistyped root from an isolated note.
Scope
Use an additive warning for a root absent from the pinned content-index snapshot, on MCP and Pi. Preserve the empty edges/nodes and successful tool-result behavior for that missing root; keep existing-root results unchanged. Reuse MCP warnings and carry an optional warnings array in the Pi JSON text/details result only for the missing case. Say that the path is absent from the index; do not claim that the Markdown file does not exist on disk. A suggested warning is Graph root is not in the index: notes/absent.md. The concrete readLinkWalk query already distinguishes not_found before the Pi adapter maps it to an empty walk.
Out of scope
Turning the missing case into an error (that would break existing callers without a ruling), multi-root traversal.
Acceptance criteria
- A missing indexed root returns the documented relative-path warning on MCP and Pi with empty edges/nodes and no isError change; an isolated indexed root has no missing-root warning. A file present on disk but not indexed is described as absent from the index, never absent from disk. The existence decision and traversal use one pinned index snapshot.
- Existing-root results are unchanged.
- A named test fails when the distinction is removed.
Verification
Odysseus fixture, pinned 2026-07-12; real MCP and Pi tests; provider-history guard if a Pi description changes.
Contract impact
Additive output: contract, contract component update in a CONTRACT: commit, minor changeset.
Refs #3646
Source and verification clarification
The supported query contract explicitly preserves absent indexed roots as empty graph results (docs/integration-contract/package-api.md, content-index query API). Keep that behavior and add the warning rather than changing QueryFailure into a new public tool error. readLinkWalk (packages/core/src/queries/index.ts:72-87) checks the documents table inside its snapshot; graph (packages/ui-backend-pi/src/brain-access.ts:276-281) currently discards that not_found distinction. walkLinks remains one transaction. Do not create a filesystem-existence side channel or alter unrelated query error envelopes.
Test missing, isolated, connected and unindexed-on-disk roots in real MCP/Pi fixtures, preserving old found-root bytes, graph caps, unresolved links and staleness warnings. This is a supported additive warning/result extension, so update both MCP and package/query/Pi contract descriptions and carry a minor changeset. The full missing-root retrieval distinction advances #3640; the integration-branch multi-root no-go does not authorize a new multi-root API.
Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Verified the indexed-not_found distinction and scoped a compatible missing-root warning, preserving existing-root output and avoiding a filesystem-existence claim. Priority p2 reflects wanted unscheduled work; assignments and milestones are preserved.
Activity
schlessera commentedon Nov 9, 2026
2026-11-09: detached from epic #3640 by maintainer decision (ruling). This issue is now standalone. Its scope, labels and readiness are unchanged.