openclaw - ✅(Solved) Fix [Bug]: Subagent completion can be announced as timed out even when the child run finished successfully [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#75785Fetched 2026-05-02 05:30:13
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1

A subagent completion can be announced to the parent as timed out with a partial-progress stub even when the child run itself finished successfully.

Root Cause

A subagent completion can be announced to the parent as timed out with a partial-progress stub even when the child run itself finished successfully.

Fix Action

Fix / Workaround

  • Child session final state recorded:
    • status: success
    • timedOut: false
    • idleTimedOut: false
  • Parent completion handoff later announced the same child run as timed out and emitted a partial-progress stub instead of the child result.
  • The child trajectory also showed a large truncated event (trajectory-event-size-limit) before the bad parent-side announce.
  • Local hotfix that prevented the false timeout:
    • On agent.wait timeout in the subagent announce path, re-check the child session store status before finalizing the announce outcome.
    • If the child session is already done, treat the announce outcome as success instead of timeout.
  • Relevant source areas:
    • src/agents/subagent-announce-output.ts
    • src/agents/subagent-announce.ts

Observed on a subagent run that had already completed successfully but whose parent-side announce path still accepted a timeout result from the wait call. A local workaround was to reconcile timeout waits against the persisted child session status before announcing.

PR fix notes

PR #75786: fix(subagents): reconcile timed-out waits against child session state

Description (problem / solution / changelog)

Fixes #75785.

Summary

Reconcile timed-out agent.wait results against the persisted child session state before announcing subagent completion.

This fixes a false-timeout path where the child run can finish successfully, but the parent-side completion handoff still reports timed out and falls back to a partial-progress stub.

Problem / Motivation

The announce flow currently trusts the immediate agent.wait timeout result. In the observed failure mode, that timeout can be stale relative to the child session store state. When that happens, the parent announces a timeout even though the child session has already completed successfully.

What Changed

  • src/agents/subagent-announce-output.ts
    • waitForSubagentRunOutcome(runId, timeoutMs, sessionKey?) now optionally re-checks session-store state after a timeout
    • added helpers to load and interpret the child session entry
  • src/agents/subagent-announce.ts
    • pass childSessionKey into waitForSubagentRunOutcome(...)
    • do the same for the immediate recheck path
  • src/agents/subagent-announce.timeout.test.ts
    • adds a regression test covering a timed-out wait that should reconcile to persisted child success before announcing

Why this is the smallest reliable guardrail

The reconciliation only runs:

  • when agent.wait returns timeout
  • when the child session key is available
  • for a short bounded retry loop

Normal successful and failed paths are unchanged.

User-visible / Behavior Changes

Parent sessions stop receiving false timed out completion events for already-finished child runs in this path.

Diagram

Before:
child finishes successfully -> agent.wait returns timeout -> parent announces timeout -> actual child result is replaced by partial progress

After:
child finishes successfully -> agent.wait returns timeout -> announce flow rechecks child session state -> parent announces success -> child result is delivered

Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: Linux 6.8
  • Runtime/container: npm global install
  • Model/provider: openai-codex/gpt-5.4
  • Integration/channel: subagent completion announce path
  • Relevant config: default subagent announce flow with completion handoff enabled

Steps

  1. Spawn a subagent that performs many tool calls and completes successfully.
  2. Let the child session reach a terminal successful state.
  3. Have the parent-side announce flow observe agent.wait return timeout.
  4. Compare the child session state with the parent completion event.

Expected

  • Parent completion announce resolves to child success and includes the child result.

Actual

  • Parent completion announce can resolve to timeout and replace the child result with a partial-progress stub.

Evidence

  • Trace/log snippets
  • Failing test/log before + passing after
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification

  • Verified scenarios:
    • observed a child run with successful terminal state while the parent announce path still emitted a timeout result
    • applied equivalent reconciliation logic locally in the installed build and confirmed it corrected the announce outcome for that bug path
  • Edge cases checked:
    • no reconciliation path is used unless agent.wait returns timeout
    • still falls back to original timeout result if the child session store is not terminal
  • What I did not verify:
    • full upstream CI suite
    • multi-provider or multi-channel coverage beyond the local reproduction path

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: session-store terminal state could be briefly stale in the opposite direction
    • Mitigation: reconciliation runs only after a timeout and only upgrades the announce outcome when the child session entry is already terminal
  • Risk: additional small read on timeout path
    • Mitigation: only occurs on timeout, with a short bounded retry loop

Changed files

  • src/agents/subagent-announce-output.ts (modified, +92/-1)
  • src/agents/subagent-announce.timeout.test.ts (modified, +42/-0)
  • src/agents/subagent-announce.ts (modified, +10/-2)
RAW_BUFFERClick to expand / collapse

Summary

A subagent completion can be announced to the parent as timed out with a partial-progress stub even when the child run itself finished successfully.

Steps to reproduce

  1. Run OpenClaw 2026.4.25.
  2. Spawn a subagent that performs many tool calls and produces a large completion artifact.
  3. Let the child finish successfully.
  4. Observe the child session end state is success and timedOut: false.
  5. Observe the parent-side completion handoff can still announce timed out and replace the child result with a partial-progress message.

Expected behavior

When the child run finishes successfully, the parent completion handoff should announce success and deliver the child result instead of a timeout summary.

Actual behavior

In the observed case, the child session recorded a successful end state, but the parent completion handoff announced the child as timed out and delivered only a partial-progress stub.

OpenClaw version

2026.4.25

Operating system

Linux 6.8

Install method

npm global

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw -> openai-codex

Additional provider/model setup details

NOT_ENOUGH_INFO

Logs, screenshots, and evidence

  • Child session final state recorded:
    • status: success
    • timedOut: false
    • idleTimedOut: false
  • Parent completion handoff later announced the same child run as timed out and emitted a partial-progress stub instead of the child result.
  • The child trajectory also showed a large truncated event (trajectory-event-size-limit) before the bad parent-side announce.
  • Local hotfix that prevented the false timeout:
    • On agent.wait timeout in the subagent announce path, re-check the child session store status before finalizing the announce outcome.
    • If the child session is already done, treat the announce outcome as success instead of timeout.
  • Relevant source areas:
    • src/agents/subagent-announce-output.ts
    • src/agents/subagent-announce.ts

Impact and severity

Affected: parent-session delivery of subagent completions
Severity: Medium
Frequency: Observed once in a real run
Consequence: the parent receives a false timeout result and may discard the actual successful child output

Additional information

Observed on a subagent run that had already completed successfully but whose parent-side announce path still accepted a timeout result from the wait call. A local workaround was to reconcile timeout waits against the persisted child session status before announcing.

extent analysis

TL;DR

Re-check the child session store status before finalizing the announce outcome in the subagent announce path to prevent false timeouts.

Guidance

  • Review the agent.wait timeout handling in src/agents/subagent-announce-output.ts and src/agents/subagent-announce.ts to ensure it correctly checks the child session status.
  • Verify that the child session store status is correctly updated when the child run finishes successfully.
  • Consider adding a check for the trajectory-event-size-limit to prevent large truncated events from causing issues.
  • Test the local hotfix that prevented the false timeout to ensure it resolves the issue.

Example

// src/agents/subagent-announce-output.ts
if (childSessionStore.getStatus() === 'done') {
  // Treat the announce outcome as success instead of timeout
  announceOutcome = 'success';
} else {
  // Handle timeout as before
}

Notes

The provided local hotfix suggests that re-checking the child session store status before finalizing the announce outcome can prevent false timeouts. However, the root cause of the issue may still need to be investigated to ensure this fix is sufficient.

Recommendation

Apply the workaround by re-checking the child session store status before finalizing the announce outcome, as it has been shown to prevent false timeouts in the observed case.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When the child run finishes successfully, the parent completion handoff should announce success and deliver the child result instead of a timeout summary.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING