fix(server): keep late memory refs from completing a collaboration Room (P1.5)

Chat collaboration writes run results to memory in the background and
records the memory refs when the writes finish. That update recomputed the
parent Room, so a workflow Room turned 'completed' while its synthesis step
was still running and could no longer be cancelled. A memory-refs update
never changes a run's status, so it no longer recomputes the parent.

The collaboration tests use an in-memory memory store and wait for the
background writes before reading memory refs.
This commit is contained in:
shumeiko.it
2026-10-24 12:50:23 +02:00
parent f310333970
commit 74a4e55be0
2 changed files with 51 additions and 38 deletions

View File

@@ -812,7 +812,9 @@ function recordResult(
metadata,
}).then((memoryRefs) => {
try {
server.agentRunRegistry.update(run.id, { memoryRefs });
// Memory refs never change a run's status, so a late write must not
// recompute the Room: that would complete it while synthesis still runs.
server.agentRunRegistry.update(run.id, { memoryRefs }, { recomputeParent: false });
} catch { /* the run was removed meanwhile */ }
});
}