diff --git a/src/main/codex/config-sync-stall.test.ts b/src/main/codex/config-sync-stall.test.ts index 6cdd25613b2..0840a38917e 100644 --- a/src/main/codex/config-sync-stall.test.ts +++ b/src/main/codex/config-sync-stall.test.ts @@ -4,6 +4,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { getCodexConfigSyncStatus, + reportCodexConfigSyncOutcome, resetCodexConfigSyncStallLatchForTests } from './config-sync-stall' import { syncSystemConfigIntoManagedCodexHome } from './codex-config-mirror' @@ -163,6 +164,19 @@ describe('reportCodexConfigSyncOutcome', () => { expect(String(stallLogs[0]?.[0])).toContain('unreadable-source') }) + it('names the managed config when that is the unreadable file', () => { + const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}) + writeFileSync(systemConfigPath(), 'model = "gpt-5"\n', 'utf-8') + mkdirSync(runtimeConfigPath()) + + reportCodexConfigSyncOutcome(homes.runtimeHomePath, getCodexConfigSyncStatus(homes)) + + const message = String(warn.mock.calls[0]?.[0]) + expect(message).toContain(runtimeConfigPath()) + expect(message).not.toContain(systemConfigPath()) + expect(message).toContain('The managed config must be readable before settings can sync.') + }) + it('clears a stall without claiming the source became readable', () => { // Why: a removed runtime config also reads as synced, so "readable again" // would be a false claim about a source that is still gone. diff --git a/src/main/codex/config-sync-stall.ts b/src/main/codex/config-sync-stall.ts index 86fce3eca80..1dad7cfb080 100644 --- a/src/main/codex/config-sync-stall.ts +++ b/src/main/codex/config-sync-stall.ts @@ -94,6 +94,12 @@ export function reportCodexConfigSyncOutcome( return } stalledHomes.set(runtimeHomePath, status.reason) + if (status.reason === 'managed-home-unavailable') { + console.warn( + `[codex-config] Config sync stalled (${status.reason}): ${join(runtimeHomePath, 'config.toml')} is unusable, so ${runtimeHomePath} keeps its last synced settings. The managed config must be readable before settings can sync.` + ) + return + } console.warn( `[codex-config] Config sync stalled (${status.reason}): ${status.systemConfigPath} is unusable, so ${runtimeHomePath} keeps its last synced settings. Edits to the source will not apply until it is readable.` )