Skip to content

fix(webchat): render read tool output and fix exec output overflow + migrateLinearTranscript idempotent#77076

Open
z0650115 wants to merge 4 commits intoopenclaw:mainfrom
z0650115:fix/telegram-http-timeout-ms-v2
Open

fix(webchat): render read tool output and fix exec output overflow + migrateLinearTranscript idempotent#77076
z0650115 wants to merge 4 commits intoopenclaw:mainfrom
z0650115:fix/telegram-http-timeout-ms-v2

Conversation

@z0650115
Copy link
Copy Markdown

@z0650115 z0650115 commented May 4, 2026

Summary

This PR contains two fixes:

Fix 1: WebChat session transcript overwritten every turn (fixes #77012)

Makes migrateLinearTranscriptToParentLinked idempotent by collecting existing IDs before processing.

Fix 2: Control UI webchat tool output issues (fixes #77054)

Bug 1 - read tool output not rendered:

  • extractToolText() in tool-cards.ts only handled item.text and item.content as strings
  • Modern tool results have item.content as array: [{ type: 'text', text: '...' }]
  • Added array content block handling to extract text from nested blocks

Bug 2 - exec output text clipped:

  • .chat-tool-card had overflow:hidden which clipped long content when max-height exceeded
  • Changed to overflow:auto to allow scrolling

Files Changed

  • ui/src/ui/chat/tool-cards.ts - extractToolText array handling
  • ui/src/styles/chat/tool-cards.css - overflow:hidden to overflow:auto
  • ui/src/ui/chat/tool-cards.test.ts - new tests

张小波 added 2 commits May 4, 2026 11:22
Expose httpTimeoutMs in Telegram network config (similar to Feishu implementation)
to allow users to reduce the probe timeout for faster fail-fast when Telegram is
unreachable due to IPv6 issues or high latency.

Users can now configure:
  channels.telegram.network.httpTimeoutMs: 5000  # 5 second timeout

This prevents the gateway event loop from blocking for 10-15 seconds when the
Telegram health probe encounters IPv6 blackhole issues.

Fixes openclaw#77060
Fix for issue openclaw#77012 - WebChat session transcript overwritten every turn.

The migration function was not idempotent - running it multiple times
would regenerate IDs for entries that already had valid IDs, breaking
the parent chain and causing entries to become orphaned.

The root cause was that existingIds was an empty Set at the start of
each migration run. When processing entries, if an entry already had
an ID but that ID wasn't in existingIds (because existingIds was empty),
a new ID would be generated. This would break the parentId chain since
the parentId would still point to the old ID.

Fix by:
1. First pass: collect all existing IDs from the file
2. Initialize existingIds with these IDs so they're preserved
3. Only assign new IDs to entries that don't have valid existing IDs

This ensures that running migration multiple times produces the same
result, preventing orphaned entries and broken parent chains.
@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels May 4, 2026
Fixes issue openclaw#77054:

1. Bug 1 - read tool output not rendered:
   - extractToolText() only handled item.text and item.content as strings
   - Modern tool results have item.content as array: [{ type: 'text', text: '...' }]
   - Added array content block handling to extract text from nested blocks

2. Bug 2 - exec output text clipped:
   - .chat-tool-card had overflow:hidden which clipped long content
   - Changed to overflow:auto to allow scrolling when content exceeds max-height

Added tests for extractToolCards with array content blocks.
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label May 4, 2026
@z0650115 z0650115 changed the title fix: make migrateLinearTranscriptToParentLinked idempotent (fixes #77012) fix(webchat): render read tool output and fix exec output overflow + migrateLinearTranscript idempotent May 4, 2026
Fixes issue openclaw#77063: lossless-claw selected and enabled but not registered
as context engine after plugin cache restore.

Root cause: When a cached plugin registry is reused, the cached state
restoration restores agent harnesses, commands, compaction providers, and
memory embedding providers, but NOT registered context engines. This causes
context engines registered by plugins (like lossless-claw) to be lost when
the plugin loader uses cached state.

Changes:
- src/context-engine/registry.ts: Add RegisteredContextEngineEntry type,
  listRegisteredContextEngines(), and restoreRegisteredContextEngines()
  functions for cache snapshot/restore support
- src/plugins/loader.ts: Add contextEngines field to CachedPluginState,
  call restoreRegisteredContextEngines() when using cached state, and
  save contextEngines to cache when storing registry
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 4, 2026

Codex review: found issues before merge.

Summary
The PR adds Telegram probe network.httpTimeoutMs config/tests, changes session transcript migration ID handling, snapshots context-engine registrations in the plugin loader cache, and updates WebChat tool-card extraction/overflow tests/styles.

Reproducibility: Partially: #77054 has source-level and current-main proof, but #77012 remains unverified against current main and is being narrowed by #77051. The Telegram/config and context-engine pieces rely on related issue evidence rather than a single high-confidence reproduction path for this mixed PR.

Next step before merge
The PR is unmergeable and mixes superseded fixes, an open transcript investigation, and a new config option, so a maintainer should decide whether to split, replace, or close it after preserving any useful pieces.

Security
Cleared: No concrete security or supply-chain regression was found; the diff does not add dependencies, workflows, package scripts, secret handling, or downloaded code execution.

Review findings

  • [P2] Align the new Telegram config surface — src/config/zod-schema.providers-core.ts:279-285
  • [P3] Add the required changelog entry — extensions/telegram/src/probe.ts:157-164
Review details

Best possible solution:

Split or replace the PR: keep the current-main #77054/#77063 fixes, coordinate #77012 through the focused #77051 path, and handle #77060's Telegram timeout work in a dedicated config-contract PR with docs, generated metadata, tests, and changelog aligned.

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

Partially: #77054 has source-level and current-main proof, but #77012 remains unverified against current main and is being narrowed by #77051. The Telegram/config and context-engine pieces rely on related issue evidence rather than a single high-confidence reproduction path for this mixed PR.

Is this the best way to solve the issue?

No: this is not the best current shape because it mixes four concerns, two of which are already solved on main, and the new Telegram config key lacks the required public config surface updates. A split, focused set of PRs is safer and easier to validate.

Full review comments:

  • [P2] Align the new Telegram config surface — src/config/zod-schema.providers-core.ts:279-285
    This adds channels.telegram.network.httpTimeoutMs to the schema, but the PR does not update the public Telegram docs, config UI hints/help, generated config metadata, or other config-contract outputs. OpenClaw requires new config keys to keep types, schema/help, metadata, baselines, and docs aligned, otherwise editors and generated docs will drift or omit the new setting.
    Confidence: 0.84
  • [P3] Add the required changelog entry — extensions/telegram/src/probe.ts:157-164
    The PR changes user-facing WebChat transcript behavior and Telegram probe configuration, but the changed files do not include CHANGELOG.md. User-facing fixes need an Unreleased changelog entry before merge; no bot or maintainer attribution should be forced if there is no eligible human credit.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.78

What I checked:

Likely related people:

  • steipete: Recent history shows Peter Steinberger authored the current main WebChat tool-result fix, recent session transcript work, and several plugin-loader cache changes that overlap the PR surfaces. (role: recent maintainer and adjacent owner; confidence: high; commits: a4df85e55f3a, f7ed29e118, b08220446a; files: ui/src/ui/chat/tool-cards.ts, ui/src/styles/chat/tool-cards.css, src/config/sessions/transcript-append.ts)
  • Takhoffman: Tak Hoffman recently worked on interleaved tool card pairing and assistant directive rendering in the same WebChat tool-card path. (role: UI tool-card feature history; confidence: medium; commits: d9812b85c4, cc5c691f00; files: ui/src/ui/chat/tool-cards.ts)
  • obviyus: Ayaan Zaidi recently changed Telegram startup/polling timeout behavior near the probe and webhook cleanup path touched by the PR. (role: Telegram adjacent maintainer; confidence: medium; commits: 5b94c4ce93; files: extensions/telegram/src/probe.ts, extensions/telegram/src/request-timeouts.ts)
  • jarimustonen: Jari Mustonen recently changed context-engine factory runtime context, and the PR adds context-engine registry snapshot/restore behavior. (role: context-engine adjacent owner; confidence: medium; commits: d8a600f2ad; files: src/context-engine/registry.ts)
  • jalehman: Josh Lehman has earlier context-engine transcript maintenance work in the same subsystem that informs routing for context-engine plugin behavior. (role: context-engine feature history; confidence: medium; commits: 751d5b7849; files: src/context-engine/registry.ts, src/plugins/loader.ts)

Remaining risk / open question:

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

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

Labels

app: web-ui App: web-ui channel: telegram Channel integration: telegram size: M

Projects

None yet

1 participant