fix(codex): make marketplace MCP bootstrap self-contained#762
fix(codex): make marketplace MCP bootstrap self-contained#762TyceHerrman wants to merge 2 commits into
Conversation
Package vendored dependencies for the Codex plugin launcher, add marketplace self-containment tests, and document/probe the plugin install state. Co-authored-by: Codex <noreply@openai.com>
|
@TyceHerrman CI |
There was a problem hiding this comment.
it was a temporary esbuild entrypoint so the Codex marketplace artifact could generate physical .codex-plugin/vendor/* bundles for turndown and turndown-plugin-gfm without shipping node_modules. updated with scripts/build-codex-vendor.mjs, which explicitly resolves the packages and builds the Codex-only vendor bundles.
There was a problem hiding this comment.
Hi @TyceHerrman! Thanks a lot for the PR. So what's these files actually? Please could you provide me more information about that and other file
There was a problem hiding this comment.
.codex-plugin/vendor/turndown.cjs and .codex-plugin/vendor/turndown-plugin-gfm.cjs are generated CommonJS bundles for the pure JS HTML-to-Markdown deps used by ctx_fetch_and_index. Codex marketplace installs can start without node_modules, but server.bundle.mjs still resolves physical module paths and injects them into a sandbox subprocess, so the codex artifact needs physical files for those deps.
scripts/build-codex-vendor.mjs is the source/build recipe. it resolves the real npm package entrypoints with createRequire(...).resolve(...) and uses esbuild to emit the vendor files. turndown.cjs and turndown-plugin-gfm.cjs are generated artifacts, and ctx already tracks other generated runtime bundles because plugin installs need to run from the checked-out/package artifact without a build step.
What / Why / How
Make the Codex marketplace MCP bootstrap self-contained enough to start from the installed plugin directory without a separate global
context-modeinstall or a first-runnode_modulesdependency install.This keeps Codex on a Codex-specific launcher at
.codex-plugin/plugin-start.mjs. The launcher validates the packaged artifact, wires bundled pure-JS runtime dependencies forturndownandturndown-plugin-gfm, preserves Codex MCP env/approval metadata, then importsserver.bundle.mjs. It also adds a Codex doctor probe that starts the plugin MCP command from.codex-plugin/mcp.jsonand verifiestools/listexposesctx_*.Affected platforms
Test plan
Added/updated tests for:
node_modules..codex-plugin/plugin-start.mjs, vendored runtime files, andserver.bundle.mjs.Verification run on latest base:
git diff --checknpm pack --dry-run --json --cache /private/tmp/context-mode-npm-cacheplus explicit package file checkLocal caveat:
npm run buildand focused Vitest were attempted after the latest rebase, but the local repo'sesbuildbinary hangs even on--version, and Vitest also hung without output.cli.bundle.mjswas regenerated with a working esbuild0.27.7binary from an installed context-mode package. Earlier focused Codex/plugin tests passed before the latest upstream refresh.Checklist
npm testpassesnpm run typecheckpassesnextbranch (unless hotfix)Cross-platform notes
The Codex launcher uses Node path helpers (
resolve,join,fileURLToPath) for filesystem paths. The manifest keeps Codex's existingcwd,env.CONTEXT_MODE_PLATFORM, anddefault_tools_approval_modefields while changing only the launcher args to the Codex-specific bootstrap.