Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(sync): report pinned commit after resumed sync (#3202)

caterpillarC15f70c3fe9d861
diff --git a/src/commands/sync.ts b/src/commands/sync.ts
index 7b056a8abc..2763063f4b 100644
--- a/src/commands/sync.ts
+++ b/src/commands/sync.ts
@@ -3462,7 +3462,7 @@ async function performSyncInner(engine: BrainEngine, opts: SyncOpts): Promise<Sy
return {
status: 'synced',
fromCommit: lastCommit,
- toCommit: headCommit,
+ toCommit: pin,
added: filtered.added.length,
modified: filtered.modified.length,
deleted: filtered.deleted.length,
diff --git a/test/sync-resumable-import.serial.test.ts b/test/sync-resumable-import.serial.test.ts
index 5124d3a86b..5ad8685776 100644
--- a/test/sync-resumable-import.serial.test.ts
+++ b/test/sync-resumable-import.serial.test.ts
@@ -203,15 +203,18 @@ describe('#1794 — resumable incremental sync (pinned target)', () => {
// Run 1: drains C0..C1 only, advances to the PIN (C1), not live HEAD (C2).
const r1 = await performSync(engine, { repoPath, noPull: true, noEmbed: true });
expect(r1.status).toBe('synced');
+ expect(r1.toCommit).toBe(c1);
+ expect(r1.toCommit).not.toBe(c2);
expect(await engine.getPage('notes/x')).not.toBeNull();
expect(await engine.getPage('notes/y')).toBeNull(); // past the pin, not yet
- expect(await lastCommitConfig()).toBe(c1);
+ expect(await lastCommitConfig()).toBe(r1.toCommit);
// Run 2: now anchored at C1, diff C1..C2 picks up y.
const r2 = await performSync(engine, { repoPath, noPull: true, noEmbed: true });
expect(r2.status).toBe('synced');
+ expect(r2.toCommit).toBe(c2);
expect(await engine.getPage('notes/y')).not.toBeNull();
- expect(await lastCommitConfig()).toBe(c2);
+ expect(await lastCommitConfig()).toBe(r2.toCommit);
}, 60_000);
// ── D. Rewrite of the pin → discard checkpoint, re-pin to HEAD ─────────────