Repository navigation
fix(codex): warn on Claude model ids in compiled Codex agents (supersedes #3481, closes #3477) - #3650
Conversation
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]>
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]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Claude-model warning change.
No open issues 🎉
What changed in this PR
This PR addresses #3477 by warning when APM compiles Claude model names into Codex agents, while preserving the declared model value as required by OpenAPM req-tg-015.
Changes:
- Adds case-insensitive detection of Claude aliases and
claude-*IDs, with actionable warnings that do not expose frontmatter values. - Adds regression and conformance coverage for unchanged TOML output, warning behavior, and diagnostic privacy.
- Updates authoring guidance, conformance records, and the changelog; per-target model overrides remain out of scope.
| File | Description |
|---|---|
tests/unit/integration/test_agent_integrator.py |
Tests model preservation, warning selection, and names-only diagnostics. |
tests/spec_conformance/test_manifest_reqs.py |
Adds five Claude-model preservation cases for req-tg-015. |
src/apm_cli/integration/agent_integrator.py |
Detects Claude model names and emits warnings without changing output values. |
packages/apm-guide/.apm/skills/apm-usage/package-authoring.md |
Documents the warning and supported remedies. |
docs/src/content/docs/producer/author-primitives/instructions-and-agents.md |
Clarifies the name-based check and unchanged model preservation. |
CONFORMANCE.md |
Updates req-tg-015 coverage from one to six tests. |
CONFORMANCE.json |
Records the five additional conformance cases. |
CHANGELOG.md |
Records the fix and credits the original contribution. |
Review effort: Balanced
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Test Coverage Expert | 0 | 1 | 0 | Unit and conformance tests are thorough (21 cases, mutation-break verified); one e2e variant would close the tier-floor gap. |
| Doc Writer | 0 | 1 | 0 | New warning text is accurate, but both pages still say the warning is only tracked in #3477, which this PR closes. |
| Cli Logging Expert | 0 | 0 | 0 | New Claude-model warning follows the established lossy-compilation pattern, channel, rendering, and Message Writing Rules. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 2 follow-ups
- [Doc Writer] Remove stale "Codex agent compile copies Claude model aliases verbatim (
model: opus->model = "opus") #3477 tracked as future work" lines from both doc pages that now contradict the shipped feature. -- Factual contradiction; two-line in-scope fix, being folded. - [Test Coverage Expert] Add an e2e variant in
test_codex_agent_tool_scope_contract.pywith a Claude-model alias to prove the warning reaches CLI output through the real binary. -- The new branch has no end-to-end assertion; in-scope, being folded.
Recommendation
Panel signals are clean and unanimous. The two recommended follow-ups are inside the approved #3477 scope and are being folded into this PR before the terminal delta pass. No strategic, naming, or breaking-change concerns. Ship for 0.36.0.
Copilot signals reviewed
- Review 5880410434 -- no inline comments; overview recommends approval. Nothing to fold.
Full per-persona findings
Test Coverage Expert
- [recommended] No e2e test verifies the Claude-model warning reaches CLI output through
apm install; the existing e2e test uses a non-Claude model only. attests/integration/test_codex_agent_tool_scope_contract.py:129
test_codex_agent_native_models_and_dropped_metadata_reach_cli_outputusesmodel='gpt-5.6-sol', which never triggers_is_claude_model. Unit tests call_write_codex_agentdirectly.
Suggested: sibling test withmetadata={'model': 'sonnet'}asserting the warning in output and the TOML model unchanged.
Proof (missing at):tests/integration/test_codex_agent_tool_scope_contract.py::test_codex_agent_claude_model_warning_reaches_cli_output-- proves: the warning reaches CLI output and the model value is preserved [multi-harness-support,devx]
Doc Writer
- [recommended] Both "Per-harness model values" sections still describe the Claude-model warning as future work tracked in Codex agent compile copies Claude model aliases verbatim (
model: opus->model = "opus") #3477. atdocs/src/content/docs/producer/author-primitives/instructions-and-agents.md:245
Shipped feature described as future work; same stale line inpackages/apm-guide/.apm/skills/apm-usage/package-authoring.md.
Suggested: present tense pointing back to the Codex paragraph; keep the [FEATURE] Allow differentmodelvalues per target in one.agent.md(Claude vs Codex) #3324 reference.
Cli Logging Expert
No findings.
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-review-worker. This comment is AI-generated and may contain errors.
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]>
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: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Doc Writer | 0 | 0 | 0 | Prior finding resolved: the stale "tracked in #3477" lines are gone from both sections; the fold adds no new doc issue. |
| Test Coverage Expert | 0 | 0 | 0 | Prior finding resolved: e2e test proves the warning reaches CLI with meaningful, mutation-resistant assertions; names-only contract defended. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Recommendation
Both follow-ups from the lean pass are verified resolved with no regressions and no new findings. Ready for maintainer merge at discretion.
Folded in this run
- (panel) doc-writer: replace stale "tracked in Codex agent compile copies Claude model aliases verbatim (
model: opus->model = "opus") #3477" lines in the docs page and apm-guide -- resolved in b58d66a. - (panel) test-coverage-expert: real-binary e2e test for the Claude-model warning -- resolved in 254f7ca.
Copilot signals reviewed
- Review 5880410434 -- no inline comments; overview recommends approval. Nothing to fold.
Regression-trap evidence (mutation-break gate)
test_codex_agent_keeps_claude_model_verbatim_and_warns/test_codex_claude_model_warning_is_names_only-- deleted the_warn_codex_claude_modelcall; 8 tests FAILED as expected; guard restored.test_codex_agent_claude_model_warning_reaches_cli_output(e2e) -- deleted the same call; test 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
26/26 checks green on 62493e0 (incl. Spec conformance gate, Lint, both Build & Test shards, Windows gates, license/cla SUCCESS) after 0 CI fix iterations; the earlier Shard 2 red was main's apm view help truncation, fixed on main by #3651 and merged in.
Mergeability status
| PR | head SHA | CEO stance | iters | folds | defers | Copilot rounds | CI | mergeable | mergeStateStatus | notes |
|---|---|---|---|---|---|---|---|---|---|---|
| #3650 | 62493e0 |
ship_now | 2 | 2 | 0 | 1 | green | MERGEABLE | BLOCKED | awaiting required review |
Convergence
2 outer iterations; 1 Copilot round. Final panel stance: ship_now. Ready for maintainer review.
Full per-persona findings
Doc Writer
No findings.
Test Coverage Expert
No findings.
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.
Clean merge of #3599, #3647, #3650, #2933; no lockfile or autopilot package conflicts. Co-authored-by: sergio-sisternes-epam <[email protected]> Co-authored-by: Copilot App <[email protected]>
Description
TL;DR
When an agent is compiled for Codex and its
modelis a Claude alias (opus,sonnet,haiku,inherit) or aclaude-*id, APM now emits a names-only lossy-compilation warning naming the agent. The value is still written to the Codex TOML exactly as declared, as OpenAPM req-tg-015 requires. Mixed Claude/Codex packages learn the Codex agent will not work as written instead of failing silently.Closes #3477
Note
Rebuilt from #3481 by JohnnyXu (@xubenqiang) to ship in 0.36.0; original authorship credited via
Co-authored-by. The contributor's CLA stayed pending for 6+ days, so this branch carries the same reviewed change (panelship_nowon #3481 head07c5d5e) on freshmain.Problem (WHY)
model: sonnetcompiles to.codex/agents/<name>.tomlwithmodel = "sonnet", which Codex does not recognize, andapm installgives the author no signal.modelandmodel_reasoning_effort, which Codex honors #3126 scope require the source-declared model string be kept exactly as written.Approach (WHAT)
modelverbatim in the Codex TOML (byte-identical to today for every input).claude-*id (case-insensitive), emit onelossy_agent_compilationdiagnostic naming the agent file and themodelfield.Implementation (HOW)
src/apm_cli/integration/agent_integrator.py-- adds_is_claude_model()and_warn_codex_claude_model();_write_codex_agent()calls the warning only after the string value is already stored, so output is unchanged. Reuses the existing lossy-compilation channel used for non-stringmodelanduser-invocable.tests/unit/integration/test_agent_integrator.py-- each alias, mixed case andclaude-*ids keep a byte-identical TOML and warn once; non-Claude strings (gpt-5-codex,claude,my-claude-proxy, ...) do not warn; names-only guarantee.tests/spec_conformance/test_manifest_reqs.py+CONFORMANCE.{json,md}-- req-tg-015 cases pinning verbatim preservation of Claude model strings (test_count 1 -> 6).instructions-and-agents.mdandpackage-authoring.mdqualify the "no model validation" claim with this one name-only check and its remediation, and the per-harness model sections no longer call the warning future work.tests/integration/test_codex_agent_tool_scope_contract.py-- real-binary e2e: the warning reachesapm installoutput, the model stays verbatim, the value is never echoed.CHANGELOG.md-- Fixed entry.Trade-offs
model: opus->model = "opus") #3477 scope and req-tg-015; dropping (the original fix(codex): drop Claude model ids from compiled Codex agents #3481 approach) was rejected because it rewrites a declared value.codex:block suggestion. Per-target model values are the separate [FEATURE] Allow differentmodelvalues per target in one.agent.md(Claude vs Codex) #3324 question; the parser does not read acodex:block, so the remediation points to a Codex-specific agent source or removingmodel.claude-prefix are recognized; APM still does not validate other model names for any target.Benefits
apm installtime.Issue and approved scope
Issue: Closes #3477
Human scope-approval comment: #3477 (comment) (
apm-scope:v1, Decision: approve, Daniel Meppiel (@danielmeppiel))This PR completes the issue's approved scope. Out of scope per the record: per-target model values /
codex:block (#3324), dropping or translating model values, model validation for other targets,model_reasoning_efforthandling.Type of change
Testing
Local validation (targeted; CI is the authority)
Scenario Evidence
model: sonnet; installing for Codex tells me it will not work there."tests/unit/integration/test_agent_integrator.py::TestCodexAgentIntegration::test_codex_agent_keeps_claude_model_verbatim_and_warnstests/unit/integration/test_agent_integrator.py::TestCodexAgentIntegration::test_codex_agent_non_claude_model_does_not_warntests/spec_conformance/test_manifest_reqs.py::test_codex_claude_model_value_preserved_verbatimtests/unit/integration/test_agent_integrator.py::TestCodexAgentIntegration::test_codex_claude_model_warning_is_names_onlyapm installshows the warning and keepsmodel: sonnetin the Codex TOML."tests/integration/test_codex_agent_tool_scope_contract.py::test_codex_agent_claude_model_warning_reaches_cli_outputHow to test
model: sonnet, runapm install --target codex-> one[!]lossy-compilation warning naming the agent;.codex/agents/<name>.tomlhasmodel = "sonnet".model: gpt-5-codexand reinstall -> no warning; TOML keeps the value.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdateddocs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated@pytest.mark.req("req-tg-015")test undertests/spec_conformance/added (no normative change; the warning is non-normative)CONFORMANCE.{md,json}regenerated and committed (req-tg-015 test_count 1 -> 6)Co-authored-by: xubenqiang [email protected]
Co-authored-by: Copilot [email protected]