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
Problem
All AgentAPI-based modules (claude-code, codex, auggie, gemini, opencode) hardcode
agentapi_port = 3284in 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-codeandcodexenabled, 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_portas a variable in each module'smain.tf, then pass it through to theagentapisubmodule. This is a one-line change per module:Then in the
module "agentapi"block:Users could then configure non-conflicting ports:
Environment
🤖 Generated with Claude Code