Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(sync): #6712 PR 3 L7 gate failures: screen conversion before replay, committed pending resumes, plain-sync retry expectations
garrytan3e4c8f4e7522
diff --git a/src/core/persistence/sync-run.ts b/src/core/persistence/sync-run.tsindex 8aa3893e4c..a79ce66ab5 100644--- a/src/core/persistence/sync-run.ts+++ b/src/core/persistence/sync-run.ts@@ -1330,13 +1330,12 @@ interface HoldRunState { sourceId?: string; incarnation?: string; remote?: boole/*** #6712 PR 3 (L7): a plain sync retries the failure an earlier invocation recorded for this run (`stopRecorded`), which* `--retry-failed` (now its deprecated alias) used to do on request. A stop the drain re-freezes in place (a transport fault,- * a resumable systemic stop, a legacy knock-on) is left to the drain, with its `STOPS_PER_ENTRY` bound reset once the bound- * is spent; a checkpoint refused only by a receipt that no longer blocks it revives in the drain. Otherwise a pending- * request that failed on a page fault (#6340: a page that moved, a dirty file) converts in place with the frozen manifest,- * and every other recorded failure (a content refusal whose file or gbrain version changed, a stop before admission)- * rediscovers from HEAD. Null when nothing applies: no failure of this run is recorded, its request is still unfinished,- * a content refusal would refuse the same bytes again, or the failure needs a person's decision (a slug-mode refusal, a- * checkpoint whose source checkpoint moved: `gbrain repair managed-sync-orphans`).+ * a resumable systemic stop, a legacy knock-on) is left to the drain, its `STOPS_PER_ENTRY` bound reset once spent; a+ * checkpoint refused only by a receipt that no longer blocks it revives in the drain. Under the hold screen a page's refusal+ * converts in place with the frozen manifest (#5988, #6340); a content refusal a newer commit may fix, and every other+ * recorded failure, rediscovers from HEAD. Null when nothing applies: no failure of this run is recorded, its request is+ * unfinished or committed (the drain advances past it, keeping the run's counts), a refusal would refuse the same bytes again,+ * or it needs a person's decision (a slug-mode refusal, a moved source checkpoint: `gbrain repair managed-sync-orphans`).*/async function retryRecordedFailure(engine: BrainEngine, cursor: Cursor, key: string, input: { opts: SyncOpts; context: ManagedSyncContext; authority: SyncAuthority;processingOptions: SyncProcessingOptions; syncOptions: SyncCursorOptions; startupConfig: BrainEngine; frozenRun: Parameters<typeof freezeEntry>[4]; runStartedAt: string;@@ -1348,7 +1347,7 @@ async function retryRecordedFailure(engine: BrainEngine, cursor: Cursor, key: stconst failed = cursor.pending ? await getWriteRequest(engine, admittedBy(cursor.pending, cursor), cursor.pending.requestId) : null;assertActive();const terminal = !!failed && ['failed', 'conflict', 'cancelled'].includes(failed.state);- if (failed && !terminal && failed.state !== 'committed') return null;+ if (failed && !terminal) return null;const fault = terminal ? receiptClass(failed!) : null;if (terminal && cursor.pending && cursor.pending.intent.kind !== 'managed_sync_checkpoint'&& (fault === 'transport' || isSyncKnockOn(failed!) || (fault === 'systemic' && resumableStop(failed!)))) {@@ -1365,17 +1364,17 @@ async function retryRecordedFailure(engine: BrainEngine, cursor: Cursor, key: st// `gbrain repair managed-sync-orphans` retires the cursor (and its slice record), and the next sync discovers again.if (terminal && (failed!.error_code === 'slug_root_mode_mismatch'|| cursor.pending?.intent.kind === 'managed_sync_checkpoint' && failed!.error_code === 'revision_conflict' && failed!.error_message === CHECKPOINT_MOVED_MESSAGE)) return null;- if (terminal && cursor.pending!.intent.kind !== 'managed_sync_checkpoint' && replaysUnchangedRefusal(failed!, recorded,- { root: cursor.root, intent: cursor.pending!.intent, target: cursor.target, head: () => syncGit(context.gitRoot, ['rev-parse', 'HEAD']).trim() })) return null;+ const page = terminal && cursor.pending!.intent.kind !== 'managed_sync_checkpoint';+ // The screen converts with the cursor's own options; a content, fence or stalled-preparation refusal it keeps replays.+ const head = () => syncGit(context.gitRoot, ['rev-parse', 'HEAD']).trim();+ const screen = page && !(isContentRefusal(failed!.error_code, failed!.error_message) && head() !== cursor.target) ? await loadSyncScreenRun(input.startupConfig, cursor.sourceId, cursor.processingOptions ?? processingOptions, authority.writer.remote) : null;+ const converted = screen ? await convertBlockedCursor(engine, cursor, key, assertActive, { ...input.frozenRun, screen, observedAt: cursor.discoveredAt ?? input.runStartedAt }) : cursor;+ assertActive();+ if (screen && (converted !== cursor || isContentRefusal(failed!.error_code, failed!.error_message) || fenceReceiptLocation(failed!) || preparationStalled(failed!))) return { cursor: converted };+ if (page && replaysUnchangedRefusal(failed!, recorded, { root: cursor.root, intent: cursor.pending!.intent, target: cursor.target, head })) return null;const blocker = await oldRunBlocker(engine, cursor, key);assertActive();if (blocker) return { wait: blocker };- // Only the #6340 page faults convert here (a content refusal rediscovers; #6513: a checkpoint is never a page fault).- const pageFault = !!failed && !!cursor.pending && cursor.pending.intent.kind !== 'managed_sync_checkpoint' && (pinnedWorktreeConflict(failed) || failed.error_code === 'revision_conflict');- const screen = pageFault ? await loadSyncScreenRun(input.startupConfig, cursor.sourceId, cursor.processingOptions ?? processingOptions, authority.writer.remote) : null;- const converted = screen ? await convertBlockedCursor(engine, cursor, key, assertActive, { ...input.frozenRun, screen, observedAt: cursor.discoveredAt ?? input.runStartedAt }) : cursor;- assertActive();- if (converted !== cursor) return { cursor: converted };const discoveryTarget = syncGit(context.gitRoot, ['rev-parse', 'HEAD']).trim();const discovery = await discoverManagedSync(engine, opts, context);assertActive();diff --git a/test/e2e/persistence-request-indexes-postgres.test.ts b/test/e2e/persistence-request-indexes-postgres.test.tsindex e355372658..43aba2bf8d 100644--- a/test/e2e/persistence-request-indexes-postgres.test.ts+++ b/test/e2e/persistence-request-indexes-postgres.test.ts@@ -169,7 +169,7 @@ test('#5762 recovery journey: a checkpoint timeout with a dropped index is fixedconst suggestion = result.managedWrite!.suggestion;expect(result.managedWrite).toMatchObject({ write_error: 'checkpoint_validation_timeout', detail: 'index_missing' });const commands = [...suggestion.matchAll(/gbrain [^—]+?(?= — |$)/g)].map(match => match[0].trim());- expect(commands).toEqual(['gbrain repair request-indexes --apply', `gbrain sync --source ${f.id} --no-pull --retry-failed --no-embed --no-extract`]);+ expect(commands).toEqual(['gbrain repair request-indexes --apply', `gbrain sync --source ${f.id} --no-pull --no-embed --no-extract`]);// Command 1: the printed rebuild.expect(await runRepair(ctx(), requestIndexesRepair, await resolveRepairScope(engine), { apply: true })).toMatchObject({ applied: 1 });// Command 2: the printed retry.diff --git a/test/fix-wave-4-journeys.test.ts b/test/fix-wave-4-journeys.test.tsindex 3480d574be..9dd0c4ab5b 100644--- a/test/fix-wave-4-journeys.test.ts+++ b/test/fix-wave-4-journeys.test.ts@@ -282,7 +282,7 @@ test('journey (c): a checkpoint timeout with a dropped index recovers with the r} finally { restore(); }expect(refused.text).toContain('checkpoint_validation_timeout');expect((await j.run(engine, printed(refused.text, 'gbrain repair request-indexes'))).exit).toBe(0);- const retried = await j.run(engine, printed(refused.text, `gbrain sync --source ${id} --no-pull --retry-failed`));+ const retried = await j.run(engine, printed(refused.text, `gbrain sync --source ${id} --no-pull`));expect(retried.exit).toBe(0);expect(await engine.executeRaw("SELECT id FROM persistence_requests WHERE source_id=$1 AND state<>'committed' AND state<>'failed'", [id])).toEqual([]);expect((await engine.getPage('a', { sourceId: id }))?.title).toBe('a');diff --git a/test/persistence-managed-sync.test.ts b/test/persistence-managed-sync.test.tsindex 0a46bd0c71..fef34a828b 100644--- a/test/persistence-managed-sync.test.ts+++ b/test/persistence-managed-sync.test.ts@@ -446,7 +446,7 @@ test.each([false, true])('managed terminal receipts survive a missing ledger andexpect(recorded[0].error).toContain(id);expect(recorded[0].error).toContain('source_changed');expect((await engine.executeRaw<{ last_commit: string }>('SELECT last_commit FROM sources WHERE id=$1', [f.id]))[0].last_commit).toBe(f.head);- writeFileSync(path, pinned);+ // #6712 PR 3 (L7): while the file keeps the bytes that refused, every sync replays the receipt; the fix below retries it.rmSync(syncFailuresPath(), { force: true });const replay = await performManagedSync(engine, opts);expect(replay.managedWrite?.write_request).toEqual(blocked.managedWrite!.write_request);@@ -458,6 +458,7 @@ test.each([false, true])('managed terminal receipts survive a missing ledger andwrite_request: { request_id: id, state: 'conflict' } } });});await expect(performManagedSync(engine, { ...opts, skipFailed: true })).rejects.toMatchObject({ code: 'managed_sync_flag_refused', detail: '--skip-failed' });+ writeFileSync(path, pinned);const corrected = await performManagedSync(engine, { ...opts, retryFailed: true });expect(corrected.status).toBe('synced');expect(loadSyncFailures().filter(row => row.source_id === f.id)).toHaveLength(0);diff --git a/test/persistence-sync-checkpoint-validation.test.ts b/test/persistence-sync-checkpoint-validation.test.tsindex 69e4fe530f..abe02cce5a 100644--- a/test/persistence-sync-checkpoint-validation.test.ts+++ b/test/persistence-sync-checkpoint-validation.test.ts@@ -128,7 +128,7 @@ test('#5762 a validation statement timeout fails the checkpoint terminally withconst diagnostic = result.managedWrite!;expect(diagnostic).toMatchObject({ write_error: 'checkpoint_validation_timeout', reason: 'checkpoint_validation_timeout', detail: 'indexes_valid',docs: 'docs/guides/write-refusals.md#checkpoint-validation-timeout', write_request: { state: 'failed' } });- expect(diagnostic.suggestion).toContain(`gbrain sync --source ${f.id} --no-pull --retry-failed --no-embed --no-extract`);+ expect(diagnostic.suggestion).toContain(`gbrain sync --source ${f.id} --no-pull --no-embed --no-extract`);expect(diagnostic.suggestion).toContain(diagnostic.write_request.request_id);const [checkpoint] = await engine.executeRaw<{ state: string; error_code: string; blocked_reason: string | null }>("SELECT state,error_code,blocked_reason FROM persistence_requests WHERE source_id=$1 AND intent->>'kind'='managed_sync_checkpoint'", [f.id]);@@ -166,7 +166,7 @@ test('#5762 a lock timeout in the validation stays transient contention', asynctest('#5762 the hint names one of three index states and keeps the saved processing flags', async () => {const syncOptions = { full: false, workingTree: true, srcSubpath: null, exclude: [], includeHidden: [], strategy: null };const input = { requestId: 'req-1', sourceId: 'notes', processingOptions: { noEmbed: true, noExtract: false, noSchemaPack: true }, syncOptions };- const retry = 'gbrain sync --source notes --no-pull --retry-failed --no-embed --no-schema-pack --working-tree';+ const retry = 'gbrain sync --source notes --no-pull --no-embed --no-schema-pack --working-tree';const building = formatCheckpointTimeoutHint([{ name: 'persistence_requests_sync_run_open', state: 'building',progress: { phase: 'building index: scanning table', blocks_done: 10, blocks_total: 40 } }], input);expect(building).toMatchObject({ detail: 'index_building' });@@ -184,15 +184,15 @@ test('#5762 the hint names one of three index states and keeps the saved process// Every option that selects the cursor is printed, so the retry resumes the same cursor.expect(checkpointRetryCommand({ sourceId: 'notes', processingOptions: null, syncOptions: { full: true, workingTree: false, srcSubpath: 'docs/team a',exclude: ['drafts/**', "it's"], includeHidden: ['.notes'], strategy: 'markdown' } })).toBe(- "gbrain sync --source notes --no-pull --retry-failed --full --src-subpath 'docs/team a' --exclude 'drafts/**' --exclude 'it'\\''s' --include-hidden .notes --strategy markdown");+ "gbrain sync --source notes --no-pull --full --src-subpath 'docs/team a' --exclude 'drafts/**' --exclude 'it'\\''s' --include-hidden .notes --strategy markdown");// A relative --src-subpath keeps the --repo base it resolved against.expect(checkpointRetryCommand({ sourceId: 'notes', processingOptions: { noEmbed: true, noExtract: true, noSchemaPack: false },syncOptions: { ...syncOptions, workingTree: false, srcSubpath: 'guides' }, repoPath: '/work/repo/docs' }))- .toBe('gbrain sync --source notes --no-pull --retry-failed --repo /work/repo/docs --no-embed --no-extract --src-subpath guides');+ .toBe('gbrain sync --source notes --no-pull --repo /work/repo/docs --no-embed --no-extract --src-subpath guides');// A compacted receipt, or a checkpoint admitted before its cursor options were recorded: no assumed defaults.expect(checkpointRetryCommand({ sourceId: 'notes', processingOptions: { noEmbed: true, noExtract: false, noSchemaPack: false } }))- .toBe('gbrain sync --source notes --no-pull --retry-failed with the same options as the failed run (this receipt no longer records them)');- expect(checkpointRetryCommand({ sourceId: 'notes' })).toBe('gbrain sync --source notes --no-pull --retry-failed with the same options as the failed run (this receipt no longer records them)');+ .toBe('gbrain sync --source notes --no-pull with the same options as the failed run (this receipt no longer records them)');+ expect(checkpointRetryCommand({ sourceId: 'notes' })).toBe('gbrain sync --source notes --no-pull with the same options as the failed run (this receipt no longer records them)');});test('#5762 a dropped index reads as missing and the hint then names the rebuild command', async () => each(async engine => {diff --git a/test/persistence-sync-fence-holds.test.ts b/test/persistence-sync-fence-holds.test.tsindex 111c8bbee7..a3c0c7b1dd 100644--- a/test/persistence-sync-fence-holds.test.ts+++ b/test/persistence-sync-fence-holds.test.ts@@ -241,19 +241,24 @@ test('a legacy stored-row receipt holds the same bytes from the receipt; a compaawait engine.unsetConfig('sync.holds');expect(await t.sync()).toMatchObject({ status: 'first_sync', held_count: 1, converted_from_failed: [compacted!.request_id] });- // ...but an arbitrary invalid_params receipt, compacted or not, is never a fence hold: the cursor stays blocked.- await engine.setConfig('sync.holds', 'fail');- const u = await source(engine, { 'notes/ok.md': note('Ok') });- u.write('notes/draft.md', MALFORMED);- expect((await u.sync({ workingTree: true })).status).toBe('blocked_by_failures');- const [arbitrary] = await u.failedRequests();- await engine.executeRaw("UPDATE persistence_requests SET error_message='The value is invalid.',error_detail=NULL WHERE request_id=$1::uuid", [arbitrary!.request_id]);- await engine.unsetConfig('sync.holds');- u.write('notes/draft.md', note('Now clean'));- expect((await u.sync({ workingTree: true })).status).toBe('blocked_by_failures');- await engine.executeRaw('UPDATE persistence_requests SET error_message=NULL,compacted=true WHERE request_id=$1::uuid', [arbitrary!.request_id]);- expect((await u.sync({ workingTree: true })).status).toBe('blocked_by_failures');- expect(await u.holds()).toEqual([]);+ // ...but an arbitrary invalid_params receipt, compacted or not, is never a fence hold: once the file is clean, the next+ // plain sync retries it (#6712 PR 3, L7: no --retry-failed) and nothing is held or converted.+ for (const compacted of [false, true]) {+ await engine.setConfig('sync.holds', 'fail');+ const u = await source(engine, { 'notes/ok.md': note('Ok') });+ u.write('notes/draft.md', MALFORMED);+ expect((await u.sync({ workingTree: true })).status).toBe('blocked_by_failures');+ const [arbitrary] = await u.failedRequests();+ await engine.executeRaw(compacted ? 'UPDATE persistence_requests SET error_message=NULL,error_detail=NULL,compacted=true WHERE request_id=$1::uuid'+ : "UPDATE persistence_requests SET error_message='The value is invalid.',error_detail=NULL WHERE request_id=$1::uuid", [arbitrary!.request_id]);+ await engine.unsetConfig('sync.holds');+ u.write('notes/draft.md', note('Now clean'));+ const retried = await u.sync({ workingTree: true });+ expect(retried.status).toBe('first_sync');+ expect(retried.held ?? []).toEqual([]);+ expect(retried.converted_from_failed ?? []).not.toContain(arbitrary!.request_id);+ expect(await u.holds()).toEqual([]);+ }}), 240_000);test('dry run lists the fence hold a real run would write and writes nothing', () => each(async engine => {diff --git a/test/persistence-sync-options.serial.test.ts b/test/persistence-sync-options.serial.test.tsindex dd004ec096..7d1655f028 100644--- a/test/persistence-sync-options.serial.test.ts+++ b/test/persistence-sync-options.serial.test.ts@@ -156,7 +156,7 @@ check('interrupted options survive resume and changed-option retries cannot rewrexpect(await engine.executeRaw('SELECT id,intent FROM persistence_requests WHERE id=ANY($1::uuid[]) ORDER BY id', [original.map(row => row.id)])).toEqual(original);});-check('unknown legacy import consent fails under its original request and explicit retry rediscovery is required', async engine => {+check('unknown legacy import consent fails under its original request and the next plain sync rediscovers', async engine => {const f = await fixture(engine);expect(await interruptAfterSyncDiscovery(engine, f.opts)).toMatchObject({ status: 'partial' });const c = await cursor(engine, f.id), requestId = randomUUID();@@ -176,10 +176,10 @@ check('unknown legacy import consent fails under its original request and explicconst failed = (await getWriteRequest(engine, admission.principal, requestId))!;expect(failed.intent).toEqual(intent);expect((await admitWrite(engine, admission)).id).toBe(failed.id);- expect((await performManagedSync(engine, f.opts)).managedWrite?.write_request).toEqual(blocked.managedWrite?.write_request);expect(await engine.getPage(admission.slug, { sourceId: f.id })).toBeNull();expect(await engine.executeRaw('SELECT id FROM persistence_effects WHERE source_id=$1', [f.id])).toEqual([]);- expect(await performManagedSync(engine, { ...f.opts, retryFailed: true })).toMatchObject({ status: 'first_sync', added: 1 });+ // #6712 PR 3 (L7): the next plain sync rediscovers from HEAD (no --retry-failed); the refused request keeps its intent.+ expect(await performManagedSync(engine, f.opts)).toMatchObject({ status: 'first_sync', added: 1 });expect((await getWriteRequest(engine, admission.principal, requestId))?.intent).toEqual(intent);expect((await cursor(engine, f.id)).value.runId).not.toBe(c.value.runId);});diff --git a/test/persistence-sync-origin-native.test.ts b/test/persistence-sync-origin-native.test.tsindex cd765ed192..2bcd2b596b 100644--- a/test/persistence-sync-origin-native.test.ts+++ b/test/persistence-sync-origin-native.test.ts@@ -397,7 +397,7 @@ check('old manifest reuse refuses a present-file deletion before admitting any rexpect((await engine.getPage(f.slug, { sourceId: f.id }))?.id).toBe(f.snapshot.page.id);});-check('already-admitted legacy deletion fails under its original ID and only explicit rediscovery advances', async engine => {+check('already-admitted legacy deletion fails under its original ID and the next sync rediscovers', async engine => {const f = await fixture(engine, process.platform === 'win32' ? 'notes\\example.md' : 'notes/example.md');const legacy = await legacyDeletion(engine, f, true);const first = await performManagedSync(engine, f.opts);@@ -406,13 +406,11 @@ check('already-admitted legacy deletion fails under its original ID and only expexpect(row.state).not.toBe('committed');expect(row.error_code).toBe('page_identity_changed');expect(row.intent).toEqual(legacy.intent);- expect((await performManagedSync(engine, f.opts)).managedWrite?.write_request).toEqual(first.managedWrite?.write_request);- expect((await engine.getPage(f.slug, { sourceId: f.id }))?.id).toBe(f.snapshot.page.id);- expect(readFileSync(join(f.root, 'notes/example.md'), 'utf8')).toBe(content);- expect((await engine.executeRaw<{ last_commit: string | null }>('SELECT last_commit FROM sources WHERE id=$1', [f.id]))[0].last_commit).toBeNull();- expect((await performManagedSync(engine, { ...f.opts, retryFailed: true })).status).toBe('first_sync');+ // #6712 PR 3 (L7): the next plain sync retries the recorded failure by rediscovering, as `--retry-failed` (now its alias) did.+ expect((await performManagedSync(engine, f.opts)).status).toBe('first_sync');expect((await getWriteRequest(engine, legacy.cursor.authority.writer.principal, legacy.requestId))?.state).toBe(row.state);expect((await engine.getPage(f.slug, { sourceId: f.id }))?.id).toBe(f.snapshot.page.id);+ expect(readFileSync(join(f.root, 'notes/example.md'), 'utf8')).toBe(content);});check('explicit working-tree deletion remains valid even when the pinned Git target contains the file', async engine => {diff --git a/test/persistence-sync-stdio-owner.test.ts b/test/persistence-sync-stdio-owner.test.tsindex 14e9f8bf55..517369254c 100644--- a/test/persistence-sync-stdio-owner.test.ts+++ b/test/persistence-sync-stdio-owner.test.ts@@ -128,11 +128,12 @@ test('resident-owner failure JSON retains safe scoped diagnostics and the frozenexpect(blocked.err).toContain('source_changed');expect(blocked.out+blocked.err).not.toContain('PRIVATE_RESIDENT_DIAGNOSTIC_CONTENT_CANARY');expect(blocked.out+blocked.err).not.toContain(root);- writeFileSync(path,pinned);+ // #6712 PR 3 (L7): while the file keeps the bytes that refused, every sync replays the receipt; the fix below retries it.rmSync(join(home,'sync-failures.jsonl'),{force:true});const replay=await cli(args);expect(replay.code).toBe(1);expect(JSON.parse(replay.out).managed_write.write_request).toEqual(body.managed_write.write_request);+ writeFileSync(path,pinned);const corrected=await cli([...args,'--retry-failed']);expect(corrected.code).toBe(0);expect(JSON.parse(corrected.out).sync_status).toBe('synced');diff --git a/test/repair-managed-sync-orphans.test.ts b/test/repair-managed-sync-orphans.test.tsindex 1b38865e4b..0b59fbad71 100644--- a/test/repair-managed-sync-orphans.test.ts+++ b/test/repair-managed-sync-orphans.test.ts@@ -89,7 +89,8 @@ test('orphans are classified by what nothing current can do, doctor names the reexpect(check.message).toContain('cannot be resumed or cleared by any sync');expect(check.message).toContain(`gbrain repair managed-sync-orphans --source ${SOURCE}`);expect(check.message).toContain('ck-legacy'.slice(0, 12) + ' principal_unadoptable');- expect(check.message).toContain('--retry-failed');+ expect(check.message).toContain(`Fix the cause, then run gbrain sync --source ${SOURCE} --no-pull`);+ expect(check.message).not.toContain('--retry-failed');expect((check.details as { orphans: unknown[] }).orphans).toHaveLength(3);const remote = (await checkSyncFailures(engine, { remote: true, sourceIds: [SOURCE] }))!;expect(remote.message).not.toContain('ck-legacy');diff --git a/test/sync-drain.test.ts b/test/sync-drain.test.tsindex 3db8b62f57..f67fc17335 100644--- a/test/sync-drain.test.ts+++ b/test/sync-drain.test.ts@@ -55,7 +55,7 @@ describe('runDrain', () => {test('blocked results end the drain as blocked with a retry command', async () => {const failed = await runDrain({ pass: async () => ({ ...base, status: 'blocked_by_failures', failedFiles: 1 }) });expect(failed.drain).toMatchObject({ outcome: 'blocked', stop_reason: 'blocked_by_failures' });- expect(drainNext(failed, RESUME, 's')).toMatchObject({ command: `${RESUME} --retry-failed`, safe_to_loop: false });+ expect(drainNext(failed, RESUME, 's')).toMatchObject({ command: RESUME, safe_to_loop: false });const terminal = pending(3);terminal.managedWrite!.write_error = 'revision_conflict';terminal.status = 'blocked_by_failures';diff --git a/test/sync-status-unblock.test.ts b/test/sync-status-unblock.test.tsindex 060cdb66d4..6e47335ea1 100644--- a/test/sync-status-unblock.test.ts+++ b/test/sync-status-unblock.test.ts@@ -146,7 +146,7 @@ test('status joins the cursor, the recent commits, each hold with its triple andexpect(noHuman.map(hold => hold.path)).toEqual(['c.md']);}), 120_000);-test('status reports an older release\'s recorded failure as a retryable page fault with --retry-failed as next', async () => withEnv({ GBRAIN_HOME: home, GBRAIN_SYNC_FAILURES_DIR: home }, async () => {+test('status reports an older release\'s recorded failure as a retryable page fault with the plain sync as next', async () => withEnv({ GBRAIN_HOME: home, GBRAIN_SYNC_FAILURES_DIR: home }, async () => {const f = await fixture({ 'a.md': note('Alpha one.'), 'b.md': note('Beta one.') });expect((await performManagedSync(engine, f.opts)).status).toBe('first_sync');writeFileSync(join(f.root, 'a.md'), note('Alpha two.')); writeFileSync(join(f.root, 'b.md'), note('Beta two.'));@@ -159,7 +159,7 @@ test('status reports an older release\'s recorded failure as a retryable page faexpect(status.cursor).toMatchObject({ index: 1, total: 2, done: false });expect(status.last_error).toMatchObject({ code: 'source_changed', class: 'page', safe_actions: ['retry'], needs_human: false, path: 'b.md', phase: 'receipt' });expect(status.needs_human).toBe(false);- expect(status.next).toMatchObject({ argv: ['gbrain', 'sync', '--source', f.id, '--no-pull', '--no-embed', '--no-extract', '--retry-failed'] });+ expect(status.next).toMatchObject({ argv: ['gbrain', 'sync', '--source', f.id, '--no-pull', '--no-embed', '--no-extract'] });const converted = await performManagedSync(engine, { ...f.opts, retryFailed: true });expect(converted).toMatchObject({ status: 'synced', held: [{ path: 'b.md', code: 'worktree_dirty' }] });expect((await readSyncStatus(engine, f.id)).last_error).toBeNull();