-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: truncated assistant tool-call turn executes unintended sessions_spawn #97091
Copy link
Copy link
Closed
Closed
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PRMaintainer-authored PR
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PRMaintainer-authored PR
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
A streamed assistant turn that stopped at the output limit still committed and executed an incomplete
sessions_spawntool call, creating an unintended child session.Steps to reproduce
sessions_spawncalls.Observed live session:
2026-06-26T02:17:39.819Z, the assistant emitted visible text saying it would dispatch all five specialists in parallel.2026-06-26T02:17:44.026Z, an extrasessions_spawnresult was accepted for a child session with notaskName.2026-06-26T02:18:59.234Z, the parent identified the bad spawn as a truncated sixth spawn from an incomplete prompt and ignored its output.Expected behavior
Tool calls from a streamed assistant turn should only execute when the provider completed the turn as tool use. If the assistant turn ends because of length/max-token truncation, newly observed partial tool calls should not execute and should not be replayed as dangling assistant tool calls without matching tool results.
Actual behavior
The incomplete sixth
sessions_spawnwas accepted and ran as a child:Source context checked on current
mainbefore the fix:packages/agent-core/src/agent-loop.tsstreams assistant partials into context and replaces them withresponse.result()on terminal events.toolCallpresent in the returned assistant message, regardless of whether the assistantstopReasonwastoolUseorlength.max_tokensto OpenClawstopReason: "length".OpenClaw version
2026.6.9
Operating system
linux 6.6.114.1-microsoft-standard-WSL2 (x64)
Install method
Source checkout / local gateway
Model
github-copilot/claude-opus-4.7
Provider / routing chain
OpenClaw -> github-copilot -> claude-opus-4.7 using Anthropic Messages API
Additional provider/model setup details
Telegram channel parent session with OpenClaw subagents. Local logs show provider
github-copilot, model idclaude-opus-4.7, model APIanthropic-messages, Nodev26.3.0.Logs, screenshots, and evidence
Duplicate search:
Impact and severity
Affected: users of streamed agent tool calls, especially expensive or side-effectful tools such as subagent spawn.
Severity: High for harness safety/cost; an unintended child session executed side-effectful work for nearly eight minutes.
Frequency: Observed once in a live parent/subagent review session.
Consequence: wasted runtime/tool budget, noisy child completion events, and risk of unintended side effects if the partial tool call is not harmless.
Additional information
This report is about commit/execution behavior for truncated assistant tool-call turns. Separate reports cover the later missed parent wake-up and session-history recovery limitations after the incident.