Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(maintenance): the ghost refusal skips kinds that publish without a file (#6696 A12)

garrytanf6b0e22deb84
diff --git a/src/core/persistence/prepared-maintenance.ts b/src/core/persistence/prepared-maintenance.ts
index 99ae72d4d7..9bb57c1191 100644
--- a/src/core/persistence/prepared-maintenance.ts
+++ b/src/core/persistence/prepared-maintenance.ts
@@ -177,7 +177,7 @@ async function submitMaintenance(engine: BrainEngine, authority: MaintenanceAuth
const live = await liveFileDrift(engine, authority.writer.sourceId, slug, snapshot);
if (live.still_present === true) throw maintenanceDriftRefusal(authority.writer.sourceId, slug);
// #6696 (A12): the recorded canonical file is gone, so publication would refuse source_changed; refuse before a request exists.
- if (live.reason === CANONICAL_FILE_MISSING) throw maintenanceGhostRefusal(authority.writer.sourceId, slug);
+ if (live.reason === CANONICAL_FILE_MISSING && !PUBLISHES_WITHOUT_FILE.has(String(intent.kind))) throw maintenanceGhostRefusal(authority.writer.sourceId, slug);
}
// #6696 (A12): the same write refused K times in the window is not admitted again until something it depends on changes.
await assertRefusalBreakerClosed(engine, { principal: authority.writer.principal, sourceId: authority.writer.sourceId, slug,
@@ -198,6 +198,9 @@ export function maintenanceDriftRefusal(sourceId: string, slug: string): Operati
{ argv: ['gbrain', 'sources', 'reconcile', sourceId, '--brain', 'host', '--audit', '--conflicts', '--json'] }) });
}
+/** #6696 (A12): maintenance kinds whose preparer passes `allowMissingFile` (chronicle, stale-atom retirement): a missing canonical file publishes, so it is no ghost. */
+const PUBLISHES_WITHOUT_FILE = new Set(['managed_maintenance_chronicle_event', 'managed_maintenance_chronicle_retire', 'managed_maintenance_retire_stale_atoms']);
+
/** #6696 (A12): `source_changed` / `canonical_file_missing` before admission: the page's recorded file is gone; never a new request. */
export function maintenanceGhostRefusal(sourceId: string, slug: string): OperationError {
return opError('source_changed', 'The canonical file was removed outside coordinated publication.',