Skip to content

codex: the broker's tools over /mcp, the shared core and the broker's rules - #178

Merged
delpher merged 1 commit into
masterfrom
codex/broker-mcp
Nov 28, 2026
Merged

delpher merged 1 commit into
masterfrom
codex/broker-mcp

Conversation

@delpher

@delpher delpher commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Codex is the last adapter to move to the broker's tools and the shared core. Implemented by codex-alexey on alexey's assignment (AIChat 4111, 4113). I reviewed it, ran the tests and fixed one test.

What changes (checklist from AGENTS.md)

  1. Tools from the broker. Codex takes them from /mcp ([mcp_servers.aichat] url = …/mcp, bearer_token_env_var). Only upload_file and get_attachment stay local, as stdio aichat_files through core/files.
  2. Token. The app-server's MCP client gets it through an env variable. Model shell commands get shell_environment_policy.set.<VAR>="", so the token isn't visible to them.
  3. Shared core. The connection and HTTP go through core/broker. developerInstructions are built by core/instructions: the broker's rules + the Codex runtime block + local instructions last. A broker older than 0.32 gets the old text.
  4. Installer and migration. The installer registers both servers. The first normal start migrates an old generated [mcp_servers.aichat] entry, keeps other servers and owner policy, and is idempotent.
  5. Old broker. A broker without /mcp gives a notice, and the channel still starts.
  6. Guide. Section H of agent-guide.ts is updated.

My fix: the test «storage failure before RPC…» blocked a temp file named ${file}.${pid}.tmp. The shared atomicJSON adds a random suffix to the name, so that trap no longer caught anything. The write itself now fails (ENOSPC), and the test checks the same thing: no RPC, no ACK, the message stays queued.

npm test: 344 pass, 0 fail. typecheck passes.

Not checked yet (live, after the release), as codex-alexey listed:

  • after migration, App Server sees both MCP servers (aichat from the broker and aichat_files);
  • starting against an old broker;
  • the bearer reaches the MCP transport but not the environment of model commands (echo $env:<VAR> from a model command is empty).

🤖 Generated with Claude Code

… rules

By codex-alexey on alexey's assignment (AIChat 4111, 4113). Codex lists and
calls the AIChat tools on the broker's /mcp (bearer through
bearer_token_env_var, blanked for the model's shell commands); only
upload_file and get_attachment stay local, through core/files. The broker
connection and HTTP go through core/broker, and the model's
developerInstructions are composed by core/instructions: the broker's rules,
the Codex runtime block, the owner's local rules last; an older broker gets the
old text. The installer registers the local file tools over stdio and the
broker's server by URL; the first normal start migrates an old generated
[mcp_servers.aichat] entry and keeps other servers and owner policy. A broker
without /mcp gives a notice and the channel still starts. Guide section H
updated.

The storage-failure test now breaks the write itself: the shared atomicJSON
names its temporary file at random, so a folder in its place no longer trapped it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@delpher
delpher merged commit 463ea64 into master Nov 28, 2026
3 checks passed
@delpher delpher mentioned this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant