Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: withheld removals pass the door their planned state; progress test reads the second strict pass as an in-place admission

garrytan5094557a05e9
diff --git a/src/core/persistence/git-conversion.ts b/src/core/persistence/git-conversion.ts
index 304eb6ab78..db237ab051 100644
--- a/src/core/persistence/git-conversion.ts
+++ b/src/core/persistence/git-conversion.ts
@@ -646,7 +646,7 @@ async function withholdGroups(engine: BrainEngine, plan: GitConversionPlan, prev
if ((disk ? sha256(disk) : null) !== item.disk) throw previewChangedError(plan.preview.preview_hash, previewCommand);
}
for (const item of group) removeConfined(root, join(root, item.path));
- const commit = await commitThroughDoor(root, group.map(item => ({ path: join(root, item.path) })), lock);
+ const commit = await commitThroughDoor(root, group.map(item => ({ path: join(root, item.path), planned: null })), lock);
if (commit) commits.push(commit);
await stamp(group);
} finally { await lock.release(); }
diff --git a/test/git-canonical-conversion-progress.test.ts b/test/git-canonical-conversion-progress.test.ts
index 3d4fe95958..9079a3b2aa 100644
--- a/test/git-canonical-conversion-progress.test.ts
+++ b/test/git-canonical-conversion-progress.test.ts
@@ -63,11 +63,14 @@ for (const backend of testBackends()) describe('[' + backend + '] #7644: a conve
.toEqual([[0, BULK, 0], [CONVERSION_GROUP_MAX, BULK, 1], [BULK, BULK, 2]]);
for (const phase of ['strict_pass_1', 'strict_pass_2'] as const) {
const pass = seen.filter(progress => progress.phase === phase);
- expect(pass.every(progress => progress.groups_committed === 2)).toBe(true);
- // A round's level read sets the total, and its batch entries settle up to it.
+ expect(pass.every(progress => progress.groups_committed === 2 && progress.scanned <= progress.total)).toBe(true);
+ // A round's level read sets the total.
expect(pass.some(progress => progress.round === 1 && progress.total >= BULK)).toBe(true);
- expect(pass.some(progress => progress.round === 1 && progress.scanned > 0 && progress.scanned <= progress.total)).toBe(true);
}
+ // The first pass settles its batch entries up to the total; the second admits every page, now current, in place, so its round has nothing to settle.
+ expect(seen.some(progress => progress.phase === 'strict_pass_1' && progress.round === 1 && progress.scanned >= BULK)).toBe(true);
+ expect(seen.filter(progress => progress.phase === 'strict_pass_2').every(progress => progress.scanned === 0)).toBe(true);
+ expect(seen.some(progress => progress.phase === 'strict_pass_2' && progress.round === 1 && progress.total === 0)).toBe(true);
}, { databaseUrl, setup: bulkSetup }), 300_000);
test('the CLI prints a progress line on stderr at each phase, and a JSON line with --json', () => managedBrain(async ({ engine }) => {