openclaw - ✅(Solved) Fix [Bug]: Haiku outputs with formatted tables/structured text crash webchat session [1 pull requests, 1 comments, 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#58631Fetched 2026-04-08 01:59:53
View on GitHub
Comments
1
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2labeled ×2referenced ×2

When Haiku generates formatted output (containing tables, box-drawing characters, or structured multi-line text), the webchat session crashes and loses the message. Sonnet's output with the same content structure works fine.

Root Cause

When Haiku generates formatted output (containing tables, box-drawing characters, or structured multi-line text), the webchat session crashes and loses the message. Sonnet's output with the same content structure works fine.

Fix Action

Fixed

PR fix notes

PR #58641: Webchat: preserve rewritten stream snapshots

Description (problem / solution / changelog)

Summary

Fix the webchat streaming path so assistant text revisions are treated as replacement snapshots instead of being silently dropped. This keeps rewritten structured replies, including table-like output, visible during streaming and after history refresh.

Repro Steps

  1. Use a model that rewrites earlier characters while producing structured output.
  2. Request a response with table-like or aligned multiline text.
  3. Observe that the streaming path can rewind from an earlier snapshot to a shorter corrected one.
  4. Before this change, the agent stream suppressed that correction and the webchat controller also rejected shorter replacement snapshots.

Root Cause

The assistant streaming pipeline assumed visible text only ever grew monotonically.

  • src/agents/pi-embedded-subscribe.handlers.messages.ts dropped updates when cleaned text no longer started with the previous cleaned snapshot.
  • ui/src/ui/controllers/chat.ts ignored chat deltas when the next visible snapshot was shorter than the current one.
  • src/gateway/openresponses-http.ts also needed to keep its accumulated text in sync when replacement snapshots occur.

Behavior Changes

  • Emit assistant replacement snapshots instead of suppressing rewritten stream updates.
  • Let the webchat controller replace the current stream with shorter corrected snapshots.
  • Keep OpenResponses' accumulated text aligned with replacement snapshots.
  • Add regressions for the rewind case in both the agent stream and the webchat controller.

Codebase and GitHub Search

  • Related issue: #58631
  • Code paths reviewed: src/agents/pi-embedded-subscribe.handlers.messages.ts, ui/src/ui/controllers/chat.ts, ui/src/ui/chat/message-extract.ts, ui/src/ui/chat/grouped-render.ts, ui/src/ui/markdown.ts, src/gateway/openresponses-http.ts
  • Existing tests reviewed: src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.subscribeembeddedpisession.e2e.test.ts, ui/src/ui/controllers/chat.test.ts, ui/src/ui/markdown.test.ts

Tests

  • Passed: pnpm exec vitest run --config vitest.config.ts src/ui/controllers/chat.test.ts src/ui/chat/message-extract.test.ts src/ui/markdown.test.ts
  • Failed outside this change: pnpm check currently reports repo-wide format-check failures across many files.
  • Failed outside this change: pnpm build currently fails in vendor/a2ui/renderers/lit/src/0.8/model.test.ts during canvas:a2ui:bundle with missing Node builtin type names.
  • Failed outside this change: pnpm exec vitest run --config vitest.e2e.config.ts src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.subscribeembeddedpisession.e2e.test.ts currently aborts before running tests with getOAuthProviders is not a function.

Manual Testing

Not run locally beyond the targeted automated regression coverage above.

Sign-Off

  • Models used: GPT-5.4
  • Submitter effort: investigated the reported repro path, implemented a focused fix, and ran targeted validation.
  • Agent notes: AI-assisted change; lightly tested with targeted UI regressions and issue/code-path review. lobster-biscuit

Made with Cursor

Changed files

  • src/agents/pi-embedded-subscribe.handlers.messages.ts (modified, +9/-5)
  • src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.subscribeembeddedpisession.e2e.test.ts (modified, +7/-2)
  • src/gateway/openresponses-http.ts (modified, +8/-4)
  • ui/src/ui/controllers/chat.test.ts (modified, +19/-0)
  • ui/src/ui/controllers/chat.ts (modified, +2/-5)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When Haiku generates formatted output (containing tables, box-drawing characters, or structured multi-line text), the webchat session crashes and loses the message. Sonnet's output with the same content structure works fine.

Steps to reproduce

1- Set model to Haiku (/model haiku) 2- Request a report that includes formatted tables or structured output 3- Haiku generates the response 4- Chat window loses the message (message disappears, session stays active)

Example that triggers bug: Generate a token consumption report with:

  • A table of job names, models, schedules, and estimated tokens
  • Daily/monthly calculations
  • Cost breakdown

Expected behavior

Message should display in chat and remain in session history.

Actual behavior

Message disappears, chat becomes unresponsive to further input. Subsequent messages (from other models) work fine.

OpenClaw version

OpenClaw version: 2026.3.28

Operating system

Ubuntu 24.04 on VM for the Openclaw host / Windows through http://localhost:18789/ for the chat

Install method

npm global

Model

Claude Haiku 4.5

Provider / routing chain

openclaw => http://localhost:18789/chat?session=main

Additional provider/model setup details

Sonnet generates identical content structure without issue Bug is Haiku-specific, not output-size-related (2.3KB is tiny) Occurs after recent gateway restarts and config changes Orphan session files were cleaned up, lock files removed

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can likely be resolved by modifying Haiku's output formatting to prevent it from crashing the webchat session.

Guidance

  • Investigate Haiku's table and structured output generation to identify potential issues with the formatting that may be causing the webchat session to crash.
  • Compare Haiku's output with Sonnet's output to determine if there are any differences in the formatting that could be contributing to the problem.
  • Test Haiku's output with simpler formatting to see if the issue is specific to certain types of output (e.g. tables, box-drawing characters).
  • Verify that the issue is not related to the output size, as the 2.3KB size mentioned is relatively small.
  • Check the OpenClaw configuration and gateway settings to ensure that there are no recent changes that could be causing the issue.

Example

No code snippet is provided as the issue does not contain enough information to create a specific example.

Notes

The issue seems to be specific to Haiku and not related to the output size. The fact that Sonnet generates identical content structure without issue suggests that the problem may be with Haiku's output formatting.

Recommendation

Apply a workaround by modifying Haiku's output formatting to prevent it from crashing the webchat session, as the root cause of the issue is likely related to Haiku's specific implementation.

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

Message should display in chat and remain 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