Skip to content

Sub-agents: fixes from the whole-work review - #336

Merged
shoom1 merged 5 commits into
developfrom
fix/p3-final-review
Nov 20, 2026
Merged

shoom1 merged 5 commits into
developfrom
fix/p3-final-review

Conversation

@shoom1

@shoom1 shoom1 commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Fixes from a review of the sub-agent work as a whole, before release. None of them is a crash. Each is a wrong message, an uncapped result, or text that says something untrue.

Behaviour

  • /exit while a sub-agent's run works in its view interrupts the run. The run ends interrupted and the sub-agent stays idle, so its parent can continue it after a restart. It is still waited for before the workflow is cleaned up. Before, exit counted as the user's stop: the sub-agent was left stopped, and its parent's message_agent was refused. Ctrl+C in the view is still the user's stop.
    • The manager gains interrupt_instance (provisional) for this.
  • A running call of a run its parent or a limit stopped now says so. The run's next request used to tell the model the user had interrupted it. It now says what stopped the run, on both backends; the user's own stop keeps its text.
  • The notice the main agent gets after /back passes the tool result cap. A long result from a sub-agent's view used to reach the main agent whole, and one over its budget ended the notice turn in an overflow. It is now cut as a task result is, with the same note and the full output saved for read_file.

Text

  • CHANGELOG:
    • Entries under "Fixed" and "Changed" described behaviour that is new in this release (steering, limits, child sessions, the envelope). They are folded into the Added entries that introduce it.
    • The CHANGELOG and README now say that the app's session opens one dialog at a time. A command's dialog and a run's question wait for each other, and an app keeps this by assigning self.session.
  • Deep Agents: the docs and comments said the scan of a conversation's stored sub-agents decodes no message. It does decode each one's first input, and the texts now say so. The test that was meant to show it counted the wrong channel; it now asserts what holds.

Tests: each behaviour change has a test written first and seen failing. The /exit and stopped-call scenarios run on both backends.

The full offline suite passes in the worktree, except TestChildImportOrigin::test_child_resolves_the_checkout, which fails the same way on develop under the worktree wrapper. The shared contract suite and the touched tests also pass on CI's library versions (google-adk 2.15, deepagents 0.7.41) in a scratch virtualenv.

…'s dialog lock

The changelog listed fixes and a change to behaviour that exists only in
this release's own unreleased work (steering, a stopped run's children and
calls, child sessions' delete order, the envelope's open tasks). Each fact
moves into the bullet that introduces the feature, and the Fixed and
Changed bullets that described them as released behaviour go.

The view's bullet and the README now say that the app's session wraps its
six dialog methods so one dialog opens at a time, and that an app keeps it
by assigning its session through self.session.
CheckpointSessions.instances reads each instance thread's first input
checkpoint, which holds the run's first input (in its __start__ channel and
its pending writes): the brief, and an inheriting instance's copy of its
parent's conversation. The saver decodes it on the event loop. The module
docstring, the method's, CLAUDE.md and the changelog said that checkpoint
holds no message; they now say what it holds, and the manager's hook says
the threads are the records' floor, as the code reads them.

The test counted only the messages channel, so it passed while the brief
was decoded. It now records what each checkpoint read holds in __start__
and in its pending writes, and pins that it is each thread's first input
and nothing a later run wrote. The scan's cost is unchanged.
…lt cap

After /back the main agent was told the whole envelope of the run the user
started in the view, uncut: a long report cost the root that much at once,
and one over its budget could not be trimmed, since the newest turn stays.
Every other envelope a model reads passes cap_tool_result.

The manager now keeps the envelope it holds for instance_result as the cap
leaves it (_user_ran), with the same cut, note and saved output a task
result gets, saved under the instance's name. The cap is applied there
rather than at the notice: the manager owns the settings that size it
(tool_result_max_chars, the app's tool-output folder), as the backends'
caps do; it covers both backends at once and any caller that tells the
root through instance_result, an app's own tell_root(view_notice(...))
included; and it runs once, as the run ends.
…s so

A call left at its prompt by a sub-agent run its parent or a limit stopped
was told what stopped it (not_run), but a call that was running was still
told "Interrupted by the user before it finished", although the cause is
known on both backends.

interrupts.py gains INTERRUPTED_BY, "Interrupted: {cause} stopped the run
before this call finished; it may have partly run. Check before running it
again.", and interrupted_by(cause), which gives INTERRUPTED_BY_USER for
the user's stop, as not_run gives NOT_RUN. OpenCalls.answer reads the cause
for both kinds of call (the one given, else the one recorded with the
instance's stop) and unrecorded words a stopped run's call with it, so
ADK's seal (its stop_cause) and Deep Agents' next run (the cause recorded
with the instance's stop) answer alike. The user's stop and Ctrl+C keep
INTERRUPTED_BY_USER; a call no stop answers stays INTERRUPTED.

The contract test of a follow-up after a stop now pins the parent's stop
and a time limit on both backends.
A process exit interrupts a run: it ends interrupted and its instance stays
idle. Only Ctrl+C in a view is the user's stop. At /exit the app stopped a
view's run still working with the view's own stop, so the run ended
cancelled by the user and the instance stayed stopped: after a restart the
main agent's message_agent to it was refused, although the user never
chose to stop it.

The manager gains interrupt_instance(instance) (provisional): it ends the
run of a run_instance as a turn's cancel ends its runs. The run's task is
cancelled as its caller's would be, so it ends interrupted and its instance
idle; the stream raises CancelledError, and run_instance's user-stop path
is skipped for it, a stop of its stream included. The view's interrupt()
calls it, then cancels the view's tasks (a line waiting to run never
starts), and the app calls it at exit, still waiting for the run before
the workflow is cleaned up so its turn records it and writes the records.

TestExitInAView now asserts interrupted and idle, and that after a restart
the main agent's message_agent continues the instance; a contract scenario
pins interrupt_instance on both backends.
@shoom1
shoom1 merged commit 5e6a812 into develop Nov 20, 2026
6 checks passed
@shoom1
shoom1 deleted the fix/p3-final-review branch November 20, 2026 16:29
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