Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/capy/6712-pr4b-core' into capy/6712-pr4b-cursors
garrytan5de2e7b8e53e
diff --cc src/core/persistence/sync-run.tsindex f4a3b984a6,580008d63c..42b1517cb9--- a/src/core/persistence/sync-run.ts+++ b/src/core/persistence/sync-run.ts@@@ -1484,10 -1512,22 +1491,22 @@@ async function runManagedSync(engine: B// An abort mid-batch stops the pass with what the batch committed before it.if (signal?.aborted && error instanceof Error && error.name === 'AbortError') return result(live.cursor ?? batch, 'partial', 'timeout');throw error;- } finally { setPassBatch(batchKey, null); }+ } finally {+ setPassBatch(batchKey, null);+ const done = live.cursor;+ if (done?.passId && done !== folded) {+ folded = done;+ const { recovered, fences } = done.counts;+ if (recovered) totals.recovered = { count: (totals.recovered?.count ?? 0) + recovered.count, sample_paths: [...totals.recovered?.sample_paths ?? [], ...recovered.sample_paths].slice(0, 5),+ ...((totals.recovered?.comment_values ?? 0) + (recovered.comment_values ?? 0) ? { comment_values: (totals.recovered?.comment_values ?? 0) + (recovered.comment_values ?? 0) } : {}) };+ if (fences) totals.fences = { count: (totals.fences?.count ?? 0) + fences.count, by_class: sum(totals.fences?.by_class, fences.by_class),+ sample_paths: [...totals.fences?.sample_paths ?? [], ...fences.sample_paths].slice(0, 5), dirs: sum(totals.fences?.dirs, fences.dirs) };+ totals.converted = [...new Set([...totals.converted, ...done.convertedFromFailed ?? []])];+ }+ }} });}- const resolved = await resolvePassCursor(engine, { sourceId: context.sourceId, incarnation: context.incarnation, company, remote: authority.writer.remote, dryRun: !!opts.dryRun, assertActive, state });+ const resolved = await resolvePassCursor(engine, { sourceId: context.sourceId, incarnation: context.incarnation, company, remote: authority.writer.remote, dryRun: !!opts.dryRun, assertActive });key = resolved.key;if (resolved.waiting) return resolved.waiting;cursor = await readCursor(engine, key);diff --cc src/core/persistence/sync-status.tsindex 0f878ceb0c,ba48d0b435..b169386e84--- a/src/core/persistence/sync-status.ts+++ b/src/core/persistence/sync-status.ts@@@ -44,7 -44,8 +44,8 @@@ import { readSyncFile, resolveManagedSyimport { sha256 } from './digest.ts';import { passResumeArgs } from './sync-pass-readers.ts';import { passConvergence, passStatusNext, passStatusState } from './sync-pass-status.ts';-import { MANAGED_SYNC_PASS_OP, SYNC_DELETES_WITHHELD_OP, type PassRow } from './sync-pass-row.ts';+import { MANAGED_SYNC_PASS_OP, readPassRow, SYNC_DELETES_WITHHELD_OP, type PassRow } from './sync-pass-row.ts';+ import { SYNC_ADMISSION_SETTING_PARAMS, syncAdmissionSettingSql, syncAdmissionStatus } from './sync-admission.ts';import type { DeletesWithheld } from './sync-markers.ts';import { listIdentityDowngrades } from '../sync-identity-downgrades.ts';