Repair VoidBot swarm CultMesh publication recovery
This commit is contained in:
parent
ed30ecc375
commit
3e5efa0ffd
2 changed files with 55 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ import { createRequire } from "node:module";
|
|||
import { dirname, extname, join, resolve } from "node:path";
|
||||
import { fileURLToPath, pathToFileURL } from "node:url";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
||||
import { mkdir, readFile, rename, stat, writeFile } from "node:fs/promises";
|
||||
|
||||
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const defaultStorageRoot = resolve(repoRoot, ".voidbot");
|
||||
|
|
@ -699,6 +699,41 @@ function deriveOrchestratorState(organs) {
|
|||
}
|
||||
|
||||
async function writeCultMeshPublication(snapshot, eveState, storePath) {
|
||||
return writeCultMeshPublicationAttempt(snapshot, eveState, storePath, false);
|
||||
}
|
||||
|
||||
function isUnreadableCultMeshStoreError(error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return (
|
||||
/Extra \d+ of \d+ byte\(s\) found at buffer\[\d+\]/i.test(message) ||
|
||||
/not a recognized CultCache MessagePack store/i.test(message) ||
|
||||
/failed to decode MessagePack/i.test(message)
|
||||
);
|
||||
}
|
||||
|
||||
async function quarantineCultMeshStore(storePath, error) {
|
||||
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
||||
const quarantinedPath = `${storePath}.corrupt-${stamp}`;
|
||||
await mkdir(dirname(storePath), { recursive: true });
|
||||
try {
|
||||
await rename(storePath, quarantinedPath);
|
||||
} catch (renameError) {
|
||||
if (renameError?.code === "ENOENT") {
|
||||
return null;
|
||||
}
|
||||
throw renameError;
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.stack ?? error.message : String(error);
|
||||
await writeFile(
|
||||
`${quarantinedPath}.txt`,
|
||||
`Quarantined unreadable generated VoidBot swarm CultMesh store.\nOriginal path: ${storePath}\nError: ${message}\n`,
|
||||
"utf8",
|
||||
);
|
||||
return quarantinedPath;
|
||||
}
|
||||
|
||||
async function writeCultMeshPublicationAttempt(snapshot, eveState, storePath, retriedAfterQuarantine) {
|
||||
try {
|
||||
const cultPackages = loadCultPackages();
|
||||
if (!cultPackages) {
|
||||
|
|
@ -804,6 +839,24 @@ async function writeCultMeshPublication(snapshot, eveState, storePath) {
|
|||
writtenAt: new Date().toISOString(),
|
||||
};
|
||||
} catch (error) {
|
||||
if (!retriedAfterQuarantine && isUnreadableCultMeshStoreError(error)) {
|
||||
const quarantinedPath = await quarantineCultMeshStore(storePath, error);
|
||||
const retry = await writeCultMeshPublicationAttempt(snapshot, eveState, storePath, true);
|
||||
if (retry.writeStatus === "ok") {
|
||||
return {
|
||||
...retry,
|
||||
recoveredFromCorruptStore: true,
|
||||
quarantinedStorePath: quarantinedPath,
|
||||
};
|
||||
}
|
||||
return {
|
||||
...retry,
|
||||
recoveredFromCorruptStore: false,
|
||||
quarantinedStorePath: quarantinedPath,
|
||||
writeError: `CultMesh store was quarantined after decode failure, but retry also failed: ${retry.writeError ?? retry.writeStatus}`,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
writeStatus: "failed",
|
||||
storePath,
|
||||
|
|
|
|||
|
|
@ -384,3 +384,4 @@
|
|||
{"ts":"2026-06-06T09:12:38Z","type":"implementation","status":"ok","note":"Dispatched six Persona stress-profile research shards across 17 identities, imported shard-*.json outputs through reusable agents:apply-stress-shards tooling, replaced swarm-generalization sketch stress responses in live Persona state, and verified stress coverage plus Libby projector prompt assembly."}
|
||||
{"ts":"2026-06-06T11:50:49Z","type":"implementation","status":"ok","note":"Renamed native Persona identity from the obsolete Meita label to stable id metame with public native name メタメ; moved private .cc state to .voidbot/private/personas/metame/metame.cc, repaired .cc selfProfile agentId/publicName, updated live registry and heartbeat heat override, and changed future stress seeding to metame."}
|
||||
{"ts":"2026-06-06T12:38:42Z","type":"implementation","status":"ok","note":"Cut Raven out of VoidBot's active stack: disabled Raven-backed local_llm provider and offsite backup in private config, taught operations checks/offsite sync to treat OFFSITE_BACKUP_ENABLED=false as an intentional skip, disabled the scheduled offsite task, restarted the stack, and verified operations health healthy with Raven checks skipped."}
|
||||
{"ts":"2026-06-06T18:57:24Z","type":"implementation","status":"ok","note":"VoidBot swarm CultMesh publisher now quarantines unreadable generated .cc stores and regenerates them before publication. Verified the repaired store decodes as cultcache.store.v1, Odin lists voidbot.swarm from E:/Projects/VoidBot/.voidbot/status/cultmesh/voidbot-swarm-state.cc, and Nightwing Gjallar is actively fetching ws://192.168.1.66:8797/eve/deck/voidbot.swarm."}
|
||||
|
|
|
|||
Loading…
Reference in a new issue