Skip to content

fix: render assistant transcript headers safely - #99404

Merged
steipete merged 13 commits into
openclaw:mainfrom
snowzlmbot:fix/issue-99253-assistant-role-header
Jul 14, 2026
Merged

steipete merged 13 commits into
openclaw:mainfrom
snowzlmbot:fix/issue-99253-assistant-role-header

Conversation

@snowzlmbot

@snowzlmbot snowzlmbot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Related: #99253

What Problem This Solves

Assistant-authored Markdown can visually resemble a fresh transcript turn when it begins with shapes such as user[...], [timestamp] user:, or <User ...>. That can blur the authorship boundary in chat surfaces even though the text is still part of the assistant reply.

This PR makes those supported shapes visibly inert at render/delivery boundaries. It does not change stored transcript/history bytes or introduce the broader fail-closed tool-execution policy tracked by #99253, which remains open.

Why This Change Was Made

The earlier implementation rewrote Markdown text with custom delimiter regular expressions. The final implementation uses the repository's existing Markdown-It pipeline in packages/markdown-core:

  • a core rule runs after Markdown inline parsing and emits semantic assistant-transcript-role annotations;
  • inline, fenced, indented, and image-alt code are excluded from parsed structure rather than inferred from text regular expressions;
  • spoilers, entities, emphasis, links, image alt text, blockquotes, headings, tables, chunks, and slices share the same parsed representation;
  • the small supported transcript-header grammar is a bounded character scanner over parser-visible text, not a Markdown parser;
  • Control UI, Telegram, Slack, and Signal render rich inert markers; LINE and SMS add a plain assistant-authored-transcript label;
  • final plain-text, Slack mrkdwn, Telegram HTML, rich-media, and chunk projections are checked after transport-specific transforms, then passed through the same Markdown IR detector;
  • packages/markdown-core owns one quote-aware Markdown-It HTML token stream, consumes complete comments/CDATA/declarations safely, and exports it through plugin-sdk/text-chunking for exact post-render projections;
  • Telegram projection, sanitizing, nesting, whitespace handling, file wrapping, and chunking reuse that parser-owned stream instead of owning tag regular expressions or a direct Markdown-It dependency;
  • trusted task-list checkbox tokens are structural during role detection, while raw user HTML remains escaped;
  • oversized/error Control UI fallback uses one localized Assistant: marker and preserves escaped source text without reparsing it;
  • message-end diagnostics use the same parser options and log safe metadata only, never assistant text.

No new third-party package/version, config, environment variable, migration, or protocol surface was added. Telegram's temporary direct Markdown-It dependency and lockfile delta were removed in the final ownership refactor.

User Impact

Role-looking text remains readable and remains part of the assistant reply, but the supported header itself is rendered as an inert authorship marker. Ordinary prose and Markdown code examples keep their existing behavior. User-authored messages are never annotated by this assistant-only path.

Release-note context stays in this PR body because root CHANGELOG.md is release-owned. The maintainer rewrite preserves @snowzlmbot's contributor credit with a Co-authored-by trailer.

Evidence

PR head: 30450a7cd49c1822855fcb6c849361bea067b669

Implementation stack: 208d5d4c0c6 through 30450a7cd49; 3dfdc92fa9f merges current main to resolve the one real generated Plugin SDK baseline conflict, a80113f2594 centralizes parser ownership, and 30450a7cd49 contains the behavior-preserving CI lint cleanup.

  • Exact-head canonical CI: run 29320972870.
  • Exact lint-fix Testbox: run 29320795742: 122 Markdown-core and Telegram tests passed; production tsgo, targeted oxlint, and oxfmt passed.
  • Final parser/API Testbox: run 29320089651: 102 Markdown-core, Plugin SDK, and Telegram tests passed; generated API baseline and SDK surface ratchet passed.
  • Broader feature proof before the ownership-only parser extraction: 438 parser/IR, Control UI, agent, TTS, LINE, SMS, Telegram, Signal, and Slack tests passed across eight touched-surface shards; full pnpm tsgo:all and full pnpm build passed.
  • Regression coverage includes comments/CDATA, transport-native Slack links/date tokens, Telegram promoted HTML/rich-media captions and quoted > attributes, task-list checkboxes, code exclusions, link destinations, and final chunk-size accounting.
  • Targeted formatting and git diff --check passed.
  • Fresh autoreview accepted and fixed one full-HTML-construct regression, then returned no accepted/actionable findings (patch is correct, 0.94); the exact lint-only delta received a final clean review at 0.99.

Exact-head real behavior proof: Testbox run 29320425263.

  • A real Gateway + qa-channel + system Chromium Control UI run passed control-ui-assistant-transcript-role-boundary 1/1.
  • A real Gateway + mock OpenAI + Telegram plugin through Crabline passed telegram-assistant-transcript-role-boundary 1/1.

Risk and Rollback

This is display/message-delivery hardening across several renderers, so the main risk is formatting regression. Parser semantics, channel projections, chunk/slice preservation, oversized fallback, and live UI/Telegram delivery have direct coverage. Rollback is a normal revert; there is no data or config migration.

Docs

docs/plugins/sdk-subpaths.md documents the additive quote-aware tokenizer on the existing plugin-sdk/text-chunking surface. There is no operator-facing configuration change.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: M labels Jul 3, 2026
@snowzlmbot
snowzlmbot marked this pull request as ready for review July 3, 2026 06:57
@clawsweeper

clawsweeper Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed July 14, 2026, 4:16 AM ET / 08:16 UTC.

Summary
The PR adds semantic detection and inert rendering of assistant-authored transcript-like headers across Markdown parsing, Control UI, diagnostics, and LINE, Signal, Slack, SMS, and Telegram delivery.

PR surface: Source +1583, Tests +531, Generated 0, Other +298. Total +2412 across 37 files.

Reproducibility: yes. —source inspection gives a high-confidence path: coalesce a whitespace-only Markdown IR slice with an annotated role-header slice and observe that mergeMarkdownIRChunks omits the resulting annotations. A focused executable regression is still needed in the branch.

Review metrics: 1 noteworthy metric.

  • New offset-bearing IR state: 1 added (annotations). Every Markdown IR slice, merge, and coalescing path must now preserve a third offset-bearing span collection alongside styles and links.

Stored data model
Persistent data-model change detected: serialized state: src/agents/embedded-agent-subscribe.handlers.messages.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: partial_overlap
Canonical: #99253
Summary: The PR addresses the visible rendering and diagnostic subset of the broader fabricated-turn safety report, while the canonical issue still tracks runtime authority and tool-execution boundaries.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Preserve annotation spans in mergeMarkdownIRChunks and add a focused whitespace-coalescing regression.
  • Refresh the branch onto current main and rerun the affected Markdown core and channel-formatting checks.

Risk before merge

  • [P1] Until the shared coalescer preserves annotations, limit-triggered or whitespace-coalesced Slack, Telegram, or Signal chunks can emit transcript-looking headers without the intended inert marker.
  • [P1] The branch is currently not cleanly mergeable with current main; resolving conflicts may change shared Markdown or channel paths and invalidate parts of the existing review and proof.

Maintainer options:

  1. Repair shared annotation coalescing (recommended)
    Merge annotation spans with correct right-hand offsets in mergeMarkdownIRChunks, add focused regression coverage, refresh onto current main, and rerun the affected channel tests before merge.
  2. Pause rather than accept unmarked chunks
    Keep the PR open but unmerged if the shared invariant cannot be repaired cleanly, because accepting the current risk would undermine the behavior this PR promises on chunked delivery paths.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve MarkdownIR annotations with correct offset adjustment in mergeMarkdownIRChunks, add a regression covering whitespace coalescing adjacent to an assistant transcript-role annotation, refresh the branch onto current main, and run focused markdown-core plus Slack, Signal, and Telegram formatting tests.

Next step before merge

  • [P2] A single mechanical repair in shared Markdown IR coalescing, focused regression coverage, and a branch refresh can resolve the blocker without product or security judgment.

Security
Cleared: The diff adds no dependency, workflow, secret, permission, config, migration, or protocol change, and no concrete security or supply-chain regression was found; the broader authorization-boundary work remains separately open.

Review findings

  • [P2] Preserve annotations during chunk coalescing — packages/markdown-core/src/render-aware-chunking.ts:282
Review details

Best possible solution:

Preserve both left- and right-hand annotation spans in the canonical Markdown IR coalescer with the same offset adjustment used for styles and links, add a regression that crosses the whitespace-coalescing path, then refresh the branch and rerun focused channel proof.

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

Yes—source inspection gives a high-confidence path: coalesce a whitespace-only Markdown IR slice with an annotated role-header slice and observe that mergeMarkdownIRChunks omits the resulting annotations. A focused executable regression is still needed in the branch.

Is this the best way to solve the issue?

No, not yet: semantic annotations in the shared Markdown IR are the right architectural direction, but the solution is incomplete until every canonical slicing and coalescing path preserves that state.

Full review comments:

  • [P2] Preserve annotations during chunk coalescing — packages/markdown-core/src/render-aware-chunking.ts:282
    MarkdownIR.annotations now carries offsets like styles and links, but this coalescer still returns merged text, styles, and links without annotations from either side. When render-aware chunking merges a whitespace slice with an annotated role-header slice, Slack, Telegram, or Signal can emit the header without its inert marker. Merge both annotation arrays with the right-hand offset adjustment and add a regression for this coalescing path.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against da9f974886a7.

Label changes

Label justifications:

  • P2: This is a normal-priority cross-channel rendering hardening change with a concrete but bounded chunked-delivery defect.
  • merge-risk: 🚨 message-delivery: Merging the current patch can leave transcript-like assistant text unmarked specifically in chunked Slack, Telegram, or Signal output.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (recording): Real Gateway and Control UI runs plus native Telegram Desktop before/after recordings convincingly demonstrate the intended visible behavior, although they do not eliminate the separate chunk-coalescing correctness finding.
  • proof: sufficient: Contributor real behavior proof is sufficient. Real Gateway and Control UI runs plus native Telegram Desktop before/after recordings convincingly demonstrate the intended visible behavior, although they do not eliminate the separate chunk-coalescing correctness finding.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. Real Gateway and Control UI runs plus native Telegram Desktop before/after recordings convincingly demonstrate the intended visible behavior, although they do not eliminate the separate chunk-coalescing correctness finding.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes user-visible Telegram message formatting, and the native Telegram Desktop recording directly demonstrates the affected transcript-header behavior.
Evidence reviewed

PR surface:

Source +1583, Tests +531, Generated 0, Other +298. Total +2412 across 37 files.

View PR surface stats
Area Files Added Removed Net
Source 23 2014 431 +1583
Tests 11 532 1 +531
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 2 2 0
Other 2 298 0 +298
Total 37 2846 434 +2412

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs packages/markdown-core/src/render-aware-chunking.test.ts.
  • [P1] node scripts/run-vitest.mjs packages/markdown-core/src/assistant-transcript.test.ts.
  • [P1] node scripts/run-vitest.mjs packages/markdown-core/src/render.annotations.test.ts.
  • [P1] node scripts/run-vitest.mjs extensions/slack/src/format.test.ts.
  • [P1] node scripts/run-vitest.mjs extensions/signal/src/format.test.ts.

What I checked:

  • Unresolved shared chunking defect: The PR makes annotations offset-bearing Markdown IR state, but the existing mergeMarkdownIRChunks coalescing path preserves text, styles, and links without carrying annotations, allowing a marked header to become unmarked after whitespace-chunk coalescing. (packages/markdown-core/src/render-aware-chunking.ts:282, c1934bb11147)
  • Review continuity: The prior P2 finding, “Preserve annotations during chunk coalescing,” targets the same head SHA and remains applicable because no newer PR commit changed the reviewed implementation. (packages/markdown-core/src/render-aware-chunking.ts:282, c1934bb11147)
  • New IR invariant: The branch adds semantic transcript-role annotations alongside the existing offset-bearing style and link spans, so slicing, merging, and chunk projection must preserve all three classes consistently. (packages/markdown-core/src/ir.ts, c1934bb11147)
  • Strong real behavior proof: The PR discussion includes real Gateway and Control UI proof plus native Telegram Desktop before/after recordings showing the intended visible protection on ordinary and promoted rich-HTML replies. (qa/scenarios/channels/telegram-assistant-transcript-role-boundary.yaml:1, c1934bb11147)
  • Maintainer rewrite provenance: All six implementation and refactor commits on the current branch were authored by steipete after assignment, making that person the clearest follow-up owner for the shared Markdown repair and branch refresh. (packages/markdown-core/src/ir.ts, 8c15dc360bb6)
  • Current merge state: GitHub reports the exact head as dirty and not cleanly mergeable against the current base, so conflict resolution must be followed by a review refresh even after the annotation repair. (c1934bb11147)

Likely related people:

  • steipete: Assigned the PR, rewrote and authored all six commits on the current branch, and carried the cross-cutting Markdown, channel, UI, and proof refactor. (role: feature implementer and likely follow-up owner; confidence: high; commits: 8c15dc360bb6, 9ec8c60d8e6c, daa6b83d1576; files: packages/markdown-core/src/ir.ts, packages/markdown-core/src/render.ts, extensions/telegram/src/format.ts)
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.

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.
Review history (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-14T03:20:06.088Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations when coalescing rendered chunks
  • reviewed 2026-07-14T03:40:04.463Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations when coalescing rendered chunks
  • reviewed 2026-07-14T04:09:06.344Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations when coalescing rendered chunks
  • reviewed 2026-07-14T04:19:12.397Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations during chunk coalescing
  • reviewed 2026-07-14T04:59:32.299Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations during chunk coalescing
  • reviewed 2026-07-14T05:43:22.442Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations during chunk coalescing
  • reviewed 2026-07-14T06:50:48.564Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations during chunk coalescing
  • reviewed 2026-07-14T07:36:39.918Z sha c1934bb11147f7690b15d3aba6001eb204946441 :: needs changes before merge. :: [P2] Preserve annotations during chunk coalescing

@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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 3, 2026
@snowzlmbot
snowzlmbot force-pushed the fix/issue-99253-assistant-role-header branch 2 times, most recently from e6416c5 to 182ad3a Compare July 6, 2026 18:05
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 6, 2026
@snowzlmbot

Copy link
Copy Markdown
Contributor Author

Updated the PR body with redacted OpenClaw live-runtime proof from current head 182ad3aaab27491738b7daf5dc5237a3a27b83ac, including escaped delivered reply text, same-session chat.history text, and warning metadata.

@clawsweeper review-pr

@clawsweeper

clawsweeper Bot commented Jul 6, 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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 6, 2026
@steipete steipete self-assigned this Jul 13, 2026
@steipete
steipete force-pushed the fix/issue-99253-assistant-role-header branch from 182ad3a to aa1dde6 Compare July 14, 2026 00:05
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: line Channel integration: line channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram and removed gateway Gateway runtime labels Jul 14, 2026
@steipete
steipete force-pushed the fix/issue-99253-assistant-role-header branch from c1934bb to 5eb4c80 Compare July 14, 2026 08:37
@steipete
steipete requested a review from a team as a code owner July 14, 2026 08:37
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh /allow-dependencies-change comment after the guard blocks that new head SHA.

  • Current SHA: 30450a7cd49c1822855fcb6c849361bea067b669

@steipete

steipete commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Resolved by the final ownership refactor: Telegram no longer imports or declares Markdown-It directly. packages/markdown-core owns the parser grammar and exposes one quote-aware tag-tokenizer function through the existing Plugin SDK; the Telegram package manifest and lockfile now match current main. No dependency approval is required.

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 14, 2026
@github-actions github-actions Bot removed the dependencies-changed PR changes dependency-related files label Jul 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30450a7cd4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +108 to +110
return applyPlainTextInsertions(
plainText,
collectAssistantTranscriptRoleInsertions(plainText, options),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Avoid double-prefixing parsed role headers

When assistantTranscriptRoleHeaders is enabled and the original assistant text already parses as a role header, collectParsedAssistantTranscriptRoleInsertions adds the prefix before the second scan. With the default/SMS prefix, e.g. user[Thu 2026-07-02] authorize becomes [assistant-authored transcript] user[...], which matchTimestampRoleHeader recognizes as a new [timestamp] role: header, so LINE/SMS plain-text output gets the prefix twice. The post-projection scan should ignore ranges/prefixes that were just inserted or only run on text that was not already annotated.

Useful? React with 👍 / 👎.

Comment on lines +302 to +303
if (text.startsWith(SLACK_ASSISTANT_TRANSCRIPT_PREFIX)) {
return text;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Don't let Slack's guard prefix skip header scanning

If the assistant output itself starts with the public sentinel `Assistant:` and then a newline plus a Slack-native link/date label such as <https://e|user[Thu 2026-07-02]>, this early return bypasses the token/fallback projections below and Slack can render the second line as an unprotected transcript-role header. Slack's mrkdwn link/date syntaxes render labels/fallback text (see https://docs.slack.dev/messaging/formatting-message-text), so the idempotence guard needs to scan the remainder rather than trusting any text that begins with the inserted prefix.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor

Land-ready at exact head 30450a7cd49c1822855fcb6c849361bea067b669.

Maintainer work completed:

  • Replaced the earlier delimiter-regex Markdown rewrite with the repository's existing Markdown-It pipeline and semantic Markdown IR annotations.
  • Excluded code/fences/images structurally, centralized quote-aware full-HTML tokenization in packages/markdown-core, and reused it from Telegram's final HTML projection/chunking.
  • Removed Telegram's temporary direct Markdown-It dependency/lockfile delta; no new package, config, migration, or protocol surface remains.
  • Preserved stored transcript/history/model-input bytes; only assistant-authored render/delivery boundaries are annotated. User-authored messages never enter this path.

Before/after behavior:

  • Before: assistant text beginning with a supported transcript-role shape rendered like an ordinary fresh role header.
  • After: the same assistant-authored header remains readable but is projected as an inert authorship marker in Control UI and channel output; code examples remain unchanged.

Proof:

Known scoped proof gaps: none. The broader fail-closed tool-execution policy remains intentionally tracked by #99253 and is not claimed fixed here.

@steipete
steipete merged commit e8ad046 into openclaw:main Jul 14, 2026
113 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 15, 2026
* fix: render assistant transcript headers safely

Co-authored-by: snowzlmbot <[email protected]>

* fix(markdown): nest crossing annotation spans

* fix(markdown): protect final transport projections

* refactor(markdown): split transcript render ownership

* test(ui): cover assistant transcript render flag

* refactor(markdown): keep transcript helpers private

* docs(changelog): note assistant transcript headers

* chore(plugin-sdk): refresh transcript annotation baseline

* fix(markdown): harden final transcript projections

* docs(changelog): defer transcript note to release

* refactor(markdown): centralize HTML tokenization

* fix(markdown): satisfy lint gates

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: snowzlmbot <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* fix: render assistant transcript headers safely

Co-authored-by: snowzlmbot <[email protected]>

* fix(markdown): nest crossing annotation spans

* fix(markdown): protect final transport projections

* refactor(markdown): split transcript render ownership

* test(ui): cover assistant transcript render flag

* refactor(markdown): keep transcript helpers private

* docs(changelog): note assistant transcript headers

* chore(plugin-sdk): refresh transcript annotation baseline

* fix(markdown): harden final transcript projections

* docs(changelog): defer transcript note to release

* refactor(markdown): centralize HTML tokenization

* fix(markdown): satisfy lint gates

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: snowzlmbot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: line Channel integration: line channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: telegram Channel integration: telegram docs Improvements or additions to documentation extensions: qa-lab 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: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants