openclaw - 💡(How to fix) Fix [Bug]: Subagent completion announce leaks internal runtime context into Control UI chat and persists it in session history [1 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#62306Fetched 2026-04-08 03:06:17
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Subagent completion announce delivery can leak raw internal OpenClaw runtime context into user-visible chat in Control UI/webchat, and the leaked content is persisted into session history as real inbound messages instead of being treated as internal-only event data.

Root Cause

Subagent completion announce delivery can leak raw internal OpenClaw runtime context into user-visible chat in Control UI/webchat, and the leaked content is persisted into session history as real inbound messages instead of being treated as internal-only event data.

Code Example

<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>
OpenClaw runtime context (internal):
This context is runtime-generated, not user-authored. Keep internal details private.

[Internal task completion event]
source: subagent
session_key: agent:living-artificial:subagent:...
status: completed successfully
...
Action:
A completed subagent task is ready for user delivery. Convert the result above into your normal assistant voice and send that user-facing update now.
<<<END_OPENCLAW_INTERNAL_CONTEXT>>>
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

Subagent completion announce delivery can leak raw internal OpenClaw runtime context into user-visible chat in Control UI/webchat, and the leaked content is persisted into session history as real inbound messages instead of being treated as internal-only event data.

Steps to reproduce

  1. Use OpenClaw Control UI / webchat with a main session.
  2. Spawn or run a subagent that completes and announces its result back to the main session.
  3. Let the subagent complete while the main session remains active in webchat.
  4. Observe the resulting messages in the chat transcript.

Expected behavior

When a subagent completes:

  • the main session should receive one clean internal completion event
  • OpenClaw should convert that into one normal assistant reply for the user
  • internal markers such as <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>, internal task metadata, stats, and action instructions should never be shown in user-visible chat
  • internal completion payloads should never be stored as normal inbound user messages in session history

Actual behavior

In webchat / Control UI, raw internal completion content is exposed directly in the chat transcript, including text like:

  • <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>
  • OpenClaw runtime context (internal):
  • [Internal task completion event]
  • Action: A completed subagent task is ready for user delivery...

The leaked content is not only rendered in the UI. It is also persisted in the session JSONL as inbound messages, so it pollutes transcript history and context.

In the reproduced case, multiple related completion/handoff messages were injected in sequence for the same completion chain, creating repeated or near-duplicate user-visible messages.

OpenClaw version

2026.4.5 (3e72c03)

Operating system

Ubuntu Linux 6.17.0-20-generic (x64)

Install method

npm global

Logs, screenshots, and evidence

Verified locally in session transcripts:

  1. Main session transcript contains the leaked internal block as a stored inbound message, not only a frontend render artifact.
  2. Related agent session shows the same completion chain arriving via inter-session / subagent announce delivery.
  3. Multiple announce/handoff messages for the same completion chain were delivered in sequence.

Representative leaked content included:

<<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>
OpenClaw runtime context (internal):
This context is runtime-generated, not user-authored. Keep internal details private.

[Internal task completion event]
source: subagent
session_key: agent:living-artificial:subagent:...
status: completed successfully
...
Action:
A completed subagent task is ready for user delivery. Convert the result above into your normal assistant voice and send that user-facing update now.
<<<END_OPENCLAW_INTERNAL_CONTEXT>>>

Representative provenance from related session history indicated inter-session delivery from subagent completion / announce paths.

Impact and severity

Severity: High

Impact:

  • leaks internal runtime/meta content into user-visible chat
  • stores leaked internal payloads in session history
  • pollutes future model context
  • creates confusing repeated completion messages
  • makes Control UI/webchat transcripts unreliable and noisy during subagent workflows

Additional information

This appears related to, but distinct from, existing delivery-mirror / webchat duplication issues such as:

  • #39469
  • #33263
  • #5964
  • #17122
  • #30604
  • #26034

Observed behavior suggests a failure in the subagent completion announce transformation path: raw internal completion payload is being forwarded into chat instead of being converted into a single clean assistant response before persistence/delivery.

This was reproduced on a system already running a newer version than several previously reported webchat duplication bugs, so it may be a remaining or neighboring bug in subagent completion announce handling specifically.

extent analysis

TL;DR

The most likely fix involves modifying the subagent completion announce transformation path to properly convert internal completion events into clean assistant responses before delivery and persistence.

Guidance

  • Review the subagent completion announce handling code to identify where the internal completion payload is being forwarded into chat without proper conversion.
  • Verify that the transformation logic is correctly filtering out internal markers and metadata, such as <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>> and [Internal task completion event].
  • Check the session history persistence logic to ensure that only user-facing messages are stored, and internal completion payloads are not persisted as inbound messages.
  • Investigate the relationship between this issue and existing delivery-mirror/webchat duplication issues, such as #39469 and #33263, to determine if there are any shared root causes or fixes.

Example

No specific code snippet can be provided without more information about the implementation, but the fix will likely involve modifying the subagent completion announce transformation logic to properly handle internal completion events.

Notes

The fix may require changes to the OpenClaw runtime context handling, subagent completion announce delivery, or session history persistence logic. It is also possible that this issue is related to existing bugs, and fixing those may also resolve this issue.

Recommendation

Apply a workaround to modify the subagent completion announce transformation path to properly convert internal completion events into clean assistant responses before delivery and persistence, as this is the most likely root cause of the issue.

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 a subagent completes:

  • the main session should receive one clean internal completion event
  • OpenClaw should convert that into one normal assistant reply for the user
  • internal markers such as <<<BEGIN_OPENCLAW_INTERNAL_CONTEXT>>>, internal task metadata, stats, and action instructions should never be shown in user-visible chat
  • internal completion payloads should never be stored as normal inbound user messages in session history

Still need to ship something?

×6

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

Back to top recommendations

TRENDING