Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(sync): drain the colon-slug managed first syncs instead of asserting one pass
garrytan39cceee0dd65
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d8ec4962c8..e77051d613 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,16 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [0.60.89.0] - 2026-10-06++**The Windows colon-slug managed-sync test no longer fails with `partial` when its first page publishes slowly.**++`test/colon-slug-windows-5032.test.ts` ran one managed sync pass and expected `first_sync`. A single pass is a single attempt by design: when a page's write is still publishing after the pass's 5-second wait, the pass returns `partial` with reason `writer_pending`, the write stays queued, and the next pass resumes from the same cursor. `gbrain sync` never stops there, because it always drains: it re-enters the pass until the cursor is done. On the `windows-latest` security-regressions runner, the first page's publication took longer than 5 seconds, so the test failed even though the sync would have finished. The two managed first syncs in the file now run through the same drain `gbrain sync` uses and keep every assertion. When the status check fails, it now prints the result's reason, its drain report and the state of each write request. gbrain itself does not change.++### For contributors++- A probe preload holds the consumer's first prepared request for 6 seconds. Before the fix, it reproduces the CI failure on PGLite (`partial`, `writer_pending`, `notes/plain` still `running`) and also fails the POSIX rename test. After the fix, all 9 tests pass with the probe on PGLite and Postgres, and with a 35-second hold, longer than the drain's 30-second per-page wait.+## [0.60.88.0] - 2026-10-06**`think` now reads with the current date and each page's date, so "last month" and "yesterday" resolve correctly. On held-out conversations it answered 88.2% of questions right instead of 74.2%.**diff --git a/test/colon-slug-windows-5032.test.ts b/test/colon-slug-windows-5032.test.tsindex d4f36ce9fd..d8f6451ba1 100644--- a/test/colon-slug-windows-5032.test.ts+++ b/test/colon-slug-windows-5032.test.ts@@ -28,10 +28,12 @@ import { operations, OperationError, type OperationContext } from '../src/core/oimport { claimWorktree } from '../src/core/persistence/ownership.ts';import { prepareFileTarget } from '../src/core/persistence/page-prepare.ts';import { performManagedSync } from '../src/core/persistence/sync-run.ts';+import { drainManagedSync } from '../src/core/persistence/sync-drain.ts';import { disposePersistenceConsumer } from '../src/core/persistence/service.ts';import { nativeLockCapability } from '../src/core/persistence/native-lock.ts';import { printManagedSyncNotes } from '../src/commands/sync-diagnostics.ts';import { performSync } from '../src/commands/sync/perform.ts';+import type { SyncResult } from '../src/commands/sync.ts';import { loadSyncFailures } from '../src/core/sync-failure-ledger.ts';import { isolatedPersistencePostgres } from './helpers/persistence-postgres.ts';import { withEnv } from './helpers/with-env.ts';@@ -65,6 +67,13 @@ async function addSource(engine: BrainEngine, root: string | null): Promise<strireturn id;}+/** A sync result with its reason and the source's write requests, so a failed status assertion shows why. */+async function syncState(engine: BrainEngine, sourceId: string, result: SyncResult) {+ const requests = await engine.executeRaw<{ slug: string; state: string; blocked_reason: string | null }>(+ 'SELECT slug,state,blocked_reason FROM persistence_requests WHERE source_id=$1 ORDER BY created_at', [sourceId]);+ return { status: result.status, reason: result.reason, drain: result.drain, requests };+}+function git(root: string, ...args: string[]): string {return execFileSync('git', ['-c', 'core.protectNTFS=false', '-C', root, ...args], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();}@@ -181,8 +190,9 @@ describe('#5032 managed sync of committed colon files on Windows', () => {await claimWorktree(engine, sourceId, root);await engine.executeRaw('UPDATE persistence_brain SET enabled=true WHERE singleton=1');- const result = await asWindows(() => performManagedSync(engine, { sourceId, noPull: true }));- expect(result.status).toBe('first_sync');+ // A single managed pass returns partial/writer_pending when a page's write outlives its wait; the CLI drains.+ const result = await asWindows(() => drainManagedSync(engine, { sourceId, noPull: true }, false));+ expect(await syncState(engine, sourceId, result)).toMatchObject({ status: 'first_sync' });expect(result.fileRefusals).toEqual([{path: 'notes/calendar:abc.md', code: 'colon_slug_windows_write_through',message: "notes/calendar:abc.md has a ':' in its name, which Windows cannot store; sync skipped it.",@@ -213,7 +223,7 @@ describe('#5032 managed sync of a rename away from a colon file on Windows', ()const sourceId = await addSource(engine, root);await claimWorktree(engine, sourceId, root);await engine.executeRaw('UPDATE persistence_brain SET enabled=true WHERE singleton=1');- expect((await performManagedSync(engine, { sourceId, noPull: true })).status).toBe('first_sync');+ expect(await syncState(engine, sourceId, await drainManagedSync(engine, { sourceId, noPull: true }, false))).toMatchObject({ status: 'first_sync' });const [before] = await engine.executeRaw<{ id: number; slug: string }>("SELECT id,slug FROM pages WHERE source_id=$1 AND source_path='notes/calendar:abc.md' AND deleted_at IS NULL", [sourceId]);expect(before).toBeDefined();