Repository navigation
feat(pack): generate .codex-plugin/plugin.json for targets: [codex] - #3906
Conversation
apm pack now writes the documented Codex compatibility manifest alongside the Claude and Copilot manifests when targets: includes codex. The owner core/plugin_manifest.py adds the codex ecosystem: identity fields from apm.yml plus "./skills/" and "./.mcp.json" path references when those regular root paths exist, so Codex reads the author's MCP file natively and no server data is copied. No interface block is generated. A new architecture guard keeps host manifest paths inside the owner. Verified with Codex CLI 0.170.0: an APM-generated Codex marketplace entry installs with its real version, loads the skill and lists the MCP server. Refs #3077 apm-spec-waiver: producer-side Codex plugin.json generation extends the existing pack manifest owner; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
…nielmeppiel-codex-plugin-manifest
apm-spec-waiver: producer-side Codex plugin.json generation extends the existing pack manifest owner; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The documentation incorrectly implies that portable bundles need additional Codex manifests and that Codex derives listing text from author metadata, misleading authors about compatibility and presentation behavior.
2 open issues
What changed in this PR
Adds Codex compatibility-manifest generation to apm pack, extending the existing Claude and Copilot manifest builder for plugin directories published through Codex marketplaces.
Changes:
- Generates
.codex-plugin/plugin.jsonwith package identity and references to existing skills and MCP configuration. - Registers a canonical manifest owner and architecture guard, with regression and mutation tests.
- Updates CLI help, publishing documentation, the usage guide, and changelog.
| File | Description |
|---|---|
tests/unit/scripts/test_architecture_runner.py |
Adds the guard to the frozen rule inventory. |
tests/unit/core/test_plugin_manifest.py |
Tests Codex identity, component references, warnings, and paths. |
tests/unit/core/test_build_orchestrator.py |
Tests Codex-only generation and supported-target diagnostics. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds a manifest-path ownership mutation case. |
src/apm_cli/core/plugin_manifest.py |
Implements Codex manifest generation. |
src/apm_cli/core/build_orchestrator.py |
Derives supported ecosystems in the error message from the owner. |
src/apm_cli/commands/pack.py |
Adds Codex to command help. |
scripts/architecture_linter/checks/marketplace_pack_plugin_manifests.py |
Guards centralized manifest definitions and paths. |
scripts/architecture_linter/checks/marketplace_integration_analyzers.py |
Registers the new architecture check. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Documents Codex manifest generation in the usage guide. |
docs/src/content/docs/reference/cli/pack.md |
Describes Codex output and component handling. |
docs/src/content/docs/producer/publish-to-a-marketplace.md |
Adds Codex publishing guidance and tested-scope notes. |
CHANGELOG.md |
Announces Codex manifest support. |
.apm/architecture/owners/marketplace-plugins.json |
Records the canonical pack-manifest owner. |
Review effort: Balanced
Codex 0.170.0 reads schema-declared root plugin.json from agent-plugin bundles and the .cursor-plugin fallback, so only directories with none of those manifests install as 'local'. The legacy Codex parser does not read author and leaves interface absent, so a generated compatibility manifest carries no listing presentation metadata. Addresses Copilot inline review on publish-to-a-marketplace.md:254 and reference/cli/pack.md:288. apm-spec-waiver: producer-side Codex plugin.json generation extends the existing pack manifest owner; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 3 | 0 | Extending core/plugin_manifest.py is the right owner, but the Codex manifest path is now declared twice and the new guard misses the second one. |
| Doc Writer | 0 | 3 | 0 | Docs match the code and the folded Copilot fixes hold. Say skills and MCP must live at the package root, and add the pack, commit and --force steps. |
| Test Coverage Expert | 0 | 3 | 0 | Unit tests catch the codex regression (they fail on main). No CLI-tier pack test covers targets:[codex], and the agent-plugin and dry-run paths have no codex-specific test. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 5 follow-ups
- [Test Coverage Expert] Add a CLI-tier test that runs
apm packwithtargets: [codex]and checks.codex-plugin/plugin.json. Also cover dry-run, keep-existing,--force, and the mixed-target agent-plugin case. -- This isoutcome: missingon the portable-by-manifest surface. - [Python Architect] Add a round-trip test of the producer output into
load_codex_compatibility_manifest, and warn when the name fails the reader's regex (reuse that regex). -- APM should not ship a Codex manifest its own consumer rejects. - [Python Architect] Keep a single definition of the Codex manifest path and extend the guard to
codex_plugins/. -- Two literals for one path let a future move split the producer from the consumer. - [Doc Writer] State the root
skills/and.mcp.jsonrequirement on all three doc surfaces, add the pack, commit and--forcesteps to the publish example, and trim the CHANGELOG line so it promises only what is unconditional. -- Without these, producers get stale or empty Codex manifests and no explanation. - [Python Architect] Make
build_plugin_manifestraise on an unknown ecosystem instead of falling through to the Copilot shape, and add a per-ecosystem key-set test. Track the full dispatch-table refactor post-merge. -- The silent fallback would give a fourth ecosystem the wrong manifest shape.
Recommendation
The direction is right and a real Codex client has proven it works. Fold the five in-scope items above before landing. The highest-value one is the CLI-tier apm pack test with targets: [codex] plus the round-trip check against load_codex_compatibility_manifest: together they keep APM's Codex producer and consumer in agreement. Only the broader dispatch-table refactor should be tracked after merge.
Full per-persona findings
Python Architect
- [recommended] The Codex manifest path now has two owners:
PLUGIN_ECOSYSTEM_PATHS['codex']repeatsCODEX_COMPAT_MANIFEST, atsrc/apm_cli/core/plugin_manifest.py:72
The reader and the consumer lookup usecodex_plugins/manifest.py:13. The new guard does not scancodex_plugins/, so the two literals could drift.
Suggested: Use one constant and extend the guard. - [recommended] No check that APM's own Codex reader accepts the producer output, at
src/apm_cli/core/plugin_manifest.py
load_codex_compatibility_manifestrequires a safe native name. The producer copiesnamethrough without warning.
Suggested: Add a round-trip unit test and warn using the reader's regex. - [recommended]
build_plugin_manifeststill uses copilot as the silent else-branch
A new ecosystem would silently get the Copilot shape.
Suggested: Raise on unknown and add a key-set test.
Doc Writer
- [recommended]
.apm/skills/and apm.ymlmcp:end up in no Codex reference, atdocs/src/content/docs/producer/publish-to-a-marketplace.md:249
A producer following APM's own layout gets a version but no skills or MCP references. - [recommended] The publish example has no
apm pack, commit or--forcestep, atdocs/src/content/docs/producer/publish-to-a-marketplace.md:258
An existingplugin.jsonis kept without--force, so a version bump leaves a stale Codex manifest. - [recommended] The CHANGELOG line over-promises skills and MCP servers, at
CHANGELOG.md:29
Only the version is unconditional.
Test Coverage Expert
- [recommended] No CLI-tier test runs
apm packwithtargets: [codex], attests/integration/test_pack_unified.py:462
Proof (missing at):tests/integration/test_pack_unified.py-- proves: a plugin author whose apm.yml targets codex gets a Codex manifest instead of 'Nothing to pack'. [multi-harness-support,devx] - [recommended] No mixed-target test shows codex is written under agent-plugin while claude is skipped, at
tests/unit/core/test_build_orchestrator.py:498
Proof (missing at):tests/unit/core/test_build_orchestrator.py-- proves: the Agent Plugin format drops only the Claude sidecar. [multi-harness-support,vendor-neutral] - [recommended] Dry-run, keep-existing and
--forceare untested for.codex-plugin/plugin.json
Proof (missing at):tests/integration/test_pack_unified.py-- proves:--dry-runwrites nothing and a re-run never overwrites without--force. [secure-by-default,devx]
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.
Folds the lean review panel on #3906. codex_plugins/manifest.py now derives CODEX_COMPAT_MANIFEST from PLUGIN_ECOSYSTEM_PATHS and exposes is_safe_codex_plugin_name, which pack reuses to warn on names APM's Codex route rejects. build_plugin_manifest raises on an unknown ecosystem instead of falling through to the Copilot shape, and the static guard now scans codex_plugins/. Adds a CLI-tier pack test (dry-run, keep-existing, --force), a mixed-target agent-plugin test and a reader round-trip test, each proven by mutation-break. Docs state the root skills/ and .mcp.json requirement and the pack, commit and --force steps; the CHANGELOG line no longer over-promises. apm-spec-waiver: producer-side Codex plugin.json generation extends the existing pack manifest owner; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
…nielmeppiel-codex-plugin-manifest
apm-spec-waiver: producer-side Codex plugin.json generation extends the existing pack manifest owner; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
Folds the delta review panel on #3906. is_safe_codex_plugin_name now lives in core/plugin_manifest.py next to PLUGIN_ECOSYSTEM_PATHS; the Codex reader and the native registrar's persisted-record check call it, so the lazy core-to-adapter import and the third regex copy are gone, and the guard forbids that rule literal on the pack and Codex surface. A parametrized test pins pack warning == reader rejection, and the dry-run check now asserts the project tree is byte-for-byte unchanged (both mutation-broken). The publish example shows the root marketplace wiring and the commit step, and the name-rule docs name the first-character rule and its consequence. apm-spec-waiver: producer-side Codex plugin.json generation extends the existing pack manifest owner; no OpenAPM normative requirement changes Co-authored-by: Copilot App <[email protected]>
…nielmeppiel-codex-plugin-manifest
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 1 | 0 | All three folds hold; the one remaining back edge (name rule in the adapter) is folded. |
| Doc Writer | 0 | 3 | 0 | All three folds are accurate; example wiring, commit step and name-rule wording are now folded. |
| Test Coverage Expert | 0 | 2 | 0 | All three prior folds close their gaps; the paired name trap and the dry-run snapshot are now folded. |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 2 follow-ups
- [Python Architect] Post-merge: replace the per-ecosystem branching in the pack producer with a full dispatch table. -- The raise on unknown ecosystem already prevents silent fallthrough; a table makes the next ecosystem cheap to add.
- [Python Architect] Post-merge: use the same guard regexes across ecosystem surfaces. -- One convention keeps a rule from being duplicated again when the next adapter lands.
Recommendation
Ship #3906 in 0.37.0 once CI on 30612fe is green. All in-scope findings from the lean and delta passes are folded, and the key guarantees are enforced by tests shown to fail when their guards are removed. Track the dispatch-table refactor and guard-regex uniformity as post-merge issues; the dispatch table is the higher-signal follow-up.
Full per-persona findings (delta)
Python Architect
- [recommended] The name rule lived in the adapter and was copied in
registrar.py, atsrc/apm_cli/core/plugin_manifest.py:414
Core reached back intocodex_pluginsthrough a lazy import. Folded: the rule now lives in the owner.
Doc Writer
- [recommended] The Codex example lacked root marketplace wiring, at
docs/src/content/docs/producer/publish-to-a-marketplace.md:269. Folded. - [recommended]
git addhad no commit step, atdocs/src/content/docs/producer/publish-to-a-marketplace.md:271. Folded. - [recommended] The name-rule wording missed the first-character rule and its consequence, at
docs/src/content/docs/reference/cli/pack.md:288. Folded.
Test Coverage Expert
- [recommended] No test paired the pack warning with reader rejection, at
tests/unit/core/test_plugin_manifest.py
Proof (passed):tests/unit/core/test_plugin_manifest.py::TestBuildPluginManifest::test_codex_name_warning_matches_reader_rejection-- proves: pack warns exactly when install would refuse the name. [secure-by-default,multi-harness-support,devx] - [recommended] The dry-run check covered a single file, at
tests/integration/test_pack_unified.py
Proof (passed):tests/integration/test_pack_unified.py::TestPackUnified::test_pack_codex_target_writes_codex_plugin_json-- proves:apm pack --dry-runleaves the project byte-for-byte unchanged. [devx,governed-by-policy]
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.

Description
apm packnow writes.codex-plugin/plugin.jsonalongside the Claude and Copilot manifests whenapm.ymltargets:includescodex. A package listed in an APM-generated Codex marketplace (marketplace.outputs.codex) then installs in Codex CLI under its real version, with its skills and MCP servers loaded and no hand-written JSON.On
main,targets: [codex]fails with "Nothing to pack". A plugin directory with no manifest Codex can read installs as versionlocal, and Codex writes a stand-in manifest that holds only the name and category.What changed
src/apm_cli/core/plugin_manifest.py: adds thecodexrow toPLUGIN_MANIFEST_ECOSYSTEMSandPLUGIN_ECOSYSTEM_PATHS(.codex-plugin/plugin.json).build_plugin_manifest(..., "codex")emits:apm.yml:name,version,description,author,license,homepage,repository,keywords;"skills": "./skills/"when a regular rootskills/directory exists;"mcpServers": "./.mcp.json"when a regular root.mcp.jsonexists. Symlinks are skipped. Codex reads the author's own file, so no MCP server data is copied and no secrets are touched;interfaceblock. Codex's compatibility parser does not derive one (it ignoresauthor), so the plugin carries no Codex listing presentation metadata; generating it is out of scope;[!]warning whenversion,descriptionorauthoris missing. The Codex format requires them.core/build_orchestrator.py: unchanged routing. The "Nothing to pack" error now lists the ecosystems from the owner instead of a hard-coded'claude' or 'copilot'.pack-plugin-manifests(.apm/architecture/owners/marketplace-plugins.json) and rulemarketplace-integrations-pack-plugin-manifests. The rule requiresPLUGIN_ECOSYSTEM_PATHSandbuild_plugin_manifestto be defined only in the owner. It also forbids host-manifest path literals (.claude-plugin,.codex-plugin,.github/plugin) anywhere else in the pack surface (core/,bundle/,commands/pack.py). The rule is in the frozen rule inventory and has a sorted mutation case.reference/cli/pack.md(Plugin manifests table and Codex rules),producer/publish-to-a-marketplace.md(Codex entries need the manifest; tested surface stated),packages/apm-guide/.apm/skills/apm-usage/commands.md,pack --help, and a CHANGELOG line.Codex plugin manifest contract (primary sources)
OpenAI, Upload and submit your plugin -> Manifest fields, "Package identity and components" (quoted exactly, Codex-relevant rows):
$schemanameversiondescriptionauthorurl. The portable schema allows this object to be omitted; the Codex format requiresauthor.name. Use at most 120 characters for the name, 320 for email, and 2048 for the URL.homepageinterface.websiteURLseparately.repositorylicensekeywordsskills"./skills/". Portable packages discoverskills/automatically.mcpServers"./.mcp.json"for bundled MCP server configuration. Portable packages discover rootmcp.jsonautomatically.The same page lists
interfaceas "Required for Codex; optional for Agent Plugins", a presentation object for public-directory submission. Package your plugin says: "A separate.codex-plugin/plugin.jsonis optional and serves as a compatibility fallback when that object [extensions.com.openai] is absent."Codex CLI source at tag
rust-v0.170.0(commit29eb79e9866b3262a777fdf8195c1b9e63684c91):codex-rs/utils/plugins/src/plugin_namespace.rsfind_plugin_manifest_path: rootplugin.jsoncounts only when it carries anhttps://agent-plugins.org/schemas/$schema. Otherwise Codex checksDISCOVERABLE_PLUGIN_MANIFEST_PATHS(codex-rs/exec-server-protocol/src/protocol.rs) in this order:.codex-plugin/plugin.json,.claude-plugin/plugin.json,.cursor-plugin/plugin.json.codex-rs/core-plugins/src/manifest.rsRawPluginManifestreadsname,version,description,keywords,skills(path or paths),mcpServers(path or object),apps,hooks,interface,extensions.loader.rsdefaults:skills,.mcp.json,hooks/hooks.json.APM's default Claude-format bundle writes root
plugin.jsonwithout$schema, so Codex ignores it. That is why the manifest has to sit in the plugin directory itself.Issue and approved scope
Issue: Fixes #3077
Human scope-approval comment: #3077 (comment) (strict
apm-scope:v1;scripts/governance/authority.cjsevaluateIssuereturnsrecord-present, approver and review contact Daniel Meppiel (@danielmeppiel)). It narrows the accepted October 1 scope (#3077 (comment)) to the 0.37 delivery Daniel approved. Context: #3077 (comment).This PR completes the recorded scope. Out of scope, unchanged: generated
interface/extensions.com.openaidata, theapm.ymlextensions passthrough,displayName(#3076), Codex desktop or hosted parity, hooks or agents claims, writing the file inside packed bundles, and any automatic Codex trust, consent or MCP authentication.Reporter Roger Siegenthaler (@siegenthalerroger): thank you for the spike on Codex 0.162.1. It matches what 0.170.0 does:
--format agent-pluginstill works through its schema-declared rootplugin.json(no sidecar needed), and this PR covers thetargets:route for plugin-shaped package directories.Type of change
Testing
Real Codex CLI verification
Versions:
codex-cli 0.170.0(/opt/homebrew/bin/codex, CLI surface only), APM from this branch (Agent Package Manager (APM) CLI version 0.36.1 (b7520981a5)), macOS. Every run uses a fresh, isolatedCODEX_HOME.The fixture is a plugin-shaped package (
skills/hello/SKILL.md, a stdio.mcp.json,apm.ymlwithtargets:) undermarket/plugins/hello-codex, plus a marketplaceapm.ymlwithoutputs: {codex: {}}and a localpackages:entry. The recipe script (below) packs the package, packs the marketplace, then runs:Baseline (
main@ fec774d,TARGETS='[codex]'):A default
apm packbundle (no readable manifest) listed in the same marketplace installs as.../hello-codex/local,VERSION local. Codex writes{"name": "hello-codex", "category": "Productivity", "interface": {"category": "Productivity"}}as its stand-in.codex-plugin/plugin.json.This branch (
TARGETS='[codex]'):The catalog entry name
hello-codexandsource.path./plugins/hello-codexmatch the manifestnameand the directory Codex installed.This branch (
targets: [claude, copilot, codex]): all three manifests are written. Codex installs1.2.3, listsfixture-echoand exposeshello-codex:hello(Codex prefers.codex-plugin/over.claude-plugin/).APM consumer checks (no regression):
.apm/-layout package with the new file installs at project scope asapm_package. Itstargets: [codex]restriction skips Claude deployment exactly as it does without the file.apm install -g --target codex <package>with isolatedHOME/CODEX_HOMEgoes through the existing Codex-native consumer ([BUG] Plugins whose manifest is .codex-plugin/plugin.json lose their MCP servers (typed skill_bundle) #2992): "Reconciled 1 Codex native plugin registration(s) at user scope. New plugins stay disabled". Thencodex plugin listshowsinstalled, disabled 1.2.3. Activation and MCP authorization stay with Codex..codex-plugin/plugin.jsonis treated by APM as a Codex compatibility plugin. That route is user-scope only, so project installs refuse it with the existing guidance (apm install -g --target codex). Addingclaudeorcopilottotargets:keeps project installs working.Recipe script (re-runnable)
Automated checks (local)
uvx [email protected] check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py: passeduvx [email protected] format --check(same paths): passed.venv/bin/python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.py: passed (10.00/10)bash scripts/lint-auth-signals.sh: passedbash scripts/lint-architecture-boundaries.sh: passed (exit 0)pytest tests/unit/core/test_plugin_manifest.py tests/unit/core/test_build_orchestrator.py tests/integration/test_pack_unified.py tests/unit/commands/ -k "plugin_manifest or build_orchestrator or pack" -p no:xdist: 483 passedpytest tests/integration/test_architecture_owner_rule_mutations.py tests/unit/scripts/test_architecture_runner.py -k "pack-plugin-manifests or pack_plugin or inventory or coverage" -p no:xdist: 18 passed (includes the new mutation case and the frozen rule inventory);-k "every_registered or covers or sorted or matrix_covers": 2 passedAll runs used the PR merge state (this branch merged with
main@ f823cd0).Changelog
## [Unreleased]inCHANGELOG.md: user-visibleeffect first, 25 words or fewer, ending with
(#PR); see.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedapm-spec-waiver:line: producer-side Codexplugin.jsongeneration extends the existing pack manifest owner.)