Repository navigation
Sub-agents: fixes from the review of run-time spawning - #342
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
google_search,url_context, ...) is one of the agent's own tools:task'stoolsmay 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.model_choicesentry with surrounding spaces is refused at validation (it could never be picked).message_agentto 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
/agent newstores 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 newleaves a new conversation unused.Log noise
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.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.