fix: make MongoDB mandatory, fail loud instead of degrading
Reverse the best-effort error swallowing. MongoDB is core to PodMan's continual-learning story and must always be used, so a broken memory layer must surface immediately rather than silently masquerade as working (which is how observations stayed at 0 unnoticed). - agent verifies Mongo via initMemory() at boot; bad creds / unreachable Atlas now fail loudly before joining the room, not mid-demo - server exits on Mongo init failure instead of warning and limping on - getGitStates and onScreenFrame no longer swallow Mongo errors - memory persist() logs the failure and rethrows instead of warning Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaCFWMkYQmTcuPsxaaACft
This commit is contained in:
@@ -10,14 +10,16 @@ import { enrichCollisionMemory } from './vectors.js';
|
||||
|
||||
/**
|
||||
* Continual-learning memory: persist observations, collisions, interventions,
|
||||
* and outcomes to MongoDB so later sessions get sharper. Writes are best-effort
|
||||
* — a Mongo hiccup logs a warning rather than crashing the agent/server.
|
||||
* and outcomes to MongoDB so later sessions get sharper. MongoDB is mandatory —
|
||||
* a failed write is surfaced loudly and rethrown, never silently swallowed, so
|
||||
* a broken memory layer can never masquerade as a working one.
|
||||
*/
|
||||
async function persist(name: string, fn: () => Promise<unknown>): Promise<void> {
|
||||
try {
|
||||
await fn();
|
||||
} catch (err) {
|
||||
console.warn(`[memory] ${name} persist failed: ${(err as Error).message}`);
|
||||
console.error(`[memory] ${name} persist FAILED: ${(err as Error).message}`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user