Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge lane L8 (#6735 checkpoint validation, #6727 legacy slugs, #6763 doctor idle) into #6712 PR 3

garrytan3fa06ed9d3c9
diff --cc src/core/persistence/sync-run.ts
index 8aa3893e4c,1264348843..134c83a182
--- a/src/core/persistence/sync-run.ts
+++ b/src/core/persistence/sync-run.ts
@@@ -1356,17 -1349,15 +1362,17 @@@ async function retryRecordedFailure(eng
const { stops: _stops, ...pending } = cursor.pending;
return { cursor: await saveCursor(engine, key, cursor, { ...cursor, pending }, false, assertActive) };
}
- // #6643/#6712: a legacy knock-on (re-frozen in place, `refreezeInPlace`) and a checkpoint refused only by a receipt that no
- // longer blocks it recover in the drain (settleFailedRequest); neither rediscovers the frozen manifest. A checkpoint a
- // receipt still blocks (since #6712 a legacy knock-on the cursor never settled is one) rediscovers, as --retry-failed says.
- if (failed && cursor.pending && isSyncKnockOn(failed)) return null;
- if (failed && cursor.pending?.intent.kind === 'managed_sync_checkpoint' && cursor.index === cursor.entries.length && revivableCheckpointRefusal(failed)
+ if (terminal && cursor.pending?.intent.kind === 'managed_sync_checkpoint' && cursor.index === cursor.entries.length
+ && (revivableCheckpointRefusal(failed!) || await checkpointRevival(engine, cursor, cursor.pending.intent, failed!))
- && !await findIncompleteSyncReceipt(engine, cursor.binding.worktree_id, cursor.runId, cursor.convertedFromFailed ?? [], cursor.settled ?? null)) return null;
+ && !await probeCheckpointBlocker(engine, cursor.binding.worktree_id, cursor.runId, cursor.convertedFromFailed ?? [], cursor.settled ?? null)) return null;
- const recorded = await engine.executeRaw("SELECT 1 FROM op_checkpoints WHERE op='managed-sync-failure' AND fingerprint=$1 AND completed_keys->0->>'run_id'=$2", [key, cursor.runId]);
- assertActive();
- if (!((failed && ['failed', 'conflict', 'cancelled'].includes(failed.state)) || (recorded.length && (failed?.state === 'committed' || !failed)))) return null;
+ // A slug-mode refusal the pin still disagrees with is a person's choice (rediscovering would adopt the new pin), and a
+ // checkpoint the source's last_commit moved away from is never rediscovered by itself (#6834: a path-sliced run would
+ // rediscover its slice's older target and move last_commit backward). Both stay recorded with their decision;
+ // `gbrain repair managed-sync-orphans` retires the cursor (and its slice record), and the next sync discovers again.
+ if (terminal && (failed!.error_code === 'slug_root_mode_mismatch'
+ || cursor.pending?.intent.kind === 'managed_sync_checkpoint' && failed!.error_code === 'revision_conflict' && failed!.error_message === CHECKPOINT_MOVED_MESSAGE)) return null;
+ if (terminal && cursor.pending!.intent.kind !== 'managed_sync_checkpoint' && replaysUnchangedRefusal(failed!, recorded,
+ { root: cursor.root, intent: cursor.pending!.intent, target: cursor.target, head: () => syncGit(context.gitRoot, ['rev-parse', 'HEAD']).trim() })) return null;
const blocker = await oldRunBlocker(engine, cursor, key);
assertActive();
if (blocker) return { wait: blocker };