Skip to content

fix(codex-shim): pass non-remote subcommands through - #590

Open
hyamakawa7 wants to merge 1 commit into
fujibee:mainfrom
hyamakawa7:feature/fix-codex-shim-subcommand-passthrough
Open

fix(codex-shim): pass non-remote subcommands through#590
hyamakawa7 wants to merge 1 commit into
fujibee:mainfrom
hyamakawa7:feature/fix-codex-shim-subcommand-passthrough

Conversation

@hyamakawa7

Copy link
Copy Markdown

Summary

Prevent the Codex monitor shim from routing non-remote CLI subcommands through the app-server bridge.

When monitor delivery is enabled, commands such as:

codex plugin marketplace add owner/repository

were incorrectly routed through the bridge. The bridge injected --remote, which Codex rejects for non-interactive subcommands:

Error: `--remote ws://127.0.0.1:PORT` is only supported for interactive TUI commands, not `codex plugin`

No existing issue or pull request covering this exact failure was found.

Root cause

codex-shim.sh uses an allowlist for subcommands that should invoke the real Codex CLI directly. Several non-remote subcommands and aliases were missing, so they fell through to the monitored TUI path.

Changes

  • Pass known non-remote subcommands directly to the real Codex CLI, including plugin, mcp-server, remote-control, update, doctor, cloud, exec-server, features, and the e/a aliases.
  • Keep prompt strings and remote-aware session commands (fork, archive, delete, and unarchive) on the monitor path.
  • Fix an existing test that configured monitor mode for a test project but invoked the shim from another working directory.
  • Add regression coverage for plugin marketplace routing and table-driven coverage for direct and monitored subcommands.
  • Document plugin commands as non-interactive passthrough commands.

Verification

  • tests/test_codex_shim.bats: 18/18 passed.
  • Full test suite: 862/863 passed.
    • The remaining environment-dependent failure was resolve_node: finds the newest version-manager node when PATH lacks node: this Ubuntu environment resolved /usr/bin/node instead of the test's fake NVM node. The failing resolver and its test are unchanged by this PR.
  • Verified through the installed shell function with plugin marketplace and plugin listing commands.

Environment:

  • Ubuntu 24.04
  • codex-cli 0.146.0
  • agmsg base: 1c7efbc

Workaround for existing installations

Until this fix is installed, users can bypass the shim for a single command:

AGMSG_CODEX_SHIM_DISABLE=1 codex plugin marketplace add owner/repository

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