Repository navigation
fix(codex): drop Claude model ids from compiled Codex agents - #3481
JohnnyXu (xubenqiang) wants to merge 5 commits 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
|
Thanks JohnnyXu (@xubenqiang) for the fix and for flagging the Claude-alias problem. Daniel approved a narrower scope on #3477 (see the What would fit the approved scope: keep the generated TOML byte-identical and emit a lossy-compilation warning naming the agent when the model is a Claude alias ( Generated by autopilot-issue-triage-worker. This comment is AI-generated and may contain errors. |
Co-authored-by: Copilot App <[email protected]>
The approved scope on microsoft#3477 (apm-scope:v1, comment 6772353800) and OpenAPM req-tg-015 require the Codex agent compile to preserve a source-declared model string exactly as written. Reshape the change from dropping a Claude alias (opus, sonnet, haiku, inherit) or claude-* id to keeping it and emitting a names-only lossy-compilation warning that names the agent and the field, never the model value or other frontmatter values. Drop the 'codex:' block suggestion, which belongs to the separate microsoft#3324 question and is not read by the parser. Tests cover every alias plus claude-* ids (TOML byte-identical to the pre-change rendering, one warning), non-Claude strings (no warning), and the names-only guarantee. Docs, apm-guide and CHANGELOG updated. Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]>
The no-validation sentence read as contradicting the new Claude-model warning. State that the warning is the one name-only model check, that the value is still kept as written, and add the remediation clause to the apm-guide resource. Addresses panel doc-writer follow-up on microsoft#3481. Co-authored-by: Copilot App <[email protected]>
The Claude-model warning added for microsoft#3477 sits in the req-tg-015 Codex conversion path. Add a req-tg-015 conformance test proving opus, sonnet, haiku, inherit and a claude-* id are still written verbatim and never echoed in a diagnostic, so the reshape cannot regress to dropping the value. Regenerate CONFORMANCE.{json,md} from the full suite. Cites the spec for the Mode B silent-extension gate. Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Doc Writer | 0 | 0 | 0 | The fold resolves the prior finding in the docs page and apm-guide; no new doc issues. |
| Test Coverage Expert | 0 | 0 | 0 | 5 parametrized req-tg-015 cases defend the preservation MUST without over-claiming the non-normative warning. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
All lean-pass follow-ups are folded and verified. CI: 23 pass, 3 skipping, 0 fail; lint clean; canonical-owner gate passed. The contributor CLA is not signed yet (license/cla pending): JohnnyXu (@xubenqiang), please reply with @microsoft-github-policy-service agree as described above. Once signed, this needs no further code changes.
Folded in this run
- (panel) Approved-scope reshape: keep the Codex
modelverbatim and warn, names-only; drop removed; tests, docs, apm-guide and CHANGELOG updated -- resolved in e850547. - (panel) doc-writer: qualify the no-validation docs claim as the one name-only check and add the remediation clause to apm-guide -- resolved in 9a2f630.
- (panel) CI Mode B gate: req-tg-015 conformance test pinning verbatim preservation of Claude model ids; CONFORMANCE.{json,md} regenerated -- resolved in 07c5d5e.
Copilot signals reviewed
- Review 5785478526 -- NOT-LEGIT: only reports insufficient quota; zero inline comments across 2 fetch rounds.
Regression-trap evidence (mutation-break gate)
test_codex_agent_keeps_claude_model_verbatim_and_warns-- deleted the_warn_codex_claude_modelcall; 8 tests FAILED as expected; guard restored.test_codex_agent_keeps_claude_model_verbatim_and_warns-- re-added the model drop; 8 tests FAILED as expected; guard restored.
Lint contract
ruff check and ruff format --check (src/, tests/, architecture linter scripts) silent; pylint R0801 clean; auth-signal and architecture-boundary lints clean.
CI
23 pass, 3 skipping, 0 fail on 07c5d5e; license/cla pending (after 1 CI fix iteration: Spec conformance Mode B).
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3481 | 07c5d5e |
ship_now | 1 | 3 | 0 | 2 | yellow | MERGEABLE | BLOCKED | CLA unsigned (license/cla pending) |
Convergence
1 outer iteration; 2 Copilot rounds. Final panel stance: ship_now. Ready for maintainer review once the CLA is signed.
Full per-persona findings
Doc Writer
No findings (delta). Lean pass: one recommended finding (no-validation claim read as contradictory next to the new warning), folded in 9a2f630.
Test Coverage Expert
No findings.
CLI Logging Expert (lean pass only)
No findings: wording follows sibling Codex diagnostics, correct category, ASCII-safe, names-only, actionable.
This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.
Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.
Adds the Fixed entry for #3650, crediting @xubenqiang for the original #3481 change. Refs #3477 Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]>
|
Thank you JohnnyXu (@xubenqiang) for this fix and for flagging the Claude-alias problem in #3477. To ship it in 0.36.0 we rebuilt the same reviewed change (warning-only, model kept verbatim per the approved scope on #3477) on fresh Closing this PR in favor of #3650. If anything there diverges from your intent, please comment on #3650 -- we would welcome your review. Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors. |
…edes #3481, closes #3477) (#3650) * fix(codex): warn on Claude model ids in compiled Codex agents A shared Claude/Codex agent source with `model: sonnet` (or another Claude alias or claude-* id) compiles into a Codex TOML whose model Codex does not recognize, with no signal to the author. Per the approved #3477 scope and OpenAPM req-tg-015, keep the declared model string exactly as written and emit a names-only lossy-compilation warning naming the agent and the field, never the model value or any other frontmatter value. Tests cover each alias plus claude-* ids (TOML byte-identical, one warning), non-Claude strings (no warning), the names-only guarantee, and req-tg-015 verbatim preservation in the conformance suite. CONFORMANCE.{json,md}, docs and apm-guide updated. Rebuilt from #3481 by @xubenqiang to ship in 0.36.0. Refs #3477 Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]> * docs(changelog): note Codex Claude-model warning Adds the Fixed entry for #3650, crediting @xubenqiang for the original #3481 change. Refs #3477 Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]> * docs(codex): drop stale "#3477 tracked" model-warning lines Both per-harness model sections still described the Claude-model warning as future work tracked in #3477, contradicting the shipped warning described a few paragraphs above. Point back to it instead. Addresses panel doc-writer follow-up on #3650. Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]> * test(codex): prove Claude-model warning reaches apm install output The unit tests call _write_codex_agent directly; add a real-binary e2e variant so the new _is_claude_model branch is proven reachable from apm install: model kept verbatim in the TOML, names-only warning in CLI output, value never echoed. The native-model sibling now also asserts no Claude-model warning for a Codex model. Addresses panel test-coverage-expert follow-up on #3650. Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: danielmeppiel <[email protected]> Co-authored-by: xubenqiang <[email protected]> Co-authored-by: Copilot App <[email protected]>
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.