Skip to content

codex: a resumed chat keeps its first tool list, so subagents added later never reach the agent #1301

Open

Description

@imsobear

Situation

An agent gets its subagents, interactive tools, and other Rome tools as one tool list. On the Codex provider, a chat keeps the tool list it had when its first turn ran. When Rome later gives the agent a new subagent, a chat that already existed never sees it. The system prompt does update, so the agent reads an instruction to use a tool it does not have.

Claude chats do not show this. They build the tool list again each time the session opens.

Symptom

The main agent's prompt tells it to hand coding work to the coding:coding subagent, but it has no tool for that subagent. It falls back to discovery: search_actions with subagent|run_agent, then read_action system:summon, then execute_action system:summon with agentName: coding:coding. Its reasoning summary reads: "I need to delegate tasks … I think it might help to search for tools by their exact names". The same message in a new chat calls the subagent tool directly.

Seen on a pnpm dev:all stack running fix/coding-as-subagent (which adds coding:coding to the main agent's subagents), provider openai / gpt-6.1-sol.

How to reproduce

  1. On main, with a Codex-backed model, open a chat and send any message, so the chat has a Codex thread.
  2. Add a subagent to packages/core/agents/main.yaml allowedSubagents, for example coding:coding, and restart the Rome container.
  3. In the same chat, ask for work that the new subagent should do: "让 coding agent 只读地数一下当前工作目录下有几个文件,不要改任何东西。"
  4. Open the turn's trace. The session init carries the new system prompt, the turn never calls the subagent tool, and the agent searches the action catalog instead.
  5. Control: send the same message in a new chat. The agent calls the subagent tool on its first step.

Initial triage

  • Rome builds the new list. The session opens after the restart with the current agent config, so the list it builds contains the new subagent.
  • Resume drops the list. openThread sends thread/start with dynamicTools for a new thread. For an existing thread it sends thread/resume, and toThreadConfigurationOverrides strips dynamicTools (the protocol comment says the field is accepted only by thread/start). baseInstructions still goes through, which is why the prompt and the tools disagree.
  • Not Claude. The Anthropic provider builds its MCP servers from the current subagent tools on every openSession, including a { resume } one.
  • Related, all providers. An agent session computes its subagent tools once when it opens, while the action and skill catalogs are read live. A session that stays open across an app being enabled or disabled keeps its old subagent list until it closes. A deploy restarts the process, so this only bites mid-run app changes.

Suspected root cause

Confidence: high for the mechanism, from the code path and the trace above. Codex binds dynamic tools to a thread at thread/start, and Rome's resume path has no way to replace them, so every tool added after a chat's first turn is missing from that chat. Unverified: whether a newer Codex app-server accepts a tool update on resume or through another call.

Possible fixes

  1. Compare the thread's stored tool list with the current one on resume. When they differ, start a new thread and carry the conversation over the way Rome already pages history.
  2. Use a Codex call that replaces a thread's dynamic tools, if the app-server offers or adds one.
  3. Expose subagents through a tool that is always present, such as one dispatcher tool, so the list a thread holds never changes. The catalog behind it is read live.
  4. Build the session's subagent tools from the live agent config, like the action catalog, for the all-provider case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Fix in the normal course of workbugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions