Repository navigation
Description
Context
Found by the #3641 spike (docs/decisions/bounded-multi-read.md). readDocument (packages/core/src/lib/ops/read.ts:139-147) calls readFileSync on the resolved absolute path; on a missing file the thrown ENOENT message includes that absolute path. The MCP errorResult (packages/core/src/mcp-server.ts:169-172) returns Error: ${message} verbatim, so brain_read on a missing document puts the host's brain-root path into the model-visible result.
Scope
Return a fixed, path-relative "not found" error from brain_read (and audit other MCP read tools that pass raw filesystem errors through errorResult), without host paths.
Out of scope
Changing which paths are refused, or the success output.
Acceptance criteria
-
brain_readon a missing relative path returns an error naming only the requested relative path; no absolute host path appears in any MCP read-tool error text. - Audit every MCP read-tool errorResult caller (search, context, read, list and graph) for raw filesystem messages and repair the same read-error class in scope; record any unrelated write/compute error work separately. Preserve safe containment refusals and useful relative-path classification.
- A real stdio MCP test asserts the brain root never appears in error text and fails before the fix.
Verification
Real MCP contract tests over an Odysseus fixture; bun run test, bun run check:pr --base origin/main.
Contract impact
Preserve the existing MCP error envelope (isError true, content text, no new structuredContent) and all input/success schemas. Sanitize raw host filesystem diagnostics rather than introducing a new tool error shape. Document the relative-path/safe-message guarantee in docs/integration-contract/mcp.md in the same CONTRACT-prefixed commit, carry contract, and add a patch changeset for the error disclosure correction. A proposed stable error code/envelope is a separate contract change and is out of scope.
Refs #3641
Scoped implementation and proof
readDocument calls the real filesystem after containment validation; errorResult forwards its message. Verify missing paths, parent traversal, unreadable files and unexpected I/O errors with an owned fictional brain root whose sentinel directory name must never appear in tool output. Preserve a fixed safe fallback for unknown native errors; keep the requested safe relative path where useful, and do not echo raw error.stack/cause/path/syscall. Cover all textual/structured read-tool error parts, not only one string matcher. The regression must reach real stdio MCP error delivery; module-load failure is not a receipt. Record a targeted mutation that forwards the raw native message and fails the no-host-root assertion.
This is package/MCP behavior, not a deployment incident. The read-tool error scope advances #3640's safe evidence retrieval; the issue does not broaden to all write or external-service errors. Existing tool-description wording is descriptive; no prior error-text parser is promised by the MCP component.
Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Verified the readFileSync-to-errorResult disclosure path, narrowed the audit to MCP reads and completed the real-stdio/no-host-path acceptance and contract brief. 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.