Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
refactor(#6712 PR 4b lane C): delete retireCompletedCursor
garrytana8ebe34351a6
diff --git a/src/core/persistence/sync-run.ts b/src/core/persistence/sync-run.tsindex b771440a33..6b68c8fb39 100644--- a/src/core/persistence/sync-run.ts+++ b/src/core/persistence/sync-run.ts@@ -1317,18 +1317,6 @@ async function finishCheckpoint(engine: BrainEngine, key: string, cursor: CursorassertActive();return scheduled.length ? result(cursor, 'partial', 'writer_yield') : result(cursor, cursor.from === null ? 'first_sync' : 'synced');}-/** A finished cursor is deleted (compare-and-swap) before the next run discovers; returns whichever cursor replaced it. */-async function retireCompletedCursor(engine: BrainEngine, key: string, completed: Cursor, assertActive: () => void): Promise<Cursor | null> {- await engine.transaction(async tx => {- assertActive();- await assertDrainLease(tx, completed.sourceId);- await tx.executeRaw('DELETE FROM op_checkpoints WHERE op=$1 AND fingerprint=$2 AND completed_keys=$3::text::jsonb', [OP, key, JSON.stringify([header(completed)])]);- assertActive();- });- assertActive();- await clearManagedSyncFailureAfterSuccess(engine, key);- return readCursor(engine, key);-}/** What the hold report needs from a managed run: its source, cursor and authority. */interface HoldRunState { sourceId?: string; incarnation?: string; remote?: boolean; cursor?: () => Cursor | CursorHeader | null;/** #6712 PR 1: what the fan-in folded, and what resuming the source's one cursor kept from it. */@@ -1668,7 +1656,6 @@ async function runManagedSync(engine: BrainEngine, opts: SyncOpts, slice: { maxPassertActive();return result(cursor, cursor.from === null ? 'first_sync' : 'synced');}- if (cursor?.done) cursor = await retireCompletedCursor(engine, key, cursor, assertActive);if (!cursor) {assertActive();phase = 'discovery';