fix(subagent): move per-role model fallback into opencodex config (#1190) - #1210
Closed
Yuxin-Qiao wants to merge 5 commits into
Closed
Yuxin-Qiao wants to merge 5 commits into
Yuxin-Qiao wants to merge 5 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
$CODEX_HOME/agents/*.tomland rejectsmodel_fallbackas an unknown field, which skips the entire custom-agent role definition (the role never enters themulti_agent_v1registry).subagentModelFallbackByModel(Record<primaryModelId, string[]>), consulted after the requested primary model and before the globalsubagentModelFallbacklist — the same slot the TOML field used to occupy.model_fallbackread is kept for backwards compatibility (config-keyed chains take precedence on duplicates), butocx doctornow scans$CODEX_HOME/agents/*.tomland warns for every role file still carrying the field, pointing at the new config home. The scan shares one TOML-aware, presence-aware parser with the reader: quoted keys are detected, text inside (multi)line strings is not, escaped delimiters stay inside strings, and malformed array values still trigger the doctor WARN while yielding no fallback entries.Closes #1190
Verification
origin/dev(0 commits behind).bun run typecheck— clean.bun test tests/subagent-model-fallback.test.ts— 50 pass / 0 fail. New coverage: config-keyed resolution, cross-key dedupe with account selectors, config-over-TOML precedence, doctor scan presence including empty arrays, quotedmodel_fallbackkeys, single-line and multiline strings containingmodel_fallbacktext, escaped triple quotes inside multiline strings, and malformed arrays (missing/leading commas, trailing tokens) that stay reported by the scan while producing no fallback entries.bun test tests/doctor.test.ts tests/doctor-provider-apikey.test.ts tests/codex-plugins-doctor.test.ts tests/doctor-oauth.test.ts tests/config.test.ts tests/config-user-edits.test.ts— 222 pass / 0 fail.bun run privacy:scan— passed.bun run test(9079 tests): 12 failures intests/management-provider-validation.test.ts,crash-guard, and a process-serialization test; re-ran the same files on a cleanorigin/devworktree and got the identical failures — pre-existing ondev, unrelated to this change.6b1ce0cdcompleted with no new findings).Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I fixed all correct Codex and CodeRabbit findings.
My PR is ready for review.