Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(#6712 PR 4b): doctor warns on a slow no-change pass; a keep_db_pending path makes the next pass full; tests for the keep_db cap, null cursor fields and refresh beside an open pass
garrytan57a24a1d0570
diff --git a/src/commands/doctor/checks/managed-sync-movement.ts b/src/commands/doctor/checks/managed-sync-movement.tsindex 5e047ff5bc..f335db86fe 100644--- a/src/commands/doctor/checks/managed-sync-movement.ts+++ b/src/commands/doctor/checks/managed-sync-movement.ts@@ -14,13 +14,37 @@* counts like a cursor; a pass that keeps stopping (`blocked`, a* `not_converged` or `settle_mismatch` streak) warns as not moving, with* `gbrain sync status` as the read-only fix (it also reads the checkout's HEAD).+ * #6712 PR 4b (design v3.1 §9, DX F14): with nothing else to report, it warns when a source's newest pass found no+ * change (`up_to_date`) but took longer than the §11 target for its kind and size: an idle tick 0.5 s (1 s over+ * 100,000 pages), a full round 2 s (15 s over 100,000 pages). The message names the pass's `timings_ms`; the fix is the+ * read-only `gbrain sync status --detail`. Never a fail.*/import type { Check } from '../../doctor.ts';import { connectedEngine, type DoctorContext, type DoctorEntry } from '../context.ts';import { readSourceMovement, type SourceMovement } from '../../../core/persistence/sync-movement.ts';import { agentFix, checkError } from '../check-fix.ts';+import { readLivePassRows } from '../../../core/persistence/sync-pass-row.ts';const DOCS = 'docs/guides/troubleshooting.md#managed-sync-not-moving';+/** Design §11's no-change pass targets (ms) by pass kind, for a source up to and over `LARGE_SOURCE_PAGES`. */+const NO_CHANGE_TARGET_MS = { idle: [500, 1000], full: [2000, 15_000] } as const;+const LARGE_SOURCE_PAGES = 100_000;++interface SlowPass { source_id: string; pass_id: string; kind: string; ended_at: string | null; duration_ms: number; target_ms: number; large: boolean; timings_ms: Record<string, number> }++/** Sources whose newest pass ended `up_to_date` slower than its target; sizes are counted only for passes over the small target. */+async function slowNoChangePasses(engine: ReturnType<typeof connectedEngine>): Promise<SlowPass[]> {+ const slow: SlowPass[] = [];+ for (const [sourceId, row] of await readLivePassRows(engine)) {+ const t = row.value.telemetry;+ const targets = NO_CHANGE_TARGET_MS[t.kind === 'idle' ? 'idle' : 'full'];+ if (t.outcome !== 'up_to_date' || t.duration_ms === null || t.duration_ms <= targets[0]) continue;+ const [size] = await engine.executeRaw<{ n: number | string }>('SELECT count(*) AS n FROM (SELECT 1 FROM pages WHERE source_id=$1 LIMIT $2) p', [sourceId, LARGE_SOURCE_PAGES + 1]);+ const large = Number(size?.n ?? 0) > LARGE_SOURCE_PAGES, target = targets[large ? 1 : 0];+ if (t.duration_ms > target) slow.push({ source_id: sourceId, pass_id: t.pass_id, kind: t.kind, ended_at: t.ended_at, duration_ms: t.duration_ms, target_ms: target, large, timings_ms: t.timings_ms ?? {} });+ }+ return slow;+}async function runManagedSyncMovementCheck(ctx: DoctorContext): Promise<Check[]> {const checks: Check[] = [];@@ -30,7 +54,8 @@ async function runManagedSyncMovementCheck(ctx: DoctorContext): Promise<Check[]>const stuck = pending.filter(m => m.movement_state === 'not_moving');const parked = pending.filter(m => m.movement_state === 'parked');const stranded = parked.filter(strandedQueue);- const details = { count: stuck.length, parked: parked.length, stranded: stranded.length, sources: pending.map(m => ({ source_id: m.source_id, movement_state: m.movement_state, data_moving: m.data_moving,+ const slow = await slowNoChangePasses(connectedEngine(ctx));+ const details = { slow_passes: slow, count: stuck.length, parked: parked.length, stranded: stranded.length, sources: pending.map(m => ({ source_id: m.source_id, movement_state: m.movement_state, data_moving: m.data_moving,not_moving_since: m.not_moving_since, last_commit_at: m.last_commit_at, last_progress_at: m.last_progress_at, cursor: m.cursor, pass: m.pass, head: m.head, live: m.live, admitted: m.admitted,ceiling_ms: m.ceiling_ms, writer_status_command: m.writer_status_command })), docs: DOCS };if (stranded.length) {@@ -56,6 +81,12 @@ async function runManagedSyncMovementCheck(ctx: DoctorContext): Promise<Check[]>+ `managed sync data has not moved for longer than the ${Math.round(first.ceiling_ms / 1000)}s ceiling while a sync or consumer is live. The health signals are green; the data is not.`,fix: agentFix(['gbrain', 'sources', 'writer', 'status', '--source', first.source_id, '--json'],'Read-only: names the request at the head, its step, what it waits on, the owner process and the next step (`claim.next`) on the running claim.', 'managed_sync_not_moving', { docs: DOCS }) });+ } else if (slow.length) {+ checks.push({ name: 'managed_sync_not_moving', status: 'warn', details,+ message: `${slow.map(s => `${s.source_id} (its newest ${s.kind} pass found no change in ${s.duration_ms} ms, over the ${s.target_ms} ms target for a source `+ + `${s.large ? 'over' : 'up to'} ${LARGE_SOURCE_PAGES.toLocaleString('en-US')} pages; timings_ms ${JSON.stringify(s.timings_ms)})`).join('; ')}: managed sync is current but slow to confirm it.`,+ fix: agentFix(['gbrain', 'sync', 'status', '--source', slow[0]!.source_id, '--json', '--detail'],+ 'Read-only: the newest pass (`convergence.duration_ms`, `timings_ms`) beside a fresh read of the checkout, to see which step is slow.', 'managed_sync_not_moving', { docs: DOCS }) });} else if (pending.length) {checks.push({ name: 'managed_sync_not_moving', status: 'ok', severity: 'info', details,message: `Managed sync data is moving${parked.length ? `; ${parked.map(m => { const work = (m.cursor ?? m.pass)!; return `${m.source_id} is parked at ${work.index}/${work.total} (no sync or consumer live; resume: ${work.resume_command})`; }).join('; ')}` : ''}.` });diff --git a/src/core/persistence/sync-pass-run.ts b/src/core/persistence/sync-pass-run.tsindex df2dcee047..2cc890fe5e 100644--- a/src/core/persistence/sync-pass-run.ts+++ b/src/core/persistence/sync-pass-run.ts@@ -354,6 +354,7 @@ export async function runSyncPass(engine: BrainEngine, input: SyncPassInput): Prconst holds = (sourceHolds[0]?.holds ?? []).filter(hold => hold.incarnation === incarnation);// Working mode (design §2.2): the stat cache this process kept from the round its last stamp used; a cold process has none.const cacheKey = passFingerprint(sourceId, incarnation);+ const kindStarted = Date.now();const working = mode === 'working' && converged ? await workingIdleChange(context, recallWorkingStatCache(cacheKey)) : { changed: mode === 'working', cache: null };const kindOf = syncPassKind({ converged: converged ? { target: converged.target, parserFp: converged.parser_fp, pack: converged.pack, selectionFp: converged.selection_fp,passesSinceFull: converged.passes_since_full, lastFullAt: Date.parse(converged.last_full_at) } : null,@@ -363,7 +364,9 @@ export async function runSyncPass(engine: BrainEngine, input: SyncPassInput): PrworkingChange: working.changed, rescreenDueHold: holds.some(hold => holdRescreenDue(hold, retry.includes(hold.path))), full: opts.full === true });// Design §2.6: a withheld mass delete is applied by a full round once the owner host's env valve allows it.const valveOpen = !remote && !!obligations.deletes_withheld && massReconcileAllowed();- const kind: PassKind = admission === 'classify_only' && kindOf.kind === 'idle' ? 'idle' : valveOpen && kindOf.kind === 'idle' ? 'full' : kindOf.kind;+ // Design §4: keep_db writes the previous pass's cap deferred (`keep_db_pending`) are owed to this pass, so it is not idle.+ const keepDbOwed = !remote && admission === 'normal' && (prior?.value.telemetry.classes?.keep_db_pending?.count ?? 0) > 0;+ const kind: PassKind = admission === 'classify_only' && kindOf.kind === 'idle' ? 'idle' : (valveOpen || keepDbOwed) && kindOf.kind === 'idle' ? 'full' : kindOf.kind;const value: ManagedSyncPassValue = { source_id: sourceId, incarnation, lease_token: lease.token, obligations,telemetry: { pass_id: passId, target: head, started_at: startedAt, ended_at: null, kind, round: 0, outcome: 'open', stop_reason: null, candidates: 0, settled: 0, remaining: 0,counts: {}, duration_ms: null, timings_ms: {} } };@@ -379,7 +382,7 @@ export async function runSyncPass(engine: BrainEngine, input: SyncPassInput): Pr// Design §7: an owner approval (--yes) on an idle tick still makes an unknown cost known again.if (opts.costApproved && value.obligations.cost?.approved_usd === null) value.obligations.cost = (await passCostDecision(engine, { sourceId, incarnation,scope: episode?.full_id ?? passId, priorRow: true, prior: value.obligations.cost, approved: true })).cost;- value.telemetry = { ...value.telemetry, outcome: 'up_to_date', ended_at: at, duration_ms: Date.now() - started };+ value.telemetry = { ...value.telemetry, outcome: 'up_to_date', ended_at: at, duration_ms: Date.now() - started, timings_ms: { setup: kindStarted - started, kind: Date.now() - kindStarted } };await engine.transaction(tx => withCoordinatedWrite(tx, [sourceId], async () => {assertActive();// One round trip: the lease check, the stamp and the row (started at the transaction's clock) are pipelined; a lostdiff --git a/test/doctor-slow-pass-6712.test.ts b/test/doctor-slow-pass-6712.test.tsnew file mode 100644index 0000000000..a524b7fcb8--- /dev/null+++ b/test/doctor-slow-pass-6712.test.ts@@ -0,0 +1,68 @@+/**+ * #6712 PR 4b (design v3.1 §9, DX F14; §11 targets): doctor `managed_sync_not_moving` warns when a source's newest pass+ * found no change (`up_to_date`) but took longer than the §11 target for its kind: an idle tick 0.5 s, a full round 2 s+ * (sources up to 100,000 pages). The warning names the pass's `timings_ms`, its fix is the read-only+ * `gbrain sync status --detail`, and it is never a fail. A pass that changed something, or one inside its target, reads ok.+ * A real idle tick records its own `timings_ms` (`setup`, `kind`). PGLite.+ */+import { describe, expect, test } from 'bun:test';+import { execFileSync } from 'node:child_process';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import type { BrainEngine } from '../src/core/engine.ts';+import { performManagedSync } from '../src/core/persistence/sync-run.ts';+import { MANAGED_SYNC_PASS_OP } from '../src/core/persistence/sync-pass-row.ts';+import { managedSyncMovementEntry } from '../src/commands/doctor/checks/managed-sync-movement.ts';+import { managedBrain } from './helpers/managed-brain.ts';++const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();+const OPTS = { sourceId: 'default', noPull: true, noEmbed: true, noExtract: true };+const setup = ({ root }: { root: string }) => {+ mkdirSync(join(root, 'notes'), { recursive: true }); git(root, 'init', '-q');+ writeFileSync(join(root, 'notes/a.md'), '---\ntype: concept\ntitle: a\n---\n\nThe body of a.\n');+ git(root, 'add', '-A'); git(root, '-c', 'user.name=Example', '-c', '[email protected]', 'commit', '-qm', 'notes');+};++type Check = { status: string; message: string; details: { slow_passes: Array<{ source_id: string; duration_ms: number; target_ms: number; kind: string }> }; fix?: { argv: string[] } };+const doctor = async (engine: BrainEngine) => (await managedSyncMovementEntry.run({ engine } as never) as unknown as Check[])[0]!;+const telemetry = async (engine: BrainEngine) => (await engine.executeRaw<{ t: Record<string, unknown> }>(+ "SELECT completed_keys->0->'telemetry' AS t FROM op_checkpoints WHERE op=$1 AND completed_keys->0->>'source_id'='default'", [MANAGED_SYNC_PASS_OP]))[0]!.t;+const setTelemetry = (engine: BrainEngine, patch: Record<string, unknown>) => engine.executeRaw(+ "UPDATE op_checkpoints SET completed_keys=jsonb_build_array(jsonb_set(completed_keys->0,'{telemetry}',(completed_keys->0->'telemetry')||$2::text::jsonb)) WHERE op=$1 AND completed_keys->0->>'source_id'='default'",+ [MANAGED_SYNC_PASS_OP, JSON.stringify(patch)]);++describe('#6712 PR 4b: doctor warns on a slow no-change pass', () => {+ test('an idle tick records its timings; over its 0.5 s target it warns naming them, with the read-only --detail fix; inside it, or after a change, it is ok', () => managedBrain(async ({ engine }) => {+ expect((await performManagedSync(engine, OPTS)).status).toBe('first_sync');+ expect((await performManagedSync(engine, OPTS)).status).toBe('up_to_date');+ const idle = await telemetry(engine);+ expect(idle).toMatchObject({ kind: 'idle', outcome: 'up_to_date' });+ expect(Object.keys(idle.timings_ms as Record<string, number>).sort()).toEqual(['kind', 'setup']);++ await setTelemetry(engine, { duration_ms: 400 });+ expect(await doctor(engine)).toMatchObject({ status: 'ok', details: { slow_passes: [] } });++ await setTelemetry(engine, { duration_ms: 900, timings_ms: { setup: 850, kind: 50 } });+ const slow = await doctor(engine);+ expect(slow.status).toBe('warn');+ expect(slow.details.slow_passes).toEqual([expect.objectContaining({ source_id: 'default', kind: 'idle', duration_ms: 900, target_ms: 500 })]);+ expect(slow.message).toContain('default (its newest idle pass found no change in 900 ms, over the 500 ms target');+ expect(slow.message).toMatch(/; timings_ms \{("setup":850,"kind":50|"kind":50,"setup":850)\}\)/);+ expect(slow.fix?.argv).toEqual(['gbrain', 'sync', 'status', '--source', 'default', '--json', '--detail']);++ // A full round that found no change has the 2 s target; a pass that changed something is not a no-change pass.+ await setTelemetry(engine, { kind: 'full', duration_ms: 1500 });+ expect((await doctor(engine)).status).toBe('ok');+ await setTelemetry(engine, { kind: 'full', duration_ms: 2500 });+ expect(await doctor(engine)).toMatchObject({ status: 'warn', details: { slow_passes: [expect.objectContaining({ kind: 'full', target_ms: 2000 })] } });+ await setTelemetry(engine, { outcome: 'synced', duration_ms: 60_000 });+ expect(await doctor(engine)).toMatchObject({ status: 'ok', details: { slow_passes: [] } });+ }, { setup }), 120_000);++ test('it is never a fail, however slow the pass', () => managedBrain(async ({ engine }) => {+ expect((await performManagedSync(engine, OPTS)).status).toBe('first_sync');+ expect((await performManagedSync(engine, OPTS)).status).toBe('up_to_date');+ await setTelemetry(engine, { duration_ms: 3_600_000 });+ expect((await doctor(engine)).status).toBe('warn');+ }, { setup }), 120_000);+});diff --git a/test/keep-db-pass-cap-6712.test.ts b/test/keep-db-pass-cap-6712.test.tsnew file mode 100644index 0000000000..04ec08d337--- /dev/null+++ b/test/keep-db-pass-cap-6712.test.ts@@ -0,0 +1,61 @@+/**+ * #6712 PR 4b (design v3.2 §4): a managed sync pass admits at most `PASS_KEEP_DB_MAX` keep_db (database-wins) writes; the+ * rest settle as `keep_db_pending` (owned by sync, action `owner`) and the next pass admits them first. Seeded above+ * the cap on PGLite: `PASS_KEEP_DB_MAX + 1` pages under a `storage.keep_db` prefix, each edited in the database only.+ */+import { describe, expect, test } from 'bun:test';+import { execFileSync } from 'node:child_process';+import { randomUUID } from 'node:crypto';+import { mkdirSync, writeFileSync } from 'node:fs';+import { join } from 'node:path';+import type { BrainEngine } from '../src/core/engine.ts';+import type { OperationContext } from '../src/core/ops/contract.ts';+import { performManagedSync } from '../src/core/persistence/sync-run.ts';+import { submitPageMutation } from '../src/core/persistence/page-mutations.ts';+import { PASS_KEEP_DB_MAX } from '../src/core/persistence/sync-pass-apply.ts';+import { MANAGED_SYNC_PASS_OP } from '../src/core/persistence/sync-pass-row.ts';+import { managedBrain } from './helpers/managed-brain.ts';+import { waitFor } from './helpers/wait-for.ts';++const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();+const commit = (root: string, message: string) => { git(root, 'add', '-A'); git(root, '-c', 'user.name=Example', '-c', '[email protected]', 'commit', '-qm', message); };+const note = (slug: string, body: string) => `---\ntype: concept\ntitle: ${slug}\n---\n\n${body}\n`;+const SLUGS = Array.from({ length: PASS_KEEP_DB_MAX + 1 }, (_, i) => `notes/n${String(i).padStart(3, '0')}`);+const OPTS = { sourceId: 'default', noPull: true, noEmbed: true, noExtract: true };+const setup = ({ root }: { root: string }) => {+ mkdirSync(join(root, 'notes'), { recursive: true }); git(root, 'init', '-q');+ for (const slug of SLUGS) writeFileSync(join(root, `${slug}.md`), note(slug, `The committed body of ${slug}.`));+ commit(root, 'notes');+};+async function databaseOnlyEdits(engine: BrainEngine, ctx: OperationContext): Promise<void> {+ const ids: string[] = [];+ for (const slug of SLUGS) {+ const requestId = randomUUID(); ids.push(requestId);+ const current = await engine.readPageSnapshot(slug, { sourceId: 'default' });+ await submitPageMutation(ctx, { operation: 'put_page', params: { slug, request_id: requestId, expected_revision: current!.revision, content: note(slug, `The database-only edit of ${slug}.`) } });+ }+ await waitFor(async () => Number((await engine.executeRaw<{ n: number | string }>("SELECT count(*) AS n FROM persistence_requests WHERE request_id=ANY($1::uuid[]) AND state='committed'", [ids]))[0]!.n) === ids.length,+ { timeoutMs: 120_000, label: 'every database-only put_page commits' });+}+const telemetry = async (engine: BrainEngine) => (await engine.executeRaw<{ t: { counts: Record<string, number>; classes?: Record<string, { count: number; action: string }> } }>(+ "SELECT completed_keys->0->'telemetry' AS t FROM op_checkpoints WHERE op=$1 AND completed_keys->0->>'source_id'='default'", [MANAGED_SYNC_PASS_OP]))[0]!.t;++describe('#6712 PR 4b: keep_db writes per pass', () => {+ test(`a pass admits at most PASS_KEEP_DB_MAX (${PASS_KEEP_DB_MAX}) keep_db writes, the rest wait as keep_db_pending, and the next pass admits them`, () => managedBrain(async ({ engine, ctx, root }) => {+ await engine.setConfig('sync.write_through', 'false');+ expect((await performManagedSync(engine, OPTS)).status).toBe('first_sync');+ await databaseOnlyEdits(engine, ctx);+ writeFileSync(join(root, 'gbrain.yml'), 'storage:\n keep_db:\n - notes/\n'); commit(root, 'keep_db');+ expect((await performManagedSync(engine, OPTS)).held ?? []).toEqual([]);+ // counts.keep_db_pending counts deferrals across the round's re-reads; the class counts the paths left waiting.+ const first = await telemetry(engine);+ expect(first.counts.keep_db_admitted).toBe(PASS_KEEP_DB_MAX);+ expect(first.counts.keep_db_pending).toBeGreaterThan(0);+ expect(first.classes?.keep_db_pending).toEqual({ count: 1, action: 'owner' });+ await performManagedSync(engine, OPTS);+ const second = await telemetry(engine);+ expect(second.counts).toMatchObject({ keep_db_admitted: 1, keep_db_pending: 0 });+ expect((await engine.getPage(SLUGS.at(-1)!, { sourceId: 'default' }))?.compiled_truth).toContain('The database-only edit of ' + SLUGS.at(-1) + '.');+ expect(second.classes?.keep_db_pending).toBeUndefined();+ }, { setup }), 600_000);+});diff --git a/test/persistence-worktree-refresh.test.ts b/test/persistence-worktree-refresh.test.tsindex 73cccaa1f9..15190f16f8 100644--- a/test/persistence-worktree-refresh.test.ts+++ b/test/persistence-worktree-refresh.test.ts@@ -35,6 +35,7 @@ import { runManagedSourceLifecycle } from '../src/core/persistence/source-lifecyimport { runPersistenceAdministration } from '../src/core/persistence/administration.ts';import { performManagedSync } from '../src/core/persistence/sync-run.ts';import { refreshWorktree, resumeWorktreeRefreshes } from '../src/core/persistence/worktree-refresh.ts';+import { MANAGED_SYNC_PASS_OP, writePassRow, type ManagedSyncPassValue } from '../src/core/persistence/sync-pass-row.ts';import { withCoordinatedWrite } from '../src/core/persistence/context.ts';import { TEST_WRITE_ATTRIBUTION } from './helpers/write-attribution.ts';import { _resetCliExitVerdictForTests, currentExitCode } from '../src/core/cli-force-exit.ts';@@ -271,6 +272,28 @@ test('9. an unexhausted managed-sync cursor refuses sync_in_progress with its re} finally { await f.engine.executeRaw(`DELETE FROM op_checkpoints WHERE op='managed-sync' AND fingerprint=$1`, [key]); }}), 120_000);+test('9b. #6712 PR 4b: an open non-company sync pass does not refuse the refresh (a cursor still does, test 9); the next pass converges at the new HEAD', () => each(async f => {+ f.push('alpha/two.md', page('Alpha two', 'Upstream.'));+ const before = f.head();+ const [source] = await f.engine.executeRaw<{ incarnation: string }>('SELECT incarnation::text AS incarnation FROM sources WHERE id=$1', [f.beta]);+ const passId = randomUUID();+ const value: ManagedSyncPassValue = { source_id: f.beta, incarnation: source!.incarnation, lease_token: randomUUID(),+ obligations: { baseline_commit: null, mismatch: {}, not_converged_streak: 0, faults: {} },+ telemetry: { pass_id: passId, target: 'HEAD', started_at: new Date().toISOString(), ended_at: null, kind: 'full', round: 1, outcome: 'open', stop_reason: null,+ candidates: 5, settled: 2, remaining: 3, counts: {}, duration_ms: null, timings_ms: {} } };+ expect(await writePassRow(f.engine, value, { pin: true })).toBe(true);+ try {+ const result = await refreshWorktree(f.engine, f.alpha);+ expect(result).toMatchObject({ status: 'completed', old_head: before });+ expect(result.target_head).not.toBe(before);+ // The refresh's own sync of the members is the next pass: it replaces the open row and converges at the new HEAD.+ expect(result.synced).toContainEqual({ source_id: f.beta, status: 'synced', last_commit: result.target_head as string | null });+ const [row] = await f.engine.executeRaw<{ pass_id: string; outcome: string }>("SELECT completed_keys->0->'telemetry'->>'pass_id' AS pass_id, completed_keys->0->'telemetry'->>'outcome' AS outcome FROM op_checkpoints WHERE op=$1 AND completed_keys->0->>'source_id'=$2", [MANAGED_SYNC_PASS_OP, f.beta]);+ expect(row).toMatchObject({ outcome: 'synced' });+ expect(row?.pass_id).not.toBe(passId);+ } finally { await f.engine.executeRaw("DELETE FROM op_checkpoints WHERE op=$1 AND completed_keys->0->>'source_id'=$2", [MANAGED_SYNC_PASS_OP, f.beta]); }+}), 120_000);+test('10. source add and remove on the worktree during a refresh refuse refresh_in_progress', () => each(async f => {f.push('alpha/two.md', page('Alpha two', 'Upstream.'));const result = await refreshWorktree(f.engine, f.alpha, { hooks: { boundary: async point => {diff --git a/test/sync-pass-shadow-6712.test.ts b/test/sync-pass-shadow-6712.test.tsindex 93da6013e5..153252a311 100644--- a/test/sync-pass-shadow-6712.test.ts+++ b/test/sync-pass-shadow-6712.test.ts@@ -195,4 +195,14 @@ describe('#6712 PR 4a convergence shadow (pglite)', () => {expect(detail.convergence).toMatchObject({ dry_run: true, counts: { matched: 3 } });expect((detail.convergence as Record<string, unknown>).screen_skipped).toBeUndefined();}, { setup }), 120_000);++ test('sync status: a non-company source synced by the pass has no cursor, so run_id, cursor, rate_pages_per_min and eta_seconds read null', () => managedBrain(async ({ engine }) => {+ expect((await performManagedSync(engine, SYNC)).status).toBe('first_sync');+ expect(Number((await engine.executeRaw<{ n: number | string }>("SELECT count(*) AS n FROM op_checkpoints WHERE op='managed-sync'"))[0]!.n)).toBe(0);+ for (const detail of [false, true]) {+ const status = await readSyncStatus(engine, 'default', { detail });+ expect(status).toMatchObject({ run_id: null, cursor: null, rate_pages_per_min: null, eta_seconds: null });+ expect(status.convergence).toMatchObject({ outcome: 'synced' });+ }+ }, { setup }), 120_000);});