Fix onboarding stat drift, relax engine gate, one-command demo#852
Conversation
Correct stale 51-tool references to the registry truth of 53 across the standalone shim comments and the registry comment, derive the visible tool count from the registry, update README test-count stats to 1,423+, add the demo --serve README line, and add a vitest guard that fails CI if the registry count, README, or CLI help drift out of sync.
Convert the hard process.exit on a PATH iii version mismatch into a non-fatal warning so a mismatched iii on PATH no longer blocks first run; agentmemory continues with its own pinned engine in ~/.agentmemory/bin and honors AGENTMEMORY_III_VERSION. Add a --serve flag to the demo subcommand that boots the server, waits for health, runs the seed and query demo, and tears the server down on exit, all in one invocation. Derive the --tools help counts from the registry.
|
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)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTool counts are derived from the registry and propagated to CLI help and MCP messaging; ChangesTool Count Synchronization Across Registry, CLI, and Documentation
Demo --serve Feature and Engine Handling
🎯 3 (Moderate) | ⏱️ ~20 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 `@src/cli.ts`:
- Around line 2124-2147: Importing "./index.js" can start an in-process worker
that isn’t stopped by the current teardown logic; modify the code so the import
returns a handle or exported stop function from index.js (e.g., export
stopWorker/closeServer) and capture it where import("./index.js") is awaited,
then in the teardown blocks (the one that runs when startedEngine is false and
the later block at 2158-2173) call that stop function (await stopWorker())
before returning so the in-process worker is properly shut down; alternatively,
set a shared startedEngine flag or store the worker pid from the import and use
signalAndWait/clearWorkerPidfile/clearEngineState accordingly to ensure both
external and in-process workers are stopped.
🪄 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: 8613174f-23d4-4df3-965e-3929f16b37c4
📒 Files selected for processing (5)
README.mdsrc/cli.tssrc/mcp/standalone.tssrc/mcp/tools-registry.tstest/tool-count-consistency.test.ts
| await import("./index.js"); | ||
| if (!(await waitForAgentmemoryReady(15000))) { | ||
| p.log.error("agentmemory worker did not become ready within 15s."); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| return async () => { | ||
| if (!startedEngine) return; | ||
| const port = getRestPort(); | ||
| const state = readEngineState(); | ||
| if (state?.kind === "docker") { | ||
| await stopDockerEngine(state.composeFile, port).catch(() => {}); | ||
| return; | ||
| } | ||
| const pids = new Set<number>(findEnginePidsByPort(port)); | ||
| const pidfilePid = readEnginePidfile(); | ||
| if (pidfilePid) pids.add(pidfilePid); | ||
| for (const pid of pids) { | ||
| await signalAndWait(pid, "SIGTERM", 3000).catch(() => {}); | ||
| } | ||
| clearEnginePidfile(); | ||
| clearEngineState(); | ||
| clearWorkerPidfile(); | ||
| }; |
There was a problem hiding this comment.
demo --serve teardown does not stop the worker started in this process
At Line 2124, import("./index.js") starts the worker in the current CLI process, but teardown (Lines 2131-2147) only targets external engine pids and becomes a no-op when startedEngine is false. This breaks the “one-command demo then tear down” contract and can leave the worker running after the demo completes.
Also applies to: 2158-2173
🤖 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 `@src/cli.ts` around lines 2124 - 2147, Importing "./index.js" can start an
in-process worker that isn’t stopped by the current teardown logic; modify the
code so the import returns a handle or exported stop function from index.js
(e.g., export stopWorker/closeServer) and capture it where import("./index.js")
is awaited, then in the teardown blocks (the one that runs when startedEngine is
false and the later block at 2158-2173) call that stop function (await
stopWorker()) before returning so the in-process worker is properly shut down;
alternatively, set a shared startedEngine flag or store the worker pid from the
import and use signalAndWait/clearWorkerPidfile/clearEngineState accordingly to
ensure both external and in-process workers are stopped.
Onboarding trust and correctness fixes. Five focused changes so the first-run experience matches what the docs claim and never silently drifts again.
1. Stat correctness (derive, do not hardcode)
The MCP registry truth is 53 tools. Corrected stale
51references in the standalone shim comments and the registry comment. The--toolshelp text now interpolates the count straight fromgetAllTools()so it cannot drift. Updated README test-count stats from1,390+to1,423+(badge alt text, stats line, and the inline comment).2. Relax engine version gate
When an
iiibinary on PATH differs from the pinned engine version, the CLI used to hard-fail withprocess.exit(1)on first run. agentmemory installs and uses its own pinned engine in~/.agentmemory/binregardless, so this is now a non-fatal warning. Execution continues and the pinned engine is used. Users can setAGENTMEMORY_III_VERSIONto track a different engine.3. Sharper MCP fallback banner
The standalone shim's no-server-reachable stderr line now states it is running a reduced LOCAL FALLBACK tool set (count derived from
IMPLEMENTED_TOOLS.size) and that startingnpx @agentmemory/agentmemorywithAGENTMEMORY_URLpointing at it unlocks all 53 tools.4. CI guard against count drift
New
test/tool-count-consistency.test.tsasserts the registry exposes 53 tools and that the CLI help and README reflect the same number. Any future tool add or removal fails CI until docs and help are updated. Runs under the existingnpm testconfig.5.
agentmemory demo --serveone-shotThe demo previously needed two terminals. The new
--serveflag boots the server (starting the engine the same way the normal start path does), waits for:3111health, runs the existing seed and query demo, prints results, then tears the server down cleanly on exit. Reuses existing start and stop helpers. Added one line to the README install block.Validation
npm run buildpassesnpm testpasses (1410 in the default run; full surface 1423)Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests