Skip to content

Verify: MCP shim drops write args and dies silently #463

Closed

Description

@possiblyneal

Part of #448

Question

Do MCP writes drop fields (memory_save arrays, ttlDays and sourceObservationIds; memory_lesson_save sourceIds), and does the stdio shim die with no diagnostic or log EPIPE as a crash? Upstream: rohitg00#1736, rohitg00#1656, rohitg00#1657, rohitg00#1661, rohitg00#1590, rohitg00#1662, rohitg00#1674, rohitg00#1795.

Activity

  1. self-assigned this
    on Nov 18, 2026
  2. possiblyneal commented on Nov 18, 2026

    @possiblyneal
    OwnerAuthor

    #463 verdict (worktree tmp/wt/verify-463, branch verify/463-mcp-shim, base fdc3d45)

    Operator runs the shim as agentmemory mcp (plugin/.mcp.json) = src/mcp/standalone.ts, proxying to REST. src/mcp/server.ts (mcp::tools::call) is only the daemon's REST MCP endpoint.

    1736 memory_save drops array concepts/files, ttlDays, sourceObservationIds

    • Arrays: APPLY, but only on server.ts (concepts/files accepted only as strings, else []). The Operator's shim path already keeps arrays (standalone normalizeList, standalone.ts validate). Reach: none on the shim; only a client posting arrays to REST /agentmemory/mcp/call.
    • Repro: test/mcp-write-args.test.ts "keeps array concepts and files", fails 1/1 on base.
    • Fix: move normalizeList to src/mcp/normalize-list.ts, used by server.ts and standalone.ts (one parser instead of two).
    • ttlDays / sourceObservationIds: NOT APPLIED. The tool schema (tools-registry.ts memory_save) does not advertise them, so no client is told to send them; REST and mem::remember do support them (remember.ts:265,275). Adding them would be a new public tool feature nothing asks for, so it is left out. Reach: live store has 0 memories with forgetAfter, 0 with sourceObservationIds (42 memories). Retry if: the Operator wants Agents to save expiring Memories, or a consumer reads sourceObservationIds (verify.ts reads it).

    1656 / 1657 / 1661 memory_lesson_save drops sourceIds

    • Claim holds literally (schema, server.ts and standalone drop it), but NOT APPLIED. In this fork REST api::lesson-save does not forward sourceIds either (api.ts:3025), mem::lesson-save does not merge sourceIds on reinforcement, no normalizeLessonSourceIds exists, and the viewer "No sources recorded" text does not exist. Only obsidian-export and replay.ts read sourceIds. An Agent saving a Lesson has no Session id to give.
    • Reach: 415 of 415 live Lessons are manual with no sourceIds; nothing downstream suffers.
    • Retry if: a Recall/viewer/export surface starts using Lesson sourceIds, or the shim exposes the current Session id to the Agent.

    1590 shim exits with no diagnostic (no crash handlers/log)

    • REJECT. Node's default for an uncaught exception or unhandled rejection prints the stack to stderr and exits 1 (confirmed with a one-line script on Node 22.23: stack printed, exit=1); Claude Code captures MCP stderr. The only thing missing is a crash log file, which the Operator's Goal ("never on the critical path", Operator attention) does not call for. 1662/1674 are PRs adding a crash log with rotation and fallbacks: a lot of surface for no measured gain.
    • Retry if: a shim death shows up with an empty stderr in Claude Code's MCP log.

    1795 EPIPE on stdout logged as a crash

    • APPLY (small). transport.ts writeResponse writes to process.stdout with no 'error' listener; a closed pipe raises an uncaught EPIPE: stack on stderr, exit 1 instead of a clean exit. No crash log exists here, so it is stderr noise and a non-zero exit on normal client shutdown.
    • Repro: "stdio transport on a closed pipe > exits cleanly on EPIPE from stdout", fails 1/1 on base.
    • Fix: start() registers an stdout 'error' handler (EPIPE / ERR_STREAM_DESTROYED -> exit 0, else rethrow); stop() removes it. Local-store saves already persist per call (standalone.ts:348,399), so an exit loses nothing.
    • Reach: every client shutdown that races a pending response; not measurable from the store.

    Class 2: no. Nothing changes Recall, Injection or stored content beyond array concepts/files on the daemon's REST MCP path. eval:suite not needed.
    Verification: npx vitest run test/mcp-write-args.test.ts test/mcp-transport.test.ts test/mcp-standalone.test.ts test/mcp-standalone-proxy.test.ts 89/89 pass; typecheck 0 errors. Patch: tmp/verify/463/fix.patch.

    Bar (tmp/verify/463-verify.log): typecheck 0 errors; npm test 3,119 passed, 1 skipped; eval:gate and eval:gate:rules pass; eval:suite fast vs base-fdc3d459: every metric Δ 0.000. Branch verify/463-mcp-shim (uncommitted, worktree tmp/wt/verify-463).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions