Repository navigation
fix: render assistant transcript headers safely - #99404
Conversation
|
Codex review: needs changes before merge. Reviewed July 14, 2026, 4:16 AM ET / 08:16 UTC. Summary 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 Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest 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 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:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against da9f974886a7. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1583, Tests +531, Generated 0, Other +298. Total +2412 across 37 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (16 earlier review cycles; latest 8 shown)
|
e6416c5 to
182ad3a
Compare
|
Updated the PR body with redacted OpenClaw live-runtime proof from current head @clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. |
182ad3a to
aa1dde6
Compare
c1934bb to
5eb4c80
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Resolved by the final ownership refactor: Telegram no longer imports or declares Markdown-It directly. |
There was a problem hiding this comment.
💡 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".
| return applyPlainTextInsertions( | ||
| plainText, | ||
| collectAssistantTranscriptRoleInsertions(plainText, options), |
There was a problem hiding this comment.
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 👍 / 👎.
| if (text.startsWith(SLACK_ASSISTANT_TRANSCRIPT_PREFIX)) { | ||
| return text; |
There was a problem hiding this comment.
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 👍 / 👎.
|
Land-ready at exact head Maintainer work completed:
Before/after behavior:
Proof:
Known scoped proof gaps: none. The broader fail-closed tool-execution policy remains intentionally tracked by #99253 and is not claimed fixed here. |
|
Merged via squash.
|
* 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]>
* 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]>
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:packages/markdown-coreowns one quote-aware Markdown-It HTML token stream, consumes complete comments/CDATA/declarations safely, and exports it throughplugin-sdk/text-chunkingfor exact post-render projections;Assistant:marker and preserves escaped source text without reparsing it;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.mdis release-owned. The maintainer rewrite preserves @snowzlmbot's contributor credit with aCo-authored-bytrailer.Evidence
PR head:
30450a7cd49c1822855fcb6c849361bea067b669Implementation stack:
208d5d4c0c6through30450a7cd49;3dfdc92fa9fmerges currentmainto resolve the one real generated Plugin SDK baseline conflict,a80113f2594centralizes parser ownership, and30450a7cd49contains the behavior-preserving CI lint cleanup.pnpm tsgo:alland fullpnpm buildpassed.>attributes, task-list checkboxes, code exclusions, link destinations, and final chunk-size accounting.git diff --checkpassed.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.
control-ui-assistant-transcript-role-boundary1/1.telegram-assistant-transcript-role-boundary1/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.mddocuments the additive quote-aware tokenizer on the existingplugin-sdk/text-chunkingsurface. There is no operator-facing configuration change.