Skip to content

AgentAPI modules conflict when multiple AI coding tools are installed (hardcoded port 3284) #837

@qinkangdeid

Description

@qinkangdeid

Problem

All AgentAPI-based modules (claude-code, codex, auggie, gemini, opencode) hardcode agentapi_port = 3284 in their internal agentapi submodule. When multiple modules are installed in the same workspace template, only the first one to start actually works — the rest silently connect to the wrong AgentAPI instance.

For example, with both claude-code and codex enabled, clicking "Codex" in the Coder UI opens Claude Code instead.

Affected modules

  • coder/claude-code (agentapi port 3284)
  • coder-labs/codex (agentapi port 3284)
  • coder-labs/auggie (agentapi port 3284)
  • coder-labs/gemini (agentapi port 3284)
  • coder-labs/opencode (agentapi port 3284)

Expected behavior

Each module should be able to run on a different port so they can coexist in the same workspace.

Proposed fix

Expose agentapi_port as a variable in each module's main.tf, then pass it through to the agentapi submodule. This is a one-line change per module:

variable "agentapi_port" {
  type        = number
  description = "The port used by AgentAPI."
  default     = 3284
}

Then in the module "agentapi" block:

agentapi_port = var.agentapi_port

Users could then configure non-conflicting ports:

module "claude-code" {
  # ...uses default 3284
}

module "codex" {
  agentapi_port = 3285
  # ...
}

module "gemini" {
  agentapi_port = 3286
  # ...
}

Environment

  • Coder v2.31.7
  • Template with PVE LXC backend
  • All modules at latest versions

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions