Skip to content

transfer_task: retry once on "model stream stalled" errors; ApplyModelOverrides should inherit parallel_tool_calls #4232

Description

@derekmisler

Problem

Long-running sub-agent delegations (e.g. the PR-review drafter in docker/docker-agent-action) intermittently fail with:

Error calling tool: model failed: model stream stalled after 5m0s with no data: model stream stalled: no data received from upstream

The Anthropic API stream stalls during complex diff analysis, transfer_task times out and returns a tool error, and the review pipeline posts a "⚠️ Review incomplete" notice. Manual re-runs always succeed — the stall is transient.

Investigation Details

Error Evidence

The exact error string is confirmed in:

  • docker/sandboxes workflow run 34491896878 (PR 5931, Windows socket path changes—large complex diff): drafter stalled for >5 minutes during transfer_task delegation
  • PR 5795 (Sept 10 re-review at 17:15:51): same stream stall pattern

Prevalence

14 of 20 recently reviewed docker/sandboxes PRs (as of Sept 10) were affected by incomplete or false-fallback reviews. Breaking down the 20-PR sample:

  • 11 PRs had agent-posted ### ⚠️ Review incomplete (drafter failed via stream stall or other model failure)
  • 11 PRs had false shell-side ⚠️ Review did not complete fallbacks (separate root cause: {pr} template bug—see below)
  • Many PRs eventually obtained successful reviews on retry

Release Timeline & Context

  • v2.0.6 (Sept 4, docker-agent v1.131.0): introduced a transfer_task race in parallel delegation that caused placeholder output; this is RESOLVED in v2.0.7
  • v2.0.7 (Sept 8, docker-agent v1.136.0): added parallel_tool_calls: false + sequential delegation prompt to fix the race; replaced false LGTM fallback with explicit ⚠️ Review did not complete notice
  • docker/sandboxes workflow: pinned to v2.0.7 (bd672e0d95c61bb79e899f1ea71d44e19b12f91f) as of Sept 8; overrides the root model with claude-sonnet-5,root=claude-opus-5

The stream stalls are NOT caused by the v2.0.6 race (that is fixed). Stream stalls are a separate, ongoing failure mode at the Anthropic API level during complex diff analysis.

Model Override Bypass Issue

When docker/sandboxes passes --model anthropic/claude-sonnet-5,root=anthropic/claude-opus-5, docker-agent's ApplyModelOverrides() in pkg/config/overrides.go creates new model config entries via ensureSingleModelExists() that do NOT inherit the parallel_tool_calls: false setting from the base named model config. The overridden configs start from scratch (only populated fields from the model ref string), so they lack behavioral flags from the original. However, this does not explain the current stream stalls—the prompt-level sequential delegation instruction (v2.0.7 defense-in-depth) applies regardless. This is a separate hardening issue (see Proposed fixes, item 2).

Log Excerpts Supporting Retry Recommendation

From run 34491896878 verbose log (PR 5931):

transfer_task response → "Error calling tool: model failed: 
model stream stalled after 5m0s with no data: model stream stalled: 
no data received from upstream"

The drafter exited with no results. Root agent correctly classified this as review_complete: false and posted the incomplete-review notice. Manual PR re-request (Sept 10) obtained a full review successfully—confirming transient nature.

Related: False Double-Post (separate docker-agent-action bug)

The secondary issue of false ⚠️ Review did not complete fallbacks is caused by a bug in docker-agent-action's posting template (posting-format.md line 121), which uses {pr} as a placeholder in the gh api URL. This is NOT a gh CLI template variable (gh only substitutes {owner} and {repo}), so the initial POST fails with HTTP 404. The agent retries with the explicit PR number and succeeds, but the retry logs only {id, state} (no html_url), so the action.yml grep for pullrequestreview-[0-9]+ misses it and fires a false fallback. This is being tracked separately (docker-agent-action PR #111).

Proposed Fixes

  1. In transfer_task, automatically retry ONE time when the model call fails with a model stream stalled error before surfacing the tool error. Transient stalls virtually always succeed on re-request.
  2. Related hardening: ApplyModelOverrides creates new model configs that do not inherit parallel_tool_calls: false from the base config, silently bypassing that setting whenever consumers pass a --model override (e.g. docker/sandboxes uses claude-sonnet-5,root=claude-opus-5). Overridden model configs should inherit parallel_tool_calls (and similar behavioral flags) from the config they override.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/modelsLLM model integrations and model providersarea/providers/anthropicFor features/issues/fixes related to the usage of Anthropic modelsarea/toolsFor features/issues/fixes related to the usage of built-in and MCP tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions