Skip to content

Subagent returns opaque "(subagent produced no summary)" on StopNoProgress / empty StopEndTurn, discarding its work #152

Closed

Description

@JAORMX

Summary

A Subagent that ends a run with no final text on a StopNoProgress (or empty StopEndTurn) terminal returns the bare placeholder (subagent produced no summary) to the parent — with no explanation of why and no attempt to recover the work the child actually did across its turns. The parent loses everything the child found.

This violates the intended invariant (and the directive that a child should always return something recoverable, even on failure).

Where it happens

The salvage path that recovers a partial summary from an empty terminal only triggers on the limit/budget stops:

engine/agent/subagent.go — salvageEmptyLimitStop (issue #48):

func salvageEmptyLimitStop(...) (string, session.Usage) {
	if stop != session.StopMaxTurns && stop != session.StopMaxToolCalls && stop != session.StopBudget {
		return finalText, usage   // StopNoProgress / empty StopEndTurn fall straight through
	}
	...

When StopNoProgress (or StopEndTurn with empty finalText) reaches renderSubagentResult, it lands in the success family and produces the placeholder:

if strings.TrimSpace(body) == "" {
	body = "(subagent produced no summary)"
}

The note switch in renderSubagentResult also has no StopNoProgress case, so even the placeholder carries no "why".

Why it surfaced now

Observed live with a model-router config routing the large subagent category to z-ai/glm-5.2. Slow reasoning models are exactly the ones that emit reasoning-only / empty turns → get nudged (finishTurnNoTools) → exhaust MaxNoProgressNudges → terminate StopNoProgress with empty finalText. The faster deepseek-v4-pro ("medium") children finished cleanly; the glm-5.2 ("large") children returned empty. In a multi-wave fan-out this means whole branches of delegated work came back as (subagent produced no summary).

Proposed fix

  1. Extend the salvage trigger to also fire on StopNoProgress and empty StopEndTurn (rename salvageEmptyLimitStop → salvageEmptyStop); drive the same bounded one-turn wrap-up to extract a summary of what the child found.
  2. Add a StopNoProgress note in renderSubagentResult (e.g. [subagent stopped: ended without a final summary]) so the parent learns the reason.
  3. Last-resort fallback: if salvage still yields nothing, digest the child's last assistant/tool activity instead of the bare placeholder, so the work is never silently lost. (The team path already digests LastText/completed-task for non-recording members — precedent exists.)
  4. As part of the work, confirm there is no path where the Subagent result is truly empty (a raw Go error bubbling past the renderer rather than a rendered tool error).

All changes are confined to the failure path; the happy and limit paths are unchanged.

Acceptance

  • A subagent ending on StopNoProgress / empty StopEndTurn returns a non-empty, model-addressable result with the agentId: trailer, the stop reason, and salvaged-or-digested content.
  • Tests cover StopNoProgress and empty StopEndTurn salvage paths.

Related: #153 (Bash discards partial output on runner error) — failure paths discarding recoverable information is the shared anti-pattern. Builds on #48.

Activity

  1. added
    bug
    on Jun 23, 2026
  2. added a commit that references this issue on Jun 23, 2026
    0205b09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions