--exec: a sub-agent that reaches max_iterations ends the whole run instead of handing back to its parent
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with pkg/runtime/agent_delegation.go to trace how child sessions inherit iteration and non-interactive settings, then read enforceMaxIterations in pkg/runtime/loop_steps.go and the --exec handling in pkg/cli/runner.go. Reproduce with the supplied team configuration and non-terminal stdin; confirm that a helper capped at one iteration returns control to the root, which then completes its run.
索引モデルが issue の本文から書いたものです。
説明
Description
In docker agent run --exec, a sub-agent that reaches its max_iterations ends the whole run. Its lead never gets control back, so the lead cannot finish, summarise or report what the sub-agent did. The run exits 0.
Versions: v1.152.0 and v1.161.0, Linux, stdin not a terminal (CI or an unattended job).
Steps to reproduce
The provider is an OpenAI-compatible stub that answers with tool calls.
agents:
root:
model: m
instruction: lead
max_iterations: 20
sub_agents: [helper]
helper:
model: m
instruction: helper
max_iterations: 1
toolsets:
- type: todo
- The root's first answer is
transfer_tasktohelper. - The helper answers with several
create_todoscalls, then text. - Run
docker agent run team.yaml --exec go </dev/null.
Result: one helper call, then
⚠️ Maximum iterations (1) reached. The agent may be stuck in a loop.
Do you want to continue for 10 more iterations? (y/n):
Failed to read input, exiting...
and exit 0. The root's next model call never happens.
With the helper at max_iterations: 0 (no cap), the helper finishes and the root gets transfer_task response → "…" as expected.
Why (from the source, v1.161.0)
- Each
transfer_taskstarts a child session with the sub-agent's own cap (pkg/runtime/agent_delegation.go,session.WithMaxIterations(childAgent.MaxIterations())). - In
enforceMaxIterations(pkg/runtime/loop_steps.go), aNonInteractivesession stops itself and appends "Execution stopped after reaching the configured max_iterations limit". For a sub-agent, that would return its turn to the lead. - The
--execCLI path never marks the sessionNonInteractive, andtransfer_taskcopies the parent's value. So theMaxIterationsReachedEventreaches the CLI runner (pkg/cli/runner.go). The runner prompts, the read fails without a terminal, and it callsrt.Resume(ResumeReject(""))andreturn nil, which ends the whole run.
Expected
In --exec with no terminal, a capped sub-agent stops and hands its turn back to its parent, as a NonInteractive session already does, instead of the CLI ending the run. Possible approaches:
- mark
--execsessionsNonInteractivewhen stdin is not a terminal; - or have the CLI, on a failed read, reject only the session that reached its cap.
--yolo avoids the prompt, but it also auto-approves every tool call, which an unattended run with a restricted permission set cannot accept.
Related: #4560 (the continuation increment).
- 主要言語
- Go
- スター
- 4.7k
- フォーク
- 565
- 平均マージ
- 18時間 52分
- マージ済み PR(30日)
- 221
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/docker-agent のほかの issue
-
edit_file diff rendering panics on invalid UTF-8 text対応中かも @TDnorthgarden が今日担当しました。 オープンarea/tui
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
docker/docker-agent#4955 ·
メンテナーはふだん 1 日以内に返信
-
A setting to turn off the models.dev catalog download (offline and strict-network use)対応中かも @3431481073 が 19 日前に担当しました。 オープンarea/config area/models
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
docker/docker-agent#4714 ·
メンテナーはふだん 1 日以内に返信
-
Error when trying to run sandbox example?対応中かも @dgageot が 27 日前に担当しました。 オープンarea/cli
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
docker/docker-agent#4672 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`edit_file` silently edits the first match when `oldText` occurs more than once対応中かも @dwin-gharibi が 103 日前に担当しました。 オープンarea/tools
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
docker/docker-agent#3929 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
area/api area/runtime
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
docker/docker-agent#4951 ·
メンテナーはふだん 1 日以内に返信
docker/docker-agent の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OneBusAway/maglev#2145 ·
メンテナーはふだん 2 日以内に返信
-
priority/medium status/ready type/chore
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
discobox-ai/discobox#1357 ·
メンテナーはふだん 1 日以内に返信
-
TestPseudoLocaleRemote fails now and then: it types the code before the laptop asks for it対応中かも @fzn0x が今日担当しました。 オープンbug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
enhancement ui/ux
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
jbigler/railswitch#243 ·
メンテナーはふだん 1 日以内に返信
-
Helm probes fail when DCGM Exporter requires TLS client certificates対応中かも @git-jxj が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NVIDIA/dcgm-exporter#775 ·
メンテナーはふだん 1 日以内に返信