Skip to content

fix(gateway): preserve mixed assistant history text#78157

Merged
BunsDev merged 1 commit intomainfrom
meow/fix-control-ui-history-projection-77374
May 6, 2026
Merged

fix(gateway): preserve mixed assistant history text#78157
BunsDev merged 1 commit intomainfrom
meow/fix-control-ui-history-projection-77374

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 6, 2026

Summary

Fixes #77374.

Verification

  • pnpm test src/gateway/server-methods/server-methods.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts - passed, 2 files / 100 tests.
  • pnpm exec oxfmt --check --threads=1 src/gateway/chat-display-projection.ts src/gateway/server-methods/server-methods.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts - passed.
  • git diff --check - passed.
  • pnpm changed:lanes --json - selected core, coreTests, docs for the four-file patch.
  • Testbox pnpm check:changed - passed on tbx_01kqxc13vce62hpyv3kza2ne19 / https://github.com/openclaw/openclaw/actions/runs/25410429032. Note: the Testbox sync reported 1230 changed files and selected lanes=all; the local diff remained the intended four files.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: M maintainer Maintainer-authored PR labels May 6, 2026
@BunsDev BunsDev self-assigned this May 6, 2026
@BunsDev BunsDev requested a review from Copilot May 6, 2026 00:50
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 6, 2026

Codex review: needs maintainer review before merge.

Summary
This PR updates Gateway chat.history display projection to preserve text from assistant transcript turns that also include tool-use metadata, adds unit and JSONL-backed regressions, and records the fix in the changelog.

Reproducibility: yes. by source inspection: current main drops commentary-phase assistant messages and filters phased assistant text down to final_answer, so a mixed tool-call turn with only commentary-signed visible text can disappear from chat.history. I did not run a live UI scenario in this read-only pass.

Real behavior proof
Not applicable: Not applicable because this is a repository-member PR; the external-contributor real-behavior proof gate does not apply.

Next step before merge
Maintainer-labeled member PR needs human merge handling and CI completion; there is no narrow ClawSweeper repair to queue.

Security
Cleared: The diff is limited to Gateway display projection, tests, and changelog text; it does not add dependency, workflow, secret, permission, artifact-download, or package-resolution risk.

Review details

Best possible solution:

Land this focused projection fix after maintainer review and exact-head checks finish, then handle any remaining provider-specific disappearing-history shape as a separate follow-up.

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

Yes by source inspection: current main drops commentary-phase assistant messages and filters phased assistant text down to final_answer, so a mixed tool-call turn with only commentary-signed visible text can disappear from chat.history. I did not run a live UI scenario in this read-only pass.

Is this the best way to solve the issue?

Yes for the mixed tool-use transcript shape: projecting non-empty text out of assistant turns that include tool history keeps durable progress visible while pure commentary-only turns stay hidden. It should not be treated as the complete answer for a separate provider-specific reasoning_content variant unless that is reproduced and covered separately.

What I checked:

Likely related people:

  • steipete: GitHub path history shows fix(gateway): unify chat display projection and the later private limiter refactor on the central projection file; local blame of the shallow checkout also routes the current projection functions through Peter Steinberger. (role: introduced and recent maintainer of the display projection seam; confidence: high; commits: 5f2273e81efc, a7237ea44fc0, 419bcd26f079; files: src/gateway/chat-display-projection.ts, docs/web/webchat.md)
  • BunsDev: Beyond proposing this PR, current-main history includes prior merged active WebChat send dedupe and local session continuity work in the same chat/history surface. (role: adjacent Gateway/WebChat maintainer; confidence: high; commits: bd2f8560fee6, cb9d7884cca3; files: src/gateway/server-methods/chat.ts, src/gateway/server.chat.gateway-server-chat-b.test.ts, docs/web/webchat.md)
  • vincentkoc: Recent current-main history includes bounded chat.history transcript read work in the Gateway server method path. (role: recent adjacent maintainer; confidence: medium; commits: aec83af23d49; files: src/gateway/server-methods/chat.ts)
  • frankekn: Merged PR Fix WebChat display for Codex-generated local media #77889 changed WebChat display handling in src/gateway/server-methods/chat.ts immediately before this PR's base area. (role: recent adjacent WebChat display maintainer; confidence: medium; commits: 1ddc2650c6e2; files: src/gateway/server-methods/chat.ts)

Remaining risk / open question:

  • Exact-head CI was still in progress at inspection, so merge should wait for completion.
  • The linked issue may still contain a separate provider-specific reasoning_content disappearance shape that this mixed text/tool-use patch does not prove.
  • No live Control UI run was executed in this read-only review; reproduction is source-backed rather than live UI-backed.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Gateway chat.history regression where persisted assistant transcript turns that include both visible progress text and tool-use metadata were being filtered out (due to being classified as “commentary”), causing prior assistant messages to vanish from the Control UI after subsequent user messages.

Changes:

  • Adjust assistant-message projection to preserve visible assistant text when the same assistant turn also contains tool-use blocks.
  • Keep “pure commentary” assistant turns hidden to preserve existing Control UI filtering behavior.
  • Add unit + JSONL-backed gateway regression tests covering the mixed tool-use + visible text case (issue #77374), and document the fix in the changelog.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/gateway/chat-display-projection.ts Projects visible assistant text from mixed tool-use content so these assistant turns remain displayable, while still hiding pure commentary-only turns.
src/gateway/server-methods/server-methods.test.ts Adds unit coverage for mixed tool-use assistant messages retaining visible text, plus a regression asserting pure commentary remains hidden.
src/gateway/server.chat.gateway-server-chat-b.test.ts Adds JSONL-backed gateway regression test ensuring chat.history returns the assistant visible text for mixed tool-use transcript turns.
CHANGELOG.md Records the Control UI chat-history fix and references #77374.

@BunsDev
Copy link
Copy Markdown
Member Author

BunsDev commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

Resolved. The only conflict was in CHANGELOG.md — our fix entry and two new entries from main (Slack/Plugins) both inserted at the top of ### Fixes. I kept all three entries and finalized the merge commit 6966d3ee5a.

Copilot finished work on behalf of BunsDev May 6, 2026 02:11
@BunsDev BunsDev force-pushed the meow/fix-control-ui-history-projection-77374 branch from 9e6a02e to b71c86c Compare May 6, 2026 02:30
@BunsDev BunsDev force-pushed the meow/fix-control-ui-history-projection-77374 branch from b71c86c to 048266c Compare May 6, 2026 02:52
@BunsDev BunsDev merged commit 3110c62 into main May 6, 2026
110 checks passed
@BunsDev BunsDev deleted the meow/fix-control-ui-history-projection-77374 branch May 6, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Assistant messages disappear from Control UI after each new user message is sent

3 participants