Skip to content

fix(agents): mirror internal ui message tool replies#85564

Merged
giodl73-repo merged 3 commits into
openclaw:mainfrom
giodl73-repo:fix-85538-message-tool-source-replies
May 23, 2026
Merged

fix(agents): mirror internal ui message tool replies#85564
giodl73-repo merged 3 commits into
openclaw:mainfrom
giodl73-repo:fix-85538-message-tool-source-replies

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Capture successful message.send tool results that target the internal UI source reply sink.
  • Feed those captured source-reply payloads into the existing message-tool-only final payload mirror so openclaw tui receives visible output even when trailing assistant text is suppressed.
  • Preserve source-reply idempotency keys for retry/redelivery dedupe, keep dry-run and external-channel sends out of the mirror, and cover the regression with focused subscription/payload tests plus a PTY TUI proof test.

Verification

  • node scripts/run-vitest.mjs src/agents/pi-embedded-subscribe.handlers.tools.test.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.suppresses-message-end-block-replies-message-tool.test.ts
  • node scripts/run-vitest.mjs src/agents/pi-embedded-runner/run/payloads.test.ts src/agents/pi-embedded-runner/run/message-tool-terminal.test.ts
  • OPENCLAW_TUI_PTY_MIRROR_PATH=.artifacts/pr-85564/tui-source-reply.ansi OPENCLAW_TUI_PTY_COLS=100 OPENCLAW_TUI_PTY_ROWS=30 OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-harness.e2e.test.ts -t "renders message-tool-only internal ui source replies in the terminal" --reporter=verbose
  • OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_TEST_PROJECTS_SERIAL=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=120000 node scripts/run-vitest.mjs run src/agents/pi-embedded-subscribe.handlers.tools.test.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.suppresses-message-end-block-replies-message-tool.test.ts src/agents/pi-embedded-runner/run/payloads.test.ts src/agents/pi-embedded-runner/run/message-tool-terminal.test.ts --reporter=verbose
  • git diff --check
  • codex review --base origin/main
  • Testbox-through-Crabbox changed gate: provider=blacksmith-testbox, id=tbx_01ks96aeradhgnxgdxzd6qm4aj, Actions run=https://github.com/openclaw/openclaw/actions/runs/26319490160, command=corepack pnpm check:changed

Real behavior proof

Behavior addressed: TUI/internal UI message-tool-only turns no longer go silent after a successful message.send; the same message-tool source reply payload is mirrored into the final chat payload path.
Real environment tested: WSL checkout at /root/src/openclaw-85538 using the real runTui() PTY loop with a fake TuiBackend, plus Blacksmith Testbox through Crabbox on Linux for the changed gate.
Exact steps or command run after this patch: OPENCLAW_TUI_PTY_MIRROR_PATH=.artifacts/pr-85564/tui-source-reply.ansi OPENCLAW_TUI_PTY_COLS=100 OPENCLAW_TUI_PTY_ROWS=30 OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-harness.e2e.test.ts -t "renders message-tool-only internal ui source replies in the terminal" --reporter=verbose.
Evidence after fix: The PTY test passed and the ANSI mirror contained the visible terminal line VISIBLE_TUI_SOURCE_REPLY_PROOF; the fixture also asserted sourceReplyTranscriptMirror.text was VISIBLE_TUI_SOURCE_REPLY_PROOF before normalizing the payload into the chat final message shown by runTui().
Observed result after fix: openclaw tui's real terminal loop rendered the message-tool-only internal-ui source reply instead of an empty final turn, while the existing focused tests still prove successful internal-ui sends are captured, dry-run/external sends are excluded, and idempotency keys are preserved.
What was not tested: A live interactive Signal plus openclaw tui session with real channel credentials; the proof uses the production message-tool source-reply payload builder and real TUI PTY renderer without live Signal auth.

Fixes #85538.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-23 04:15 UTC / May 23, 2026, 12:15 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR captures successful internal-ui message.send source-reply payloads in embedded agent subscription state, carries them through attempt results, and adds focused agent/TUI PTY regression coverage plus a changelog entry.

Reproducibility: yes. Source inspection shows current main can produce internal-ui source replies for message-tool-only sends, while the subscription/attempt path does not carry those payloads into final TUI output before this PR; I did not run a live Signal plus TUI repro in this read-only review.

PR rating
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Summary: Good focused bug-fix PR with strong terminal proof and no blocking findings; the remaining gap is live channel coverage rather than patch quality.

Rank-up moves:

  • Before landing, maintainers should confirm current-head checks and decide whether the PTY proof is enough without live Signal credentials.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (terminal): The PR body reports after-fix PTY proof through the real runTui() loop with an ANSI mirror containing VISIBLE_TUI_SOURCE_REPLY_PROOF, plus focused tests and a Testbox changed gate.

Mantis proof suggestion
A short visible TUI capture would materially help reviewers confirm the terminal-rendering behavior, even though the PR proof is already sufficient. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify that a message-tool-only internal-ui agent reply is visible in openclaw tui and is not duplicated.

Risk before merge

  • Live Signal plus openclaw tui with real channel credentials remains untested; the accepted proof uses the production payload builder and real TUI PTY renderer with a fake backend.
  • Because this touches final message-delivery mirroring, maintainers should accept that the dry-run/external-send tests cover the main duplicate-delivery guard but not every live channel variant.

Maintainer options:

  1. Land after maintainer review (recommended)
    Merge after confirming the current head is green and accepting the PTY fake-backend proof for this internal-ui mirror path.
  2. Ask for live transport proof
    Require a live Signal plus openclaw tui run, or equivalent Mantis visual proof, before landing if maintainers want end-to-end transport coverage.
  3. Pause if the mirror contract is disputed
    Hold or close the PR only if maintainers decide message-tool-only internal UI replies need a different product contract.

Next step before merge
No ClawSweeper repair is queued because there are no blocking findings; the protected maintainer label and message-delivery proof scope need maintainer landing judgment.

Security
Cleared: The diff changes agent/TUI runtime wiring, tests, and changelog only; it adds no dependency, CI, credential, permission, package, or external code-execution surface.

Review details

Best possible solution:

Land the narrow source-reply wiring after maintainer review, current-head CI confirmation, and acceptance that live Signal credentials are outside this PR's proof scope.

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

Yes. Source inspection shows current main can produce internal-ui source replies for message-tool-only sends, while the subscription/attempt path does not carry those payloads into final TUI output before this PR; I did not run a live Signal plus TUI repro in this read-only review.

Is this the best way to solve the issue?

Yes. The patch uses the existing internal-source reply contract and final-payload mirror instead of adding a parallel delivery path, while preserving dry-run and external-send exclusions with focused tests.

Label changes:

  • add merge-risk: 🚨 message-delivery: The diff changes how successful message.send results are mirrored into final chat output, so a bad merge could duplicate, suppress, or misroute visible replies.

Label justifications:

  • P1: The PR fixes a recent regression where message-tool-only agent turns can make openclaw tui appear silent for real operator workflows.
  • merge-risk: 🚨 message-delivery: The diff changes how successful message.send results are mirrored into final chat output, so a bad merge could duplicate, suppress, or misroute visible replies.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🦞 diamond lobster, patch quality is 🐚 platinum hermit, and Good focused bug-fix PR with strong terminal proof and no blocking findings; the remaining gap is live channel coverage rather than patch quality.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports after-fix PTY proof through the real runTui() loop with an ANSI mirror containing VISIBLE_TUI_SOURCE_REPLY_PROOF, plus focused tests and a Testbox changed gate.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports after-fix PTY proof through the real runTui() loop with an ANSI mirror containing VISIBLE_TUI_SOURCE_REPLY_PROOF, plus focused tests and a Testbox changed gate.

What I checked:

  • Protected maintainer handling: The provided GitHub context shows this open PR has the protected maintainer label, so cleanup policy requires keeping it open for explicit maintainer handling.
  • Current main missing subscription state: Current main tracks sent messaging text, targets, and media in the embedded subscription state, but has no source-reply payload state before this PR's wiring. (src/agents/pi-embedded-subscribe.ts:183, 463929d794a2)
  • Existing internal source-reply contract: Current main's message action runner already returns deliveryStatus: sent, sourceReplySink: internal-ui, and a sourceReply payload for message-tool-only internal UI sends, which is the contract this PR consumes. (src/infra/outbound/message-action-runner.ts:700, 463929d794a2)
  • PR implementation captures source replies: The PR extracts only successful internal-ui source replies, preserves text/media/rich fields and idempotency keys, and appends them to messagingToolSourceReplyPayloads after successful message sends. (src/agents/pi-embedded-subscribe.handlers.tools.ts:460, 742faf1dd124)
  • PR carries payloads into attempt results: The PR reads getMessagingToolSourceReplyPayloads(), counts those payloads as synthesized output, and returns them for the existing final-payload mirror path. (src/agents/pi-embedded-runner/run/attempt.ts:4708, 742faf1dd124)
  • Focused regression tests: The PR adds tests proving successful internal-ui source replies are committed while dry-run and external sends are excluded. (src/agents/pi-embedded-subscribe.handlers.tools.test.ts:1411, 742faf1dd124)

Likely related people:

  • steipete: Git blame ties the existing message-tool-only source-reply payload mirror and internal source-reply send contract to commit 0622fb6 by Peter Steinberger. (role: introduced source-reply contract; confidence: high; commits: 0622fb6d90a1, e510042870cf; files: src/agents/pi-embedded-runner/run/payloads.ts, src/infra/outbound/message-action-runner.ts, extensions/codex/src/app-server/dynamic-tools.ts)
  • Jason (Json): Recent history on the embedded attempt runner shows commit c08400e touching src/agents/pi-embedded-runner/run/attempt.ts, the path this PR extends to carry source-reply payloads. (role: recent area contributor; confidence: medium; commits: c08400ea7d5d; files: src/agents/pi-embedded-runner/run/attempt.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 463929d794a2.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Pearl Branchling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: sparkles near resolved comments.
Image traits: location workflow harbor; accessory shell-shaped keyboard; palette pearl, teal, and neon green; mood bright-eyed; pose holding its accessory up for inspection; shell smooth pearl shell; lighting subtle sparkle highlights; background little resolved-comment flags.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Pearl Branchling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated the branch with a durable openclaw tui PTY proof test. The new test drives the real runTui() terminal loop, asserts the message-tool source reply payload carries sourceReplyTranscriptMirror, and verifies the terminal mirror contains VISIBLE_TUI_SOURCE_REPLY_PROOF.

Verification added to the PR body:

  • OPENCLAW_TUI_PTY_MIRROR_PATH=.artifacts/pr-85564/tui-source-reply.ansi OPENCLAW_TUI_PTY_COLS=100 OPENCLAW_TUI_PTY_ROWS=30 OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-harness.e2e.test.ts -t "renders message-tool-only internal ui source replies in the terminal" --reporter=verbose
  • existing focused agent/payload suite rerun: 144 passed
  • git diff --check
  • codex review --uncommitted

@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 23, 2026
@giodl73-repo giodl73-repo force-pushed the fix-85538-message-tool-source-replies branch from ebc27e3 to 742faf1 Compare May 23, 2026 04:06
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated and force-pushed the rebased branch at 742faf1dd1245064e73ff1c3d663e4c7dcc521ad.

Changes since the earlier review:

  • Added a durable openclaw tui PTY proof test for the message-tool-only internal UI source reply path.
  • Preserved source-reply idempotency keys from tool result details/sourceReply so transcript mirrors can dedupe retries.
  • Rebased on latest origin/main and resolved the changelog conflict.

Verification after the final patch:

  • git diff --check
  • OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_TEST_PROJECTS_SERIAL=1 OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=120000 node scripts/run-vitest.mjs run src/agents/pi-embedded-subscribe.handlers.tools.test.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.suppresses-message-end-block-replies-message-tool.test.ts src/agents/pi-embedded-runner/run/payloads.test.ts src/agents/pi-embedded-runner/run/message-tool-terminal.test.ts --reporter=verbose - 144 tests passed
  • OPENCLAW_TUI_PTY_MIRROR_PATH=.artifacts/pr-85564/tui-source-reply.ansi OPENCLAW_TUI_PTY_COLS=100 OPENCLAW_TUI_PTY_ROWS=30 OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-pty-harness.e2e.test.ts -t "renders message-tool-only internal ui source replies in the terminal" --reporter=verbose - PTY proof passed and rendered VISIBLE_TUI_SOURCE_REPLY_PROOF
  • codex review --base origin/main - no actionable correctness issues found

@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label May 23, 2026
@giodl73-repo giodl73-repo merged commit d7a078f into openclaw:main May 23, 2026
173 of 175 checks passed
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(agents): mirror internal ui message tool replies

* test(tui): prove internal source reply rendering

* fix(agents): preserve source reply idempotency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression 2026.5.20] TUI responses invisible for agents configured with Signal (message-tool-only turns now silenced by #84289)

2 participants