Repository navigation
Description
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
- On
main, with a Codex-backed model, open a chat and send any message, so the chat has a Codex thread. - Add a subagent to
packages/core/agents/main.yamlallowedSubagents, for examplecoding:coding, and restart the Rome container. - In the same chat, ask for work that the new subagent should do: "让 coding agent 只读地数一下当前工作目录下有几个文件,不要改任何东西。"
- 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.
- 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.
openThreadsendsthread/startwithdynamicToolsfor a new thread. For an existing thread it sendsthread/resume, andtoThreadConfigurationOverridesstripsdynamicTools(the protocol comment says the field is accepted only bythread/start).baseInstructionsstill 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
- 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.
- Use a Codex call that replaces a thread's dynamic tools, if the app-server offers or adds one.
- 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.
- Build the session's subagent tools from the live agent config, like the action catalog, for the all-provider case.
Activity
fix(core): hand chat coding work to the coding agent as a subagent (#…