fix: remove duplicate memory_compact tool registration#433
fix: remove duplicate memory_compact tool registration#433
Conversation
The memory_compact tool was registered twice: - Once in src/tools.ts via registerMemoryCompactTool() (the proper implementation added in PR #343) - Once inline in index.ts as a leftover prototype This caused OpenClaw's tool-name conflict detection to emit ERROR logs on every gateway start/reload. Remove the orphaned inline registration in index.ts. The tools.ts version is the canonical implementation. The auto-compaction hook at gateway_start (which uses runCompaction directly) is unaffected. Fixes #431 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
) PR #391 made selfImprovement.enabled default to true even when the config block is omitted, which registers appendSelfImprovementNote on the command:new hook. Three test assertions still expected command:new to be undefined — update them to accept the self-improvement hook while still verifying sessionMemory does not register its own /new hook. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Restore memory_compact tool registration block in index.ts (was unintentionally dropped in previous commits; not related to PR CortexReach#433) - Remove bun.lock (local artifact, project uses npm) - Re-enable cwd: sessionDir in Claude Code subprocess options (isolated cwd is ready; OAuth auth issue was resolved) - Replace unsafe type casts in extractTextFromSdkMessage with explicit runtime property checks for robustness against SDK changes
Review: REQUEST-CHANGESFixing the duplicate Must fix:
Worth considering (not blocking):
|
|
Closing in favor of #441. Both PRs fix the same |
|
Closing: prefer #441 (rename) over deletion to preserve both tool implementations. |
Summary
memory_compacttool registration inindex.ts(leftover prototype from before PR feat: memory compaction — progressive summarization for stored memories #343)src/tools.tsviaregisterMemoryCompactTool()is kept as-isgateway_starthook (which callsrunCompactiondirectly) is unaffectedRoot cause:
memory_compactwas registered twice — once intools.ts(proper version) and once inindex.ts(old prototype). OpenClaw's tool-name conflict detection logged ERRORs on every gateway start/reload.Fix: Delete the 88-line prototype block in
index.ts. One registration, zero conflicts.Fixes #431
Test plan
openclaw statusno longer showsplugin tool name conflict (memory-lancedb-pro): memory_compactERRORmemory_compacttool still works via thetools.tsimplementationmemoryCompaction.enabled: true🤖 Generated with Claude Code