Skip to content

spawn_agent returns "unsupported call" despite multi_agent feature being enabled #10

Closed

Description

@JasonC93

Environment:

  • Codex CLI 0.134.0 (npm install)
  • App-server daemon 0.131.0 (stale)
  • codex features list shows multi_agent stable true
  • Config has [features]\nsubagents = true (note: subagents is an unrecognized key; the correct key is multi_agent)

Steps to reproduce:

  1. Run a Codex CLI interactive session
  2. Attempt to call spawn_agent (which is listed among available tools)
  3. Receive error: unsupported call: spawn_agent

Expected behavior:
spawn_agent should successfully create a sub-agent or, if the runtime doesn't support it, the tool should not be presented as available to the model.

Actual behavior:
The tool is listed as available but returns "unsupported call: spawn_agent" when invoked. This suggests the tool definition is injected into the model's tool-use schema but the backend
routing (likely the app-server daemon) doesn't actually handle it.

Additional findings:

  1. The config had subagents = true (unrecognized key — silently ignored). The correct feature flag is multi_agent = true, though this didn't fix the issue since multi_agent was already
    enabled by default.
  2. The app-server daemon is stale (v0.131.0 vs CLI v0.134.0). Restarting/updating the app-server may be needed for spawn_agent routing.
  3. The app-server log shows codex_core::tools::router exec_command failures (No such file or directory), suggesting it's in a degraded state.

Suggested fix:

  • Ensure spawn_agent is only exposed as an available tool when the runtime actually supports it (i.e., feature gate the tool registration)
  • OR provide a more descriptive error message explaining what's missing (e.g., "spawn_agent requires the app-server daemon to be running and up-to-date")
  • Document the prerequisite: what runtime components must be active for spawn_agent/wait_agent/close_agent to work

Activity

  1. mountain commented on May 28, 2026

    @mountain
    Collaborator

    Thanks for the detailed report. Based on the environment details here, the likely root cause is the Codex runtime split rather than codex-relay tool translation:

    • Codex CLI is 0.134.0.
    • The app-server daemon is 0.131.0 and marked stale.
    • Current Codex releases do include subagent workflows by default, and the local multi_agent feature being stable/enabled is consistent with spawn_agent being exposed to the model.

    codex-relay should preserve these function-call primitives instead of filtering them: it forwards spawn_agent/wait_agent/close_agent as normal function tools to the upstream model, then maps the selected function call back into a Responses API function_call for Codex to execute. The unsupported call: spawn_agent error means the Codex-side tool dispatcher that receives the returned call does not have a handler for it. A stale app-server daemon is the most plausible way to get that mismatch: the newer CLI/tool schema exposes spawn_agent, while the older daemon cannot route it.

    Recommended next steps:

    1. Stop/restart the Codex app-server daemon so the running daemon matches the installed CLI version.
    2. If restart still leaves it at 0.131.0, update/reinstall Codex so both CLI and app-server are 0.134.0 or newer.
    3. Remove the unrecognized [features] subagents = true key and use [features] multi_agent = true only if you need to override the default.
    4. Re-test after confirming the daemon version. If it still fails with matching versions, please attach the app-server log around the unsupported call: spawn_agent event plus the inbound /v1/responses tools list, and we can look for a relay-side round-trip issue.

    For now I do not think codex-relay should default-filter subagent tools, because that would break supported Codex subagent workflows for users with a current runtime.

  2. mountain commented on May 28, 2026

    @mountain
    Collaborator

    Released v0.2.2 with additional debug support for this class of issue: https://github.com/MetaFARS/codex-relay/releases/tag/v0.2.2

    With RUST_LOG=codex_relay=debug, the relay now logs tool names at the key boundaries without logging arguments or message content:

    • response tools=... for tools received from Codex
    • upstream tools=... for tools forwarded to the Chat Completions upstream
    • upstream function_calls=... / upstream stream function_calls=... for tool calls returned by the upstream model

    That should make it straightforward to verify whether spawn_agent is preserved by the relay and whether the failure is happening after Codex receives the returned function call.

  3. mountain commented on May 28, 2026

    @mountain
    Collaborator

    Re-reading this, I think my previous reply was too focused on the likely stale app-server root cause and not enough on the contract problem you reported.

    The important issue here is: spawn_agent is presented to the model as available, but the runtime that receives the returned function call may not actually be able to route it. v0.2.2 only makes that boundary easier to diagnose; it does not fully address the UX failure.

    From the relay side, I do not think we can reliably auto-detect whether the local Codex app-server supports spawn_agent/wait_agent/close_agent, because the relay only sees the /v1/responses request and the tool schema Codex already chose to send. So I still do not want to silently filter these tools by default, since that would break users whose current Codex runtime does support multi-agent calls.

    But I agree this needs a relay-side mitigation/documentation path. I will keep this issue open and treat the actionable work as:

    1. Document the prerequisite clearly: CLI and app-server daemon versions must match, subagents is not a recognized feature key, and stale daemons can expose tools that they cannot execute.
    2. Add an opt-in tool filter/denylist so users on an affected runtime can remove tools such as spawn_agent, wait_agent, and close_agent from the upstream model schema instead of letting the model select calls that Codex will reject.
    3. Keep the debug logs added in v0.2.2 as the verification path for confirming whether the relay preserved the tool and whether the failure happened after the function call was returned to Codex.

    Thanks for pushing on this. The better framing is not “feature flag is off”; it is “tool availability and execution capability can get out of sync, and relay should give users a clear escape hatch when Codex sends tools that their runtime cannot route.”

  4. mountain commented on May 28, 2026

    @mountain
    Collaborator

    Opened draft PR #11 with the relay-side mitigation: #11

    The PR keeps subagent tools enabled by default, adds an opt-in CODEX_RELAY_TOOL_DENYLIST escape hatch, and documents the CLI/app-server version mismatch case. CI is green now.

    Please verify on the affected runtime with:

    CODEX_RELAY_TOOL_DENYLIST=spawn_agent,wait_agent,close_agent codex-relay

    That should remove those tools from the upstream model schema so the model cannot select calls that the stale Codex app-server rejects. I am leaving the PR as draft until we get runtime validation.

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