From f9d99caaed1f7632f77563effe897b7423516f12 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 23 Aug 2026 12:22:16 -0700 Subject: [PATCH] fix(codex): retry reconciliation registry writes --- .../codex-pane-account-registry-mutations.test.ts | 12 ++++++++++++ .../codex/codex-pane-account-registry-mutations.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) 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 }