@@ -1060,6 +1060,9 @@ const configSchema = z.object({
10601060 // pool accounts. Warning emitted in loadConfig.
10611061 codexAccountPriorities : codexAccountPrioritiesSchema . optional ( ) . catch ( undefined ) ,
10621062 activeCodexAccountPinned : z . string ( ) . regex ( CODEX_ACCOUNT_PIN_PATTERN ) . optional ( ) . catch ( undefined ) ,
1063+ // A malformed hand edit must degrade to false without discarding providers, accounts,
1064+ // or the exact selector map. Live writes remain strict.
1065+ codexAccountPickerEnabled : z . boolean ( ) . optional ( ) . catch ( false ) ,
10631066 // Model ids excluded from the Grok Build managed block (dashboard switches).
10641067 grokExcludedModels : z . array ( z . string ( ) ) . optional ( ) ,
10651068 // Invalid values degrade to undefined ("auto") instead of failing the whole
@@ -1712,6 +1715,18 @@ function malformedNativeSubagentFieldWarning(field: NativeSubagentPersistedField
17121715 return `${ field } ignored: expected ${ expected } ` ;
17131716}
17141717
1718+ function malformedCodexAccountPickerWarning ( rawParsed : unknown ) : string | null {
1719+ const raw = rawConfigRecord ( rawParsed ) ;
1720+ if ( ! raw || ! Object . hasOwn ( raw , "codexAccountPickerEnabled" ) ) return null ;
1721+ if ( typeof raw . codexAccountPickerEnabled === "boolean" ) return null ;
1722+ return "codexAccountPickerEnabled ignored: expected a boolean" ;
1723+ }
1724+
1725+ function warnDegradedCodexAccountPicker ( rawParsed : unknown ) : void {
1726+ const warning = malformedCodexAccountPickerWarning ( rawParsed ) ;
1727+ if ( warning ) console . warn ( `⚠️ config.json ${ warning } . Other settings were preserved.` ) ;
1728+ }
1729+
17151730function nativeSubagentSyncDisabledReason ( config : OcxConfig , rawParsed ?: unknown ) : string | null {
17161731 if ( config . syncCodexSubagentDefaults !== true ) return null ;
17171732 const malformed = malformedNativeSubagentFields ( rawParsed ) ;
@@ -1763,6 +1778,7 @@ export function loadConfig(): OcxConfig {
17631778 warnDegradedCodexAccountPriorities ( parsed , config ) ;
17641779 warnDegradedClaudeSubagentEffort ( parsed ) ;
17651780 warnDegradedNativeSubagentConfig ( parsed , config ) ;
1781+ warnDegradedCodexAccountPicker ( parsed ) ;
17661782 return normalizeClaudeSubagentEffort ( normalizeNativeSubagentSync ( config , parsed ) , parsed ) ;
17671783 }
17681784 // Schema validation failed — merge defaults into the raw object instead of
@@ -1783,6 +1799,7 @@ export function loadConfig(): OcxConfig {
17831799 warnDegradedCodexAccountPriorities ( parsed , config ) ;
17841800 warnDegradedClaudeSubagentEffort ( parsed ) ;
17851801 warnDegradedNativeSubagentConfig ( parsed , config ) ;
1802+ warnDegradedCodexAccountPicker ( parsed ) ;
17861803 return normalizeClaudeSubagentEffort ( normalizeNativeSubagentSync ( config , parsed ) , parsed ) ;
17871804 }
17881805 // Merge couldn't fix it — truly broken config
@@ -1832,6 +1849,8 @@ function validFileConfigDiagnostics(config: OcxConfig, rawParsed: unknown): Conf
18321849 warnings . push ( `claudeCode.subagentEffort ignored: expected one of ${ CLAUDE_SUBAGENT_EFFORTS . join ( ", " ) } ` ) ;
18331850 }
18341851 warnings . push ( ...malformedNativeSubagentFields ( rawParsed ) . map ( malformedNativeSubagentFieldWarning ) ) ;
1852+ const pickerWarning = malformedCodexAccountPickerWarning ( rawParsed ) ;
1853+ if ( pickerWarning ) warnings . push ( pickerWarning ) ;
18351854 if ( syncDisabledReason ) {
18361855 warnings . push ( `syncCodexSubagentDefaults ignored: ${ syncDisabledReason } ` ) ;
18371856 }
@@ -1935,13 +1954,31 @@ function googleAntigravityStaticCatalogVersionError(value: unknown): string | nu
19351954 return "schema_invalid: googleAntigravityStaticCatalogVersion: must be 1 or omitted" ;
19361955}
19371956
1957+ function codexAccountPickerEnabledError ( value : unknown ) : string | null {
1958+ const raw = rawConfigRecord ( value ) ;
1959+ if ( ! raw ) return null ;
1960+ const descriptor = Object . getOwnPropertyDescriptor ( raw , "codexAccountPickerEnabled" ) ;
1961+ if ( ! descriptor ) {
1962+ return "codexAccountPickerEnabled" in raw
1963+ ? "schema_invalid: codexAccountPickerEnabled: must be an own boolean data property or omitted"
1964+ : null ;
1965+ }
1966+ if ( ! ( "value" in descriptor ) ) {
1967+ return "schema_invalid: codexAccountPickerEnabled: must be an own boolean data property or omitted" ;
1968+ }
1969+ const enabled = descriptor . value ;
1970+ if ( enabled === undefined || typeof enabled === "boolean" ) return null ;
1971+ return "schema_invalid: codexAccountPickerEnabled: must be a boolean or omitted" ;
1972+ }
1973+
19381974/** Validate an in-memory config candidate without touching disk. Used by headless CLI import/set. */
19391975export function validateConfigCandidate ( value : unknown ) : { ok : true ; config : OcxConfig } | { ok : false ; error : string } {
19401976 const boundaryError = blankHostnameError ( value )
19411977 ?? claudeSubagentEffortError ( value )
19421978 ?? appOwnedMemoryBudgetError ( value )
19431979 ?? googleAntigravityStaticCatalogVersionError ( value )
1944- ?? codexAccountPrioritiesError ( value ) ;
1980+ ?? codexAccountPrioritiesError ( value )
1981+ ?? codexAccountPickerEnabledError ( value ) ;
19451982 if ( boundaryError ) return { ok : false , error : boundaryError } ;
19461983 const result = configSchema . safeParse ( value ) ;
19471984 if ( result . success ) return { ok : true , config : normalizeApiKeyIds ( result . data as OcxConfig ) } ;
0 commit comments