Repository navigation
fix(codex): drop Claude model ids from compiled Codex agents - #3481
JohnnyXu (xubenqiang) wants to merge 1 commit into
Conversation
`_write_codex_agent()` copied the `model` frontmatter value verbatim into the Codex TOML, so a shared agent source with `model: sonnet` produced an invalid `.codex/agents/<name>.toml` while Claude kept its pin. Drop a Claude alias (`opus`, `sonnet`, `haiku`, `inherit`) or `claude-*` id when compiling for Codex and report it through the existing lossy-compilation diagnostic, pointing at the `codex:` override. Fixes microsoft#3477
|
JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
2 similar comments
|
JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
JohnnyXu (@xubenqiang) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Fixes #3477
Problem
apm installwith targetsclaude,codexcompiles one source agent for both harnesses, and_write_codex_agent()copied themodelfrontmatter value into the Codex TOML verbatim:Claude aliases (
opus,sonnet,haiku,inherit) andclaude-*ids are not valid Codex models, so the generated.codex/agents/<name>.tomlis unusable while the Claude side needs the pin.Fix
When compiling for Codex, a
modelthat names a Claude alias orclaude-*id is dropped, and the drop is reported through the existing lossy-compilation diagnostic (the same channel used for a non-stringmodeland foruser-invocable):The diagnostic tells the user to add a
codex:block with a Codex model or to dropmodelfrom the shared source, then rerunapm install. A Codex model id (gpt-5-codex) is preserved unchanged, andmodel_reasoning_effortis untouched.Verification
Two tests are added to
tests/unit/integration/test_agent_integrator.py:test_codex_agent_drops_claude_model_alias:model: sonnetproduces a TOML without amodelkey and exactly one lossy warning mentioning the Claude model.test_codex_agent_keeps_codex_model:model: gpt-5-codexstays in the TOML and produces no warning.Before the fix (production file reverted, tests kept):
After:
ruff checkandruff format --checkpass on both changed files.Notes
codex:override block in agent frontmatter is a separate, larger feature and is not included.codex:block is mentioned in the diagnostic as the intended workaround, but the parser does not read it yet, so the working mitigation today is to dropmodelfrom the shared source or ship separate agents.