openclaw - ✅(Solved) Fix [Bug] isAnnounceSkip strict equality misses multi-line agent outputs ending with ANNOUNCE_SKIP [3 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#74071Fetched 2026-04-30 06:28:59
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
cross-referenced ×4referenced ×2commented ×1

Fix Action

Fix / Workaround

This preserves the existing strict match and adds the realistic multi-line case. Running locally as a patch since 2026-04-14; no regressions observed.

PR fix notes

PR #74102: fix(announce): accept ANNOUNCE_SKIP on its own line in multi-line output

Description (problem / solution / changelog)

Before: strict equality trim() === ANNOUNCE_SKIP_TOKEN only matched when the entire output was the token.\n\nAfter: also matches when the trimmed text ends with a newline followed by ANNOUNCE_SKIP (the common case when sub-agents produce a summary followed by ANNOUNCE_SKIP on its own line).\n\nFix #74071

Changed files

  • src/agents/tools/sessions-send-tokens.ts (modified, +2/-1)

PR #74136: fix(agents): accept multi-line ANNOUNCE_SKIP on final line

Description (problem / solution / changelog)

Summary

  • Fix isAnnounceSkip() to also accept multi-line sub-agent output where ANNOUNCE_SKIP appears as the final line after a newline, not just as the sole content.
  • Add focused unit tests for sessions-send-tokens.ts covering exact, whitespace-padded, multi-line, and negative cases.
  • Add an e2e regression test for the multi-line announce-skip scenario.

Closes #74071

Problem

Sub-agents that produce a DM summary block followed by ANNOUNCE_SKIP on the final line had their entire summary leak into the parent session as an announcement. The strict equality check (text ?? "").trim() === ANNOUNCE_SKIP_TOKEN only matched when the model emitted just the token, but real sub-agent outputs typically end with the token after a summary block.

Fix

isAnnounceSkip() now checks two conditions:

  1. Exact match (existing): trimmed text equals the token
  2. Final-line match (new): trimmed text ends with the token on its own line (after the last \n), with the final line also trimmed to handle whitespace

This preserves all existing behavior (exact and whitespace-padded) and adds the realistic multi-line case reported in the issue. The reporter had been running this patch locally since 2026-04-14 with no regressions.

Test plan

  • pnpm test src/agents/tools/sessions-send-tokens.test.ts — 16 new focused unit tests (all pass)
  • pnpm test src/agents/subagent-announce.test.ts — 9 existing tests (all pass)
  • pnpm test src/agents/subagent-announce-output.test.ts — 3 existing tests (all pass)
  • pnpm test src/agents/openclaw-tools.sessions.test.ts — 15 existing tests (all pass)

Notes

  • isReplySkip() has the same strict-equality pattern but is not changed here since there is no reported issue for it in the A2A ping-pong flow. It could receive the same treatment in a follow-up if needed.
  • Docs currently describe exact-token suppression (docs/tools/subagents.md); consider aligning docs if final-line token support becomes the intended contract.

Changed files

  • src/agents/subagent-announce.format.e2e.test.ts (modified, +17/-0)
  • src/agents/tools/sessions-send-tokens.test.ts (added, +75/-0)
  • src/agents/tools/sessions-send-tokens.ts (modified, +10/-1)

PR #74157: fix(agents): accept ANNOUNCE_SKIP as final line of multi-line sub-agent reply (#74071)

Description (problem / solution / changelog)

Fixes #74071.

Problem

isAnnounceSkip and isReplySkip in src/agents/tools/sessions-send-tokens.ts use exact-equality on the trimmed full reply. The token spec says sub-agents should emit ANNOUNCE_SKIP to opt out of inter-session announcement.

In practice sub-agents (especially LLM-driven ones) emit a brief summary block followed by ANNOUNCE_SKIP on its own final line — the realistic shape, not the canonical lone-token form. With strict equality, that pattern fails the predicate, so the entire summary leaks to the parent session as an announcement instead of being suppressed.

Fix

Loosen isAnnounceSkip to accept either:

  1. The canonical lone-token form (existing strict-equality), OR
  2. The token as the standalone final line of a multi-line reply (split on newlines, last non-empty line trimmed equals the token)

isReplySkip semantics deliberately stay strict-equality — that path is for hard-suppress-the-whole-reply intent and the realistic shape there is the lone token.

Tests

New sessions-send-tokens.test.ts covers:

  • canonical lone-token form (regression)
  • multi-line reply with ANNOUNCE_SKIP final line (the new accept path)
  • multi-line reply with the token mid-string (rejected — only final line counts)
  • whitespace-only trailing lines after the token (still accepted)
  • isReplySkip strict semantics preserved across the same shapes

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/tools/sessions-send-tokens.test.ts (added, +59/-0)
  • src/agents/tools/sessions-send-tokens.ts (modified, +14/-1)

Code Example

function isAnnounceSkip(text) {
    return (text ?? "").trim() === ANNOUNCE_SKIP_TOKEN;
}

---

function isAnnounceSkip(text) {
    const t = (text ?? "").trim();
    return t === ANNOUNCE_SKIP_TOKEN || t.endsWith("\n" + ANNOUNCE_SKIP_TOKEN);
}
RAW_BUFFERClick to expand / collapse

Version: OpenClaw 2026.4.26 (also reproduced in 2026.4.21 / 2026.4.15)

File: dist/subagent-announce-output-V8Qd-Aa3.js (hash floats; the file containing function isAnnounceSkip)

Symptom

Sub-agents that produce a multi-line summary followed by ANNOUNCE_SKIP on the final line have their entire summary leak into the parent session as the announcement payload, defeating fire-and-forget semantics. Strict equality on text.trim() === ANNOUNCE_SKIP_TOKEN only matches when the model emits just the token, but real sub-agent outputs typically end with the token after a Discord/DM-summary block.

Repro

  1. Spawn a sub-agent (e.g. via sessions_spawn) with a brief that asks for a DM Summary followed by ANNOUNCE_SKIP on its own line.
  2. Observe that the parent session receives the full DM Summary text as an inter-session announcement, not silence.

Cause

isAnnounceSkip() checks only strict equality:

function isAnnounceSkip(text) {
    return (text ?? "").trim() === ANNOUNCE_SKIP_TOKEN;
}

If the trimmed text is "...summary text...\nANNOUNCE_SKIP", the check fails.

Suggested fix

Also accept the case where the trimmed text ends with the token after a newline:

function isAnnounceSkip(text) {
    const t = (text ?? "").trim();
    return t === ANNOUNCE_SKIP_TOKEN || t.endsWith("\n" + ANNOUNCE_SKIP_TOKEN);
}

This preserves the existing strict match and adds the realistic multi-line case. Running locally as a patch since 2026-04-14; no regressions observed.

extent analysis

TL;DR

Update the isAnnounceSkip function to also check if the trimmed text ends with the ANNOUNCE_SKIP_TOKEN after a newline.

Guidance

  • Review the isAnnounceSkip function to ensure it correctly handles multi-line summaries followed by ANNOUNCE_SKIP.
  • Verify that the updated function works as expected by testing it with different input scenarios, including single-line and multi-line summaries.
  • Consider adding additional test cases to cover various edge cases, such as empty input or input with leading/trailing whitespace.
  • Apply the suggested fix to the isAnnounceSkip function to preserve the existing strict match and add support for realistic multi-line cases.

Example

function isAnnounceSkip(text) {
    const t = (text ?? "").trim();
    return t === ANNOUNCE_SKIP_TOKEN || t.endsWith("\n" + ANNOUNCE_SKIP_TOKEN);
}

Notes

The suggested fix has been running locally as a patch since 2026-04-14 with no observed regressions, but it's still important to thoroughly test the updated function to ensure it works as expected in all scenarios.

Recommendation

Apply the workaround by updating the isAnnounceSkip function to also check for the ANNOUNCE_SKIP_TOKEN after a newline, as this fix has been tested locally with no regressions and addresses the specific issue described.

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…

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 [Bug] isAnnounceSkip strict equality misses multi-line agent outputs ending with ANNOUNCE_SKIP [3 pull requests, 1 comments, 2 participants]