fix(codex): name the stalled managed config

This commit is contained in:
Brennan Benson
2026-08-23 11:41:36 -07:00
parent b716cac11e
commit a93272cd7c
2 changed files with 20 additions and 0 deletions
+14
View File
@@ -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.
+6
View File
@@ -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.`
)