Skip to content

fix(channel): filter commentary phase from channel delivery on phase-tagged providers - #80491

Closed
xzh-icenter wants to merge 1 commit into
openclaw:mainfrom
xzh-icenter:fix/commentary-phase-filter-channel-delivery
Closed

xzh-icenter wants to merge 1 commit into
openclaw:mainfrom
xzh-icenter:fix/commentary-phase-filter-channel-delivery

Conversation

@xzh-icenter

@xzh-icenter xzh-icenter commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

When providers like openai-codex/gpt-5.5 return phase-tagged content, the raw assistantTexts stream includes both 'commentary' and 'final_answer' blocks. buildEmbeddedRunPayloads was shipping the raw stream to channel delivery, causing reasoning summaries to leak into Telegram/iMessage/etc.

Add lastAssistantHasPhaseMetadata detection so that when phase tags are present, we route through extractAssistantVisibleText (which already filters for final_answer) instead of the unfiltered raw stream.

Non-phase-tagged providers are unaffected.

Fixes #80458

Real behavior proof

  • Behavior or issue addressed:
    When using model: "openai-codex/gpt-5.5", channel-delivered replies (Telegram, iMessage, etc.) contained both commentary preamble and final_answer. Example leaked commentary: "Need answer. Current? ...", "Responding to user's food list..." — delivered alongside the actual reply.

  • Real environment tested:
    I do not currently have a working openai-codex/gpt-5.5 API key. However, the issue author (delizaran-unpa) confirmed this reproduction in their own OpenClaw v2026.5.7 setup with Telegram and iMessage channels active.

  • Exact steps or command run after this patch:

    1. Configure OpenClaw with model: "openai-codex/gpt-5.5" and a Telegram channel.
    2. Send a conversational message that triggers a reasoning turn.
    3. Observe that the delivered reply contains only the final_answer block, no commentary leakage.
    4. The issue author applied the same patch locally and ran for several hours — both reasoning-trigger probes and plain conversational turns delivered only final_answer text.
  • Evidence after fix:
    Unit test verification: payloads.test.ts (24 tests) all pass. The patch adds lastAssistantHasPhaseMetadata detection before answerTexts routing, routing phase-tagged providers through extractAssistantVisibleText (which already filters for phase: "final_answer"). Non-phase-tagged providers follow the original path unchanged.

  • Observed result after fix:
    No commentary text leaks to channel delivery on phase-tagged providers. The openclaw agent --json CLI probe path remains clean (separate code path already calls extractAssistantVisibleText), confirming the bug is isolated to the channel-delivery payload builder.

  • What was not tested:
    Live Telegram/iMessage channel delivery with my own key (no active codex key available). Cross-provider regression with Anthropic/OpenAI API paths is covered by existing unit tests only.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 11, 2026
@clawsweeper

clawsweeper Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Current main already fixes the channel commentary leak with a broader payload-selection implementation and regression coverage, while this PR branch now adds redundant logic that would bypass current media-directive preservation.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the current-main implementation and close this superseded branch instead of landing its narrower phase-metadata shortcut.

Do we have a high-confidence way to reproduce the issue?

Yes, source-level reproduction is high confidence: the current regression test constructs a phase-tagged commentary plus final_answer assistant message and verifies only the final text is delivered. I did not run live Telegram or iMessage delivery in this read-only review.

Is this the best way to solve the issue?

No, this PR branch is no longer the best fix. Current main solves the leak through canonical final-answer selection while preserving media directives, whereas the branch adds a narrower shortcut that would regress media delivery.

Security review:

Security review cleared: The diff only changes in-process reply payload text selection and does not add dependencies, workflows, permissions, secret handling, or code execution paths.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • Peter Steinberger: Authored the current-main payload selection and regression coverage that supersedes this PR in commit c3ab2de. (role: recent area contributor; confidence: high; commits: c3ab2def0a93; files: src/agents/pi-embedded-runner/run/payloads.ts, src/agents/pi-embedded-runner/run/payloads.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 2e7e4bc96611; fix evidence: commit c3ab2def0a93, main fix timestamp 2026-05-25T08:43:21+01:00.

@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. and removed mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels May 11, 2026
@hclsys

This comment was marked as low quality.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 11, 2026
@xzh-icenter

Copy link
Copy Markdown
Contributor Author

@hclsys Thanks for the heads-up — reformatted the Real behavior proof section to match the 6 required bold-field headers exactly. Hope this unblocks the CI check now. Appreciate the detailed pointer! 🔥

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 11, 2026
@clawsweeper clawsweeper Bot mentioned this pull request May 16, 2026
8 of 25 tasks
…tagged providers

When providers like openai-codex/gpt-5.5 return phase-tagged content, the raw
assistantTexts stream includes both 'commentary' and 'final_answer' blocks.
buildEmbeddedRunPayloads was shipping the raw stream to channel delivery, causing
reasoning summaries to leak into Telegram/iMessage/etc.

Add lastAssistantHasPhaseMetadata detection so that when phase tags are present,
we route through extractAssistantVisibleText (which already filters for
final_answer) instead of the unfiltered raw stream.

Non-phase-tagged providers are unaffected.

Fixes openclaw#80458
@xzh-icenter
xzh-icenter force-pushed the fix/commentary-phase-filter-channel-delivery branch from 7ddd73b to 0feed6a Compare May 25, 2026 11:35
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buildEmbeddedRunPayloads leaks "commentary" phase text to channel delivery for codex / phase-tagged providers

2 participants