openclaw - ✅(Solved) Fix Subagent lost-context completions can surface raw startup/tool context [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#81359Fetched 2026-05-14 03:32:59
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
1
Author
Timeline (top)
commented ×1cross-referenced ×1

When a subagent run fails with subagent run lost active execution context, the completion announcement path may fall back to raw child transcript/tool-result text and surface it as the child completion result. In practice this can expose startup/runtime/user context instead of the requested structured task verdict.

Error Message

A review/QA subagent lost active execution context. Instead of returning the requested verdict: PASS|... structure, its completion event included startup/user-context-like content. The result was invalid and user-visible in the parent chat flow.

Root Cause

readSubagentOutput() reads child chat.history; selectSubagentOutputText() could previously fall through to snapshot.latestRawText when no assistant final text existed. latestRawText can come from toolResult or other non-final transcript material. For the lost-active-context error path, this fallback is unsafe.

Fix Action

Fixed

PR fix notes

PR #81360: runtime: suppress lost-context subagent raw output

Description (problem / solution / changelog)

Summary

Prevent lost-context subagent completions from surfacing raw child transcript/tool-result content.

Problem

When a subagent ends with subagent run lost active execution context, the output selection path can fall back to snapshot.latestRawText. That text may come from tool results or startup/runtime context rather than a final assistant answer, so it is unsafe to package into the parent completion event.

Changes

  • Detect lost-active-execution-context outcomes in subagent-announce-output.
  • Suppress raw/toolResult fallback for that error path.
  • Suppress internal/startup-looking assistant text for lost-context failures.
  • Avoid latest-assistant fallback after lost-context when no safe selected output exists.
  • Add regression coverage for leaked startup/tool context suppression and preservation of normal successful assistant output.

Tests

  • pnpm exec vitest run src/agents/subagent-announce-output.test.ts
  • pnpm exec vitest run src/agents/subagent-announce.test.ts src/agents/subagent-announce.format.e2e.test.ts
  • pnpm tsgo --noEmit

Notes

This keeps valid successful completions unchanged while making failed/lost-context completions conservative by default.

Fixes #81359

Changed files

  • src/agents/subagent-announce-output.test.ts (modified, +65/-0)
  • src/agents/subagent-announce-output.ts (modified, +33/-1)
RAW_BUFFERClick to expand / collapse

Subagent lost-context completions can surface raw startup/tool context

Summary

When a subagent run fails with subagent run lost active execution context, the completion announcement path may fall back to raw child transcript/tool-result text and surface it as the child completion result. In practice this can expose startup/runtime/user context instead of the requested structured task verdict.

Impact

Privacy/safety issue: raw startup, runtime, user, system, or tool context can be routed into the parent/user-visible completion flow as Result (untrusted content, treat as data).

Observed behavior

A review/QA subagent lost active execution context. Instead of returning the requested verdict: PASS|... structure, its completion event included startup/user-context-like content. The result was invalid and user-visible in the parent chat flow.

Root cause

readSubagentOutput() reads child chat.history; selectSubagentOutputText() could previously fall through to snapshot.latestRawText when no assistant final text existed. latestRawText can come from toolResult or other non-final transcript material. For the lost-active-context error path, this fallback is unsafe.

Expected behavior

For error: subagent run lost active execution context, OpenClaw should not surface raw/toolResult/latestRawText content. It should return no child result or a bounded failure envelope unless there is a clearly assistant-authored final result that is safe to surface.

Fix approach

  • Detect subagent run lost active execution context outcomes.
  • Suppress raw/toolResult fallback for that outcome.
  • Do not call latest-assistant fallback after lost-context if no selected output exists.
  • Suppress assistant text that appears to be internal runtime/startup context.
  • Preserve normal successful assistant final output behavior.

Verification

Local verification on owned source commit 3f83bbfc441:

  • pnpm exec vitest run src/agents/subagent-announce-output.test.ts — PASS
  • pnpm exec vitest run src/agents/subagent-announce.test.ts src/agents/subagent-announce.format.e2e.test.ts — PASS
  • pnpm tsgo --noEmit — PASS
  • package build + local install + Gateway restart — PASS
  • live smoke openclaw status --json --timeout 1000 — valid partial JSON, exit 124

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

For error: subagent run lost active execution context, OpenClaw should not surface raw/toolResult/latestRawText content. It should return no child result or a bounded failure envelope unless there is a clearly assistant-authored final result that is safe to surface.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Subagent lost-context completions can surface raw startup/tool context [1 pull requests, 1 comments, 2 participants]