diff --git a/src/main/codex/codex-pane-account-registry-mutations.test.ts b/src/main/codex/codex-pane-account-registry-mutations.test.ts index 80630d06912..e7a09ad7a82 100644 --- a/src/main/codex/codex-pane-account-registry-mutations.test.ts +++ b/src/main/codex/codex-pane-account-registry-mutations.test.ts @@ -80,4 +80,16 @@ describe('CodexPaneAccountRegistryMutations', () => { expect(write).toHaveBeenCalledTimes(2) expect(vi.getTimerCount()).toBe(0) }) + + it('retries a failed reconciliation write without a pending pane mutation', async () => { + const registry = parseRegistry(JSON.stringify({ version: 2, panes: { existing: EXISTING } })) + const write = vi.fn().mockReturnValueOnce(false).mockReturnValueOnce(true) + const mutations = new CodexPaneAccountRegistryMutations({ read: () => registry, write }) + + mutations.persistReconciliation(registry, true) + await vi.advanceTimersByTimeAsync(100) + + expect(write).toHaveBeenCalledTimes(2) + expect(vi.getTimerCount()).toBe(0) + }) }) diff --git a/src/main/codex/codex-pane-account-registry-mutations.ts b/src/main/codex/codex-pane-account-registry-mutations.ts index 620d4620424..f946453c0bf 100644 --- a/src/main/codex/codex-pane-account-registry-mutations.ts +++ b/src/main/codex/codex-pane-account-registry-mutations.ts @@ -34,7 +34,7 @@ export class CodexPaneAccountRegistryMutations { } flush(): void { - if (this.pending.size === 0) { + if (this.pending.size === 0 && !this.needsPersistence) { this.clearRetryState() return }