feat(config)!: require a server factory from every stdio MCP entry and retire AB4736 - #839
Conversation
…d retire AB4736 Wrap every local MCP entry in the framework stdio lifecycle shell and raise AB4730 to an error when the entry has no default export; delete the byte-for-byte self-connecting build path. Stop discovering and reporting documents in the removed top-level skills/, commands/, and rules/ locations.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: f04864a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
agent-bundle/packages/agent-bundle/src/config/validate.ts
Lines 634 to 636 in 1d31f49
When a supported .cjs MCP entry uses the idiomatic module.exports = () => server, this syntax-only scan reports no default export and the new error blocks validation and builds. Such a module does expose that function as serverModule.default to the generated import * as serverModule shell, so it already satisfies the runtime factory contract; account for CommonJS assignment exports or exclude .cjs from the advertised supported module formats rather than rejecting a usable entry.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
commit: |
Summary
Every local stdio MCP entry now default-exports a server factory and runs inside the framework stdio lifecycle shell. The second build path, which bundled a self-connecting entry byte for byte with no console guard, signal handling, stdin-EOF exit, or heartbeat, is deleted.
AB4730changes from an informational nudge to an error.AB4736is retired. The top-levelskills/,commands/, andrules/document locations were already undiscovered, so the three extra globs that ran on everyvalidate,inspect,build, anddevonly existed to report them. Explicitskillspaths still work anywhere.Removal matrix
fixtures/integration/comprehensive,fixtures/integration/packed-release, inline fixtures in 20 test filesbuild/entries.tsandbuild/inspect-bundler.ts;AB4730info nudge becomes an errortests/package-conventions.test.tslegacyConventionalDocuments, threefast-globpasses,AB4736AB4731–AB4735stay. They flag a confusable current state (explicit config shadowing a conventional file) and accept no old shape.examples/rsc-agent-runtimedeclares its self-connecting server asentry: { prebuilt }, which is outside the rule.Consumer impact
A local entry without a default export fails with
AB4730. Default-export the server factory, or declare a prebuilt server withcommandorurl. Former self-connecting servers now get the shell's stderr heartbeat and prompt exit at transport close.Verification
On
832709131f, rebased ontoorigin/mainafter #810 merged (18a913e9d8):pnpm build: passpnpm typecheck: passpnpm lint: passpnpm test:unit: pass (309 files, 4,480 tests)pnpm test:integration:run: pass (whole pool, 104 files, 1,186 tests)pnpm test:packed: pass (whole packed pool, 16 files, 47 tests)pnpm docs:site:build: pass (language parity OK, diagnostics coverage OK, 0 broken links)Review
Independent review (GPT-5.6, change-risk pass) found one low item.
AB4730skips explicit MCP entries whose extension is outside the JS/TS set. Such an entry cannot be bundled on either the old byte-for-byte path or the new wrapped path, so the build already fails for it. This PR opens no new gap.Follow-up
Codex P1 (CommonJS
module.exportsfactories rejected byAB4730) fixed in #850.AB4730accepts a top-levelmodule.exports = factoryunless the file binds its ownmodule. An integration test builds such a.cjsentry and lists its tools over stdio.