Skip to content

Sub-agents: fixes from the review of run-time spawning - #342

Merged
shoom1 merged 12 commits into
developfrom
fix/p4-final-review
Nov 23, 2026
Merged

shoom1 merged 12 commits into
developfrom
fix/p4-final-review

Conversation

@shoom1

@shoom1 shoom1 commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Fixes from the review of the run-time sub-agent work as a whole (types started at run time, model choices and narrowed tools, skills that start an agent, /agent new, general_purpose). Both backends.

Narrowing and model choices

  • An ADK built-in that runs inside the model (google_search, url_context, ...) is one of the agent's own tools: task's tools may name it, and a run narrowed without it is no longer sent it. The outside-content mark for what the model runs itself follows what is sent. What each built-in adds is learned once per model for the build; one that cannot say adds nothing to leave out, and the run goes on.
  • A Deep Agents model choice gets skill tools made for its own model's provider (an image resource returned in the shape that provider takes), not its type's.
  • A model_choices entry with surrounding spaces is refused at validation (it could never be picked).
  • message_agent to a narrowed instance whose run is working steers it without listing the type's tools (a listing that fails no longer refuses a steer).

Starts

  • A start that is cancelled while it is numbered gives back the turn's run it counted.
  • /agent new stores its conversation only after the reads that can fail (an inherited copy, the conversation's state), so a failed start stores nothing. A refused /agent new leaves a new conversation unused.
  • An interrupt that lands before the user's run starts starts none (now pinned on both backends).

Log noise

  • A skill's agent: key ignored because the app lets no skill start an agent is logged at info, not as a warning above the prompt at every start; the skill loads exactly as before.
  • A type without a description is warned of once per offering agent, not once more per model choice.

Tests: each written first and seen failing (or failing against a mutant of the code it pins). The shared contract suite runs the new scenarios on both backends. CHANGELOG formatting fixed.

The full offline suite passes in the worktree (11083 passed), except TestChildImportOrigin::test_child_resolves_the_checkout, which fails the same way on develop under the worktree wrapper. On CI's library versions the contract suites, the MCP and skill tests and every touched file pass.

With the default policy a skill's `agent:` key is ignored and the skill
loads as instructions, exactly as before. Claude Code-style skills carry
that key, so a warning printed agents x skills lines above the prompt at
every start and model switch, to an end user who can do nothing about
it: a visible change under the default policy. `skill_agent_ignored` is
now logged at info (once per agent and skill per build, as before); an
app that opted in still gets `skill_agent_not_startable` as a warning.
A `task` call's model is compared stripped with each choice as written,
so `" fast"` could never be picked, and `"fast"` beside `"fast "` was not
caught as a choice named twice. validate_agent_graph now refuses an entry
that is not its own strip, naming the agent and the entry.
A blank line split the Added list between the skill bullet and the
model_choices bullet, and one line of the general_purpose bullet ran to
96 columns.
A delegating type is built once more for each of its model choices, on
both backends, and each build made its task offer with warnings on, so
the same `subagent_without_description` warning came once more per
choice. A model choice's agent (ADK) or graph (Deep Agents) now makes its
offer without warnings: it offers what its type's own build did, and
that build warned.
Delegations.start counts a run toward max_runs_per_turn as it checks the
limit, before it numbers the instance past the stored ones, so two
starts in one answer cannot both pass it. A cancel during that await (a
parent's stop of the calling run) started nothing but kept the count,
costing the turn one of its runs. The count is now released on every
path that leaves before the run starts, as message() does for its
reservation.
message() awaited the type's tool names before deciding anything, so
steering a running narrowed instance could connect an ADK MCP toolset
just to steer, and a listing that failed refused the steer with "try
again". The names are what a follow-up is checked against: they are now
asked for only when the message would start one (an idle instance's, an
interrupt's), and the decision is made again after that await, in one
step up to the follow-up's start, so a run that started meanwhile is
steered and two messages to one idle instance still give one run and
one steer.
start_instance stored a conversation not yet stored before reading an
inheriting type's history and the conversation's state, so a read that
raised left a 0-turn conversation listed with nothing in it. It is now
stored after every read that can fail, right before the run starts.
ConversationCore marked the conversation written for any start that
reached a ready workflow, and a refusal (a type the user may not start)
does, as the turn's one ERROR. Nothing ran and nothing was stored, yet
ConversationCore.fresh turned false, so a /settings orchestrator change
said "(applies to the next /new)" instead of moving the empty
conversation. A start now counts as written once its run started, which
is when the workflow stores the conversation; a start that raised or was
cancelled still counts when the workflow was ready, as before.
interrupt_instance can land once run_instance holds its run but before
the run's task is made; _users_run then starts no run. Nothing pinned
it: with the check removed, the contract suite and the view tests still
passed. A contract scenario on both backends now lands the interrupt in
that window (found by loop order on an initialized manager, within a
10 s deadline) and expects no second run, the instance idle and the
stream ended as a turn's cancel.
A choice's graph reused its type's tools, skill tools included, and
those were made for the type's own provider kind, which decides how a
binary skill resource is sent: as an image only to a provider that
reads one in a tool result. A choice on a Chat Completions endpoint got
an image block it refuses, failing every later request of the
instance's thread; one on a built-in provider below a configured type's
lost its images. Each choice of a type with skills now gets skill tools
made for the choice's model, as ADK builds a skill toolset per choice;
its registered and MCP tools stay the type's own objects, so no MCP
session opens again. The build's skill checks share one warned set, so
a choice warns of no skill once more.
An ADK built-in such as google_search is one of a type's own tools: a
task call's `tools` may name it. But narrowing kept every request entry
that is no function declaration, so a run narrowed to ["read_file"] to
keep it off the web was still sent Google Search, and the refusal text
offered a narrowing that did not hold.

A built-in adds a request entry and nothing to tools_dict, and the
request does not say whose an entry is. At each model call of a
narrowed run, each of the agent's own ADK tools that the run was not
given and that is not in tools_dict now processes a request of its own
(same model, a tool context of the same invocation), and the entries it
adds there are left out of the real request; a built-in the run keeps
is sent as ADK made it, and an entry no tool made (a code executor's)
stays.

The narrowing moves to a plugin of its own, RunToolsPlugin, first in
each sub-agent chain's head, before the permission gate: the gate marks
the conversation for the built-ins a request carries, and that mark now
follows what is sent. RunControlPlugin keeps the limits and steering
after the raw log. The CHANGELOG and README name the built-ins among
what `tools` may give.
…ps nothing

A narrowed run found a refused built-in's request entries by running its
process_llm_request on a request of its own at every model call. That
ran a tool's work again each time (PreloadMemoryTool searches the
memory), and a tool that raises there failed the run: google_search
with bypass_multi_tools_limit on a model it does not serve, which ADK
itself sends as an agent tool, so the run worked before narrowing knew
of built-ins. RunToolsPlugin now learns each refused tool's entries once
per model and keeps them for the build (a reinitialize makes a new
chain); a tool that raises adds nothing to leave out, logged at debug
once per tool and model.
@shoom1
shoom1 merged commit 26a8d27 into develop Nov 23, 2026
6 checks passed
@shoom1
shoom1 deleted the fix/p4-final-review branch November 23, 2026 03:24
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.

1 participant