Skip to content

Use the bundled Codex CLI for codex-acp login #459

Description

@zeroliu

Summary

On a fresh global npm installation, codex-acp login tries to launch a separate codex executable instead of the @openai/codex dependency bundled with @agentclientprotocol/codex-acp.

If codex is not available on PATH, the child process exits before answering the pending JSON-RPC initialize request. On Windows, the command reports only:

Login error: Pending response rejected since connection got disposed

Bare codex-acp startup and codex-acp cli ... already use the bundled CLI when CODEX_PATH is unset.

Environment

  • Windows PowerShell
  • @agentclientprotocol/codex-acp@1.8.0
  • Installed globally with npm
  • No separate codex executable on PATH

Reproduction

npm uninstall -g @zed-industries/codex-acp
npm install -g @agentclientprotocol/codex-acp
codex-acp login

Result:

Login error: Pending response rejected since connection got disposed

codex-acp cli login reaches the bundled Codex CLI instead.

Cause

src/login.ts defaults to the external command name codex:

const codexPath = process.env["CODEX_PATH"] ?? "codex";

Bare codex-acp follows a different path. src/index.ts passes the unset CODEX_PATH through as undefined. startCodexConnection() then resolves the package-local @openai/codex/bin/codex.js and starts it with the current Node executable. Its effective command is:

<current Node executable> <bundled @openai/codex/bin/codex.js> app-server

This does not search PATH. codex-acp cli ... uses the same bundled resolution when CODEX_PATH is unset.

Invocation Default when CODEX_PATH is unset
codex-acp Bundled Codex running app-server
codex-acp cli ... Bundled Codex with the supplied CLI arguments
codex-acp login External codex found through PATH

login.ts turns an absent CODEX_PATH into the truthy string "codex" before calling startCodexConnection(). That forces the external-executable branch. If the executable is missing, the child process exits and disposes the JSON-RPC connection. The pending request then fails with the generic error above. OAuth has not started at that point.

The mismatch appears to have remained after #84 changed normal startup to use the npm dependency.

Expected behavior

When CODEX_PATH is unset, codex-acp login should use the bundled Codex CLI, matching bare codex-acp and codex-acp cli. An explicit CODEX_PATH should continue to override the bundled executable.

The login should remain visible to bare ACP startup when both commands use the same credential-store configuration.

Suggested fix

Reuse the bundled CLI resolution used by the other startup paths while preserving the dedicated login flow and its client metadata. Add regression coverage for both the bundled default and an explicit CODEX_PATH override.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions