fix(mcp): probe diagnostics + sandbox escape hatch (#234, #278)#280
Conversation
Three small follow-ups to v0.9.6 reported live on #234 and #278: 1. @agentmemory/mcp shim silently degraded to 7-tool local fallback for sandboxed MCP clients (Flatpak VS Codeium / Roo Code) because the 500ms livez probe failed inside the sandbox network namespace and the catch swallowed the error. Probe now logs the URL, status, and reason to stderr; default timeout raised to 2000ms; AGENTMEMORY_PROBE_TIMEOUT_MS overrides the timeout; AGENTMEMORY_FORCE_PROXY=1 skips the probe and trusts AGENTMEMORY_URL outright for sandboxed clients that can reach the server through a known route but not the host loopback. Closes the #234 follow-up reported by @jcalfee. 2. Docker compose stack persisted state to an ephemeral container path. iii-config.docker.yaml used file_path: ./data/state_store.db, which the engine resolved against its container WORKDIR=/home/nonroot -- not the /data mount where iii-data is bound. State and stream stores were silently written to the container layer and lost on every docker compose down. Paths are now absolute (/data/state_store.db and /data/stream_store). Existing users need a one-time docker compose down -v before upgrade. 3. CLI banner leaked "which: no iii in ..." when iii wasn't on PATH. execFileSync default stdio inherits stderr; GNU which writes the miss line to stderr (exit 1). Switched to explicit stdio: ["ignore", "pipe", "pipe"] in whichBinary(). 4. docker-compose.yml now caps engine container log size at 30MB total (json-file driver, max-size=10m, max-file=3) so the iiidev/iii crash/restart spam reported by @satabd in #278 can no longer fill the host disk. The upstream engine spam itself needs filing against iii-hq/iii -- this is the compose-side guardrail. Version 0.9.6 -> 0.9.7 across package.json, packages/mcp/package.json, plugin/.claude-plugin/plugin.json, src/version.ts, src/types.ts ExportData literal, src/functions/export-import.ts supportedVersions, and the export round-trip test expectation.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughv0.9.7 patch release bumps version across manifests and types, adds configurable MCP proxy health-probe timeout and an AGENTMEMORY_FORCE_PROXY escape hatch with enhanced stderr logging, switches Docker KV adapter paths to absolute container mount paths for persistence, captures CLI stdio to suppress which/where noise, expands export-import version validation, and updates tests and changelog. ChangesRelease v0.9.7
Sequence Diagram(s)sequenceDiagram
participant resolveHandle as resolveHandle()
participant forceProxy as AGENTMEMORY_FORCE_PROXY
participant probeTimeout as AGENTMEMORY_PROBE_TIMEOUT_MS
participant probe as probe(url)
participant proxy as Remote MCP
participant standalone as Standalone MCP
resolveHandle->>forceProxy: read flag
alt Force proxy enabled
resolveHandle-->>proxy: trust base URL (no probe)
proxy-->>resolveHandle: proxy handle returned
else Normal mode
resolveHandle->>probeTimeout: read timeout
resolveHandle->>probe: call /agentmemory/livez with timeout
probe->>proxy: HTTP GET /agentmemory/livez
alt Probe OK
proxy-->>probe: 200 OK
probe-->>resolveHandle: up=true
resolveHandle-->>proxy: return proxy handle
else Probe fails
probe-->>resolveHandle: log stderr (elapsed + error)
resolveHandle-->>standalone: return local handle (fallback)
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 9: The changelog entry "## [0.9.7] — 2026-05-11" references a missing
link target; add a matching reference-link definition for "[0.9.7]" in the link
table at the bottom of CHANGELOG.md using the same format as the other releases
(i.e., a `[0.9.7]: <compare-URL-or-tag>` line that points to the repo's compare
or tag URL for 0.9.7 so the header resolves correctly).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8874c10f-6dc2-4bfa-8fcd-b22f096033a9
📒 Files selected for processing (13)
CHANGELOG.mddocker-compose.ymliii-config.docker.yamlpackage.jsonpackages/mcp/package.jsonplugin/.claude-plugin/plugin.jsonsrc/cli.tssrc/functions/export-import.tssrc/mcp/rest-proxy.tssrc/types.tssrc/version.tstest/export-import.test.tstest/mcp-standalone-proxy.test.ts
|
|
||
| ## [Unreleased] | ||
|
|
||
| ## [0.9.7] — 2026-05-11 |
There was a problem hiding this comment.
Add the missing [0.9.7] reference link target.
Line 9 uses reference-link syntax ([0.9.7]), but the corresponding definition is missing in the link table, so this entry won’t resolve to a compare URL.
📎 Proposed doc fix
+[0.9.7]: https://github.com/rohitg00/agentmemory/compare/v0.9.6...v0.9.7
[0.9.6]: https://github.com/rohitg00/agentmemory/compare/v0.9.5...v0.9.6
[0.9.5]: https://github.com/rohitg00/agentmemory/compare/v0.9.4...v0.9.5🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@CHANGELOG.md` at line 9, The changelog entry "## [0.9.7] — 2026-05-11"
references a missing link target; add a matching reference-link definition for
"[0.9.7]" in the link table at the bottom of CHANGELOG.md using the same format
as the other releases (i.e., a `[0.9.7]: <compare-URL-or-tag>` line that points
to the repo's compare or tag URL for 0.9.7 so the header resolves correctly).
@jcalfee on #234 confirmed the v0.9.6 fix (and PR #280's escape hatch) still surfaces 7 tools in Roo Code even though: - Flatpak share=network is on (probe succeeds via curl in-sandbox) - server's /agentmemory/mcp/tools returns 51 tools via curl - AGENTMEMORY_FORCE_PROXY=1 is set Roo Code shows 7 tools even when docker is down -- strong signal of client-side caching at the Roo Code layer, not a shim regression. But the shim has zero visibility into what it actually returns to the MCP client right now: success path is silent, only failure paths log. Add AGENTMEMORY_DEBUG=1 (or =true) so the shim writes to stderr: - which mode handle.mode resolved to (proxy vs local) and baseUrl - shape of the /agentmemory/mcp/tools response (keys + tools type) - count of tools returned to the MCP client - tool names in the local-fallback list if we hit it Also: previously, when the server returned a JSON shape that wasn't {tools: Array}, the shim silently fell back to the 7-tool local list with no log line. Now that path warns to stderr unconditionally, pointing at AGENTMEMORY_DEBUG=1 for inspection. This is diagnosis enablement -- not a fix for whatever is making Roo Code show 7 tools. Once @jcalfee can run the shim with AGENTMEMORY_DEBUG=1 and share the stderr output, we'll know whether the shim returns 51 (Roo Code bug) or 7 (deeper shim bug).
Summary
Three small follow-ups to v0.9.6 from live field reports on #234 and #278.
@agentmemory/mcpshim silent degradation in sandboxed clients (MCP shim: --tools all returns only 7 tools due to IMPLEMENTED_TOOLS hardcode #234 follow-up, @jcalfee). Probe now logs URL/status/reason on failure, default timeout raised 500ms → 2000ms,AGENTMEMORY_PROBE_TIMEOUT_MSoverrides,AGENTMEMORY_FORCE_PROXY=1skips the probe entirely for clients (Flatpak / Snap / restricted containers) that can reach the server but not the host loopback.docker compose down(MCP shim: --tools all returns only 7 tools due to IMPLEMENTED_TOOLS hardcode #234 follow-up).iii-config.docker.yamlwrote to./data/...(relative → resolved against engine containerWORKDIR=/home/nonroot) instead of/data(where theiii-datanamed volume mounts). Both paths now absolute.which: no iii in ...(cosmetic).execFileSyncdefault stdio inherits stderr; switchedwhichBinary()tostdio: ["ignore", "pipe", "pipe"].json-filedriver (max-size: 10m,max-file: 3). The upstream engine crash spam itself needs filing againstiii-hq/iii— this is the compose-side blast-radius bound.Root cause walkthrough
Why Roo Code in VS Codeium (Flatpak) saw 7 tools while the host shell saw 51
The probe in
src/mcp/rest-proxy.ts:31had:No log line. 500ms timeout. The fix surfaces every failure with the URL, the HTTP status (or thrown reason), and the active timeout, so users actually see why they fell into local mode instead of staring at a 7-tool list with no explanation.
For Flatpak / Snap / network-restricted clients that genuinely can't probe but can reach the server through some other route (LAN IP, configured upstream, sidecar),
AGENTMEMORY_FORCE_PROXY=1short-circuits the probe and trustsAGENTMEMORY_URLdirectly.Why
docker compose downwiped stateSo every write went to the ephemeral container layer, not the named volume, and
docker compose downdiscarded it. Bumping both paths to absolute (/data/state_store.db,/data/stream_store) routes them through the volume the compose file always intended.Migration note for existing users: one-time
docker compose down -vto drop the (empty) old volume layout, thendocker compose up— fresh data goes to the right place from then on.Changes
src/mcp/rest-proxy.ts— log probe failures to stderr; 500ms → 2000ms default;AGENTMEMORY_PROBE_TIMEOUT_MSknob;AGENTMEMORY_FORCE_PROXY=1skip-probe escape hatch.src/cli.ts— pipewhich's stderr inwhichBinary().iii-config.docker.yaml— absolutefile_pathforiii-stateandiii-stream.docker-compose.yml—logging.driver: json-file+max-size: 10m+max-file: 3on theiii-engineservice.package.json,packages/mcp/package.json,plugin/.claude-plugin/plugin.json,src/version.ts, theExportDataliteral insrc/types.ts, thesupportedVersionsset insrc/functions/export-import.ts, and the round-trip test intest/export-import.test.ts.test/mcp-standalone-proxy.test.ts— 4 new tests:AGENTMEMORY_FORCE_PROXY=1skips the livez probe and forwards directly.AGENTMEMORY_FORCE_PROXYhint.AGENTMEMORY_PROBE_TIMEOUT_MSoverrides the default probe timeout.Test plan
npm test— 859/859 pass on this branch (baseline: 856 on main; +3 net new tests).npm run build— clean tsdown build, no type errors.AGENTMEMORY_FORCE_PROXY=1, expect 51 tools.docker compose down && docker compose up— verify/data/state_store.dbpersists across restarts.Out of scope (filed separately)
iii-hq/iii; this PR only caps the blast radius. Will follow up there once @satabd can share a representative 50-100 line sample of the spam content so we can identify the failure pattern.Summary by CodeRabbit
Bug Fixes
New Features
Chores