summaryrefslogtreecommitdiff
path: root/src/mcp/tools
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-07-04 18:09:47 +0900
committertanaka takashi <isazaka@gmail.com>2026-07-04 18:09:47 +0900
commit5ac1c7adb7eeefd68dbed1bf6cfbe77cd348f257 (patch)
tree863c2baabb16bf5bf4c7f81929321ed922d9e35b /src/mcp/tools
parent0634f2048c7c9a474aab1d8104b964b3bf70a064 (diff)
fix(restart): skip dangling relations on memory index rebuild; prune on compaction
- Fix restart exit code 1 caused by missing relation targets after delete+rebuild - memory_index_build: skip relations whose targets no longer exist - store_rebuild / write_snapshot: prune dangling relations and sources - Remove diagnostic fprintf from server.c and context.c - Enable restart resume test in mcp_protocol_test.py - Add scripts/benchmark_p1_cp.py and run 10k/50k import/export round-trip - Mark P1-CP, P7-001, P7-CP complete in development-plan.md
Diffstat (limited to 'src/mcp/tools')
-rw-r--r--src/mcp/tools/common/context.c1
-rw-r--r--src/mcp/tools/common/memory_index.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/src/mcp/tools/common/context.c b/src/mcp/tools/common/context.c
index e833f70..bf59de9 100644
--- a/src/mcp/tools/common/context.c
+++ b/src/mcp/tools/common/context.c
@@ -1,5 +1,6 @@
#include "mcp/tools/common/context.h"
+#include <stdio.h>
#include <stdlib.h>
#include "base/allocator.h"
diff --git a/src/mcp/tools/common/memory_index.c b/src/mcp/tools/common/memory_index.c
index 36e430b..e3841e2 100644
--- a/src/mcp/tools/common/memory_index.c
+++ b/src/mcp/tools/common/memory_index.c
@@ -150,7 +150,12 @@ tiny_memory_index_build(const tiny_store_t *store)
{
const tiny_relation_t *value = &entry->message.metadata.relations[relation];
memory_bucket_t *target = find_bucket(index, value->message_id);
- if (!target || !add_incoming(target, position, value->type))
+ if (!target)
+ {
+ /* The relation target is missing (likely deleted during rebuild); skip it. */
+ continue;
+ }
+ if (!add_incoming(target, position, value->type))
{
tiny_memory_index_free(index);
return NULL;