fix(ui): render injected XML blocks and PR refs like the rest of the app in thread UI#3602
Closed
adboio wants to merge 1 commit into
Closed
fix(ui): render injected XML blocks and PR refs like the rest of the app in thread UI#3602adboio wants to merge 1 commit into
adboio wants to merge 1 commit into
Conversation
…app in thread UI The canvas Thread side panel (ThreadPanel) rendered user prompts as plain pre-wrap text, so injected context blocks (<user_custom_instructions>, <canvas_generation_instructions>, <channel_context>) and inline mention chips (<github_pr/>, <file/>, …) leaked as raw XML tags. Its agent prose also went through ChatMarkdown, which rendered GitHub PR/issue URLs as plain anchors instead of the GithubRefChip the conversation view uses. - ChatMarkdown: render GitHub issue/PR URLs as GithubRefChip (matches MarkdownRenderer), so PR refs in agent prose get their chip rendering in both the main ChatThread and the canvas ThreadPanel. - Extract the duplicated "strip channel_context → canvas_instructions → custom_instructions" chain (previously copy-pasted in UserMessage and UserBubble) into a shared usePromptDisplayContent hook; adopt it in both. - ThreadPanel.UserPromptRow: use the hook to strip the injected blocks (always-on; the panel has no split-tab tags so the flag arg is false) and parse mention chips via parseFileMentions, falling back to ChatMarkdown — matching how UserMessage/UserBubble render prompts. Generated-By: PostHog Code Task-Id: 2e8b4b7c-4b0e-41cb-9c19-429b773df630
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found 1 issue in 1 file · 1 warning. 1 warning
Reviewed by React Doctor for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The canvas Thread side panel (
ThreadPanel) rendered user prompts as plainwhitespace-pre-wraptext, so the injected context blocks (<user_custom_instructions>,<canvas_generation_instructions>,<channel_context>) and inline mention chips (<github_pr/>,<file/>, …) leaked as raw XML tags instead of getting their custom rendering. PR URLs in agent prose also rendered as plain anchors rather than theGithubRefChipthe conversation view uses — the thread UI was out of step with the rest of the app.Changes
ChatMarkdown: render GitHub issue/PR URLs asGithubRefChip(mirrorsMarkdownRenderer), so PR refs in agent prose get their chip rendering in both the mainChatThreadand the canvasThreadPanel.usePromptDisplayContenthook: extracts thechannel_context → canvas_generation_instructions → user_custom_instructionsstripping chain that was copy-pasted in bothUserMessageandUserBubble; both now consume the hook (no behavior change — covered by existing tests).ThreadPanel.UserPromptRow: uses the hook to strip the injected blocks (always-on; the panel has no split-tab tags so the flag arg isfalse) and parses mention chips viaparseFileMentions, falling back toChatMarkdown— matching howUserMessage/UserBubblerender prompts.How did you test this?
ChatMarkdown.test.tsx— new: GitHub PR URL →GithubRefChip, non-GitHub links stay plain anchors.ThreadPanel.test.tsx— new: injected custom-instructions + channel-context XML is stripped (not rendered raw); injected<github_pr/>chip renders as a chip.usePromptDisplayContent.test.ts— new: covers all three block types, flag-gating of tags, and always-on stripping.UserMessage.test.tsx(5),channelContext/customInstructions/canvasInstructions(10), and fullchat-thread+session-update+ThreadPanelsuites (84 tests, 14 files) pass.tsc --noEmitandbiome checkclean.Automatic notifications
Created with PostHog Code