Skip to content

fix(core): hand chat coding work to the coding agent as a subagent - #1303

Merged
imsobear merged 1 commit into
rome-os:mainfrom
imsobear:fix/coding-as-subagent
Oct 24, 2026
Merged

imsobear merged 1 commit into
rome-os:mainfrom
imsobear:fix/coding-as-subagent

Conversation

@imsobear

Copy link
Copy Markdown
Collaborator

What this PR does

The main agent handed coding work to the coding agent through the coding:coding_task action, which only forwards to summon. While a coding task ran, the chat showed "Using Coding" and nothing else until it returned, so a multi-minute hand-off looked stuck (#1272).

The main agent now delegates coding work to coding:coding as a regular subagent. The chat shows the same subagent chip it shows for other subagents: "Thinking…" while it runs, steps and duration when it ends, and a click opens the coding agent's trace. A follow-up in the same chat continues the same coding session.

Closes #1272.

Design & Invariants

  • In chat, a coding hand-off is a subagent call, so the chat links the coding agent's run to the turn that started it.
  • A follow-up on earlier coding work in the same chat continues that coding session instead of starting a new one.
  • The coding:coding_task action stays. Routines, workflows, and the dream agent call it, and they cannot call a subagent. Removing it would break every stored routine that names it. Its own progress in a calling chat is separate work.
  • A coding session continues only from the chat and project that started it. That is the existing rule for every subagent. A coding session started by the action can still be continued from anywhere through the action.

Alternative considered: keep the action and make any action-started agent report into the calling chat. That covers routines too, but keeps two hand-off paths for chat. The 2026-10-22 sync chose the subagent path, and the action path stays as follow-up work.

Test plan

  • New chat, "让 coding agent 只读地数一下当前工作目录下有几个文件": the main agent calls the coding subagent on its first step, with no execute_action. The chip shows "coding Thinking…" 9 s after send and "coding 1 step · 7.6s" at the end.
  • Follow-up in the same chat ("让刚才那个 coding agent 接着查一下…"): a second chip runs and ends. The chat has exactly one coding subagent session, linked to the chat, holding two turns, so the follow-up resumed it.
  • Clicking the chip opens the coding agent's trace with its shell command and result. The main turn's trace lists the hand-off once.
  • Boot: main lists the coding subagent once the coding app has loaded. Before that, boot logs "core agent loaded without unknown subagent coding:coding" a few times, which is the existing skip-until-the-app-loads behavior.
  • Every subagent the core agents name resolves to a shipped app.
  • A chat on Codex that existed before this change keeps its old tool list and falls back to summon, so it still shows no progress. New chats are fine. Tracked in codex: a resumed chat keeps its first tool list, so subagents added later never reach the agent #1301.
  • Phone-size screenshots. Only the desktop view was captured; this PR changes no layout.

Exercised in pnpm dev:all (provider openai / gpt-6.1-sol, headless Chrome at 1440×900), plus the core-required, agent-loader, agent-grants, and subagent-execution unit tests. Claude was not run.

Screenshots (desktop)

Not in this PR

🤖 Generated with Claude Code

The main agent started coding work through the coding:coding_task action,
which only forwards to summon. The chat showed "Using Coding" and nothing
else until the run ended (rome#1272).

The main agent now lists coding:coding in allowedSubagents and its prompt
points coding work there. The chat shows the coding agent's progress the
way it shows other subagents, and a follow-up in the same chat passes the
earlier sessionId as resumeSessionId to continue the same session.

The coding_task action stays. Routines, workflows, and the dream agent
call it, and they cannot delegate to a subagent. Its progress in a calling
chat is a separate fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@yunfanye yunfanye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: ✅ APPROVE

The PR routes chat coding work through the existing subagent mechanism, preserves the action for other callers, and documents session resumption. Both changed files and the relevant loading, execution, ownership checks, and tests were reviewed.

Tests could not run because this checkout lacks dependencies (rstest was unavailable).

Verdict: APPROVE — The change reuses existing subagent infrastructure without introducing actionable correctness or security issues.

No issues found. Code looks good!


Automated review by RomeOS Code Review · commit 1fe65d5 · Full review history

@Jessie-QingYu Jessie-QingYu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: ✅ APPROVE

The PR adds coding:coding to the main agent's allowedSubagents and changes its system prompt so chat coding work goes to the coding subagent instead of coding:coding_task. The coding:coding_task action only forwards to summon. The docs paragraph is updated to match. I checked the parts of the code this touches:

  • Subagent tool: buildSubagentTools in agent-session.ts exposes a resumeSessionId field, and SubagentCompletion returns sessionId to the model. The prompt's instruction to pass the earlier sessionId as resumeSessionId matches the real interface.
  • Resume rules: subagent-execution.ts only resumes a session of type subagent with the same parent chat and project, as the PR describes.
  • Boot: deriveCoreRequiredApps resolves coding:coding to the coding app, which is already in ALWAYS_REQUIRED. When the app is missing, agent-loader drops the subagent with the "core agent loaded without unknown subagent" warning instead of failing to load.
  • Behaviour vs. summon: both paths run the coding agent with its own coding.yaml config, in the caller's project folder, and pass along the shared context.
  • Other callers: the dream agent, routines and the hook that starts the coding agent through agentRunner don't touch this path. The root-script grant test still holds, because coding has actions: ["*"] but not the explicit root-script grants.

The architecture direction is sound: it reuses the existing subagent mechanism instead of building a second way to report progress, and it keeps the action for callers that can't use a subagent. I found no correctness or security problems. Both findings are about the wording the model sees:

  1. During the transition, a chat may have earlier coding work that was started through coding_task. Its session id will be rejected as resumeSessionId, and the prompt doesn't say what to do then.
  2. The prompt's reason for the change ("sees its progress live") overstates what the chip shows today; the PR itself defers live steps to #1302.

Verdict: APPROVE — The change is small and uses the existing subagent mechanism correctly; the coding app is already required, so boot and grant checks hold. The two findings are minor prompt-wording improvements.

2 finding(s) posted as inline comments below.

Severity Category File Title
P2 design packages/core/agents/main.yaml No resume guidance for coding sessions started through coding_task
P3 code-quality packages/core/agents/main.yaml Prompt says progress shows live, but the chip only shows Thinking…

Automated review by RomeOS Code Review · commit 1fe65d5

- coding:coding: Complex coding work, such as building or changing an app

For complex coding work, you may delegate to the coding agent through the `coding:coding_task` action when it helps.
Hand coding work to the coding:coding subagent, not the `coding:coding_task` action, so the guardian sees its progress live. For a follow-up on earlier coding work in this chat, pass the coding subagent's earlier `sessionId` as `resumeSessionId`, so it continues the same session.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] design — No resume guidance for coding sessions started through coding_task

startSubagent rejects a resumeSessionId unless the stored session has type === "subagent" and the same parent chat. A coding session started through coding_task/summon fails both checks. After the upgrade, a chat that already holds coding work from coding_task will either fail the resume or quietly start a fresh coding session, so the earlier coding context is lost. Add one sentence to the prompt, e.g. "If the earlier coding work in this chat ran through coding:coding_task, continue it with that action and its sessionId instead."

- coding:coding: Complex coding work, such as building or changing an app

For complex coding work, you may delegate to the coding agent through the `coding:coding_task` action when it helps.
Hand coding work to the coding:coding subagent, not the `coding:coding_task` action, so the guardian sees its progress live. For a follow-up on earlier coding work in this chat, pass the coding subagent's earlier `sessionId` as `resumeSessionId`, so it continues the same session.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] code-quality — Prompt says progress shows live, but the chip only shows Thinking…

The PR defers live steps to #1302: while the subagent runs, the chip shows only "Thinking…". Saying the guardian "sees its progress live" overstates this. A neutral reason avoids the model repeating that claim to the guardian, for example: "so the chat links and shows the coding run".

@imsobear
imsobear merged commit 3677e7f into rome-os:main Oct 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coding: coding_task wraps summon and hides the coding agent's progress; call it as a subagent

3 participants