Skip to content

fix(code): hide incomplete streaming link destinations - #79142

Merged
trunk-io[bot] merged 5 commits into
masterfrom
posthog-code/mask-streaming-markdown-links
Aug 7, 2026
Merged

fix(code): hide incomplete streaming link destinations#79142
trunk-io[bot] merged 5 commits into
masterfrom
posthog-code/mask-streaming-markdown-links

Conversation

@adboio

@adboio adboio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Problem

People reading a streaming agent response can see long, unrendered link destinations until the final Markdown delimiter arrives. Presigned artifact URLs are especially noisy and may contain temporary access parameters.

Changes

Before After
old-md-text-streaming.mp4 (uploaded via Graphite)
https://github.com/user-attachments/assets/55c84782-7830-4ef5-951a-2af5c915bc85
  • Show the link label while its destination is still streaming.
  • Render the normal clickable link as soon as the destination closes.
  • Parse escapes, inline code, images, nested labels, and nested destination parentheses.

Why: Streaming should keep readable content stable without exposing transport details that are not meant to be read.

How did you test this code?

  • pnpm --filter @posthog/ui test --run src/features/editor/components/StreamingMarkdown.test.tsx src/features/editor/components/splitMarkdownBlocks.test.ts
  • pnpm --filter @posthog/ui typecheck
  • Added regression coverage for every character boundary within a streaming URL and Markdown edge cases.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with Codex through PostHog Code. No repository or public skills were invoked. The change extends the existing streaming Markdown boundary instead of changing completed Markdown rendering.


Created with PostHog Code

Keep long link destinations out of the rendered conversation until their closing delimiter arrives, while preserving the visible link label.

Generated-By: PostHog Code
Task-Id: 412b0a25-4e72-446e-812d-0574055968dd
@trunk-io

trunk-io Bot commented Aug 6, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@adboio
adboio marked this pull request as ready for review August 6, 2026 18:53
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
products/desktop/packages/ui/src/features/editor/components/splitMarkdownBlocks.ts:148-150
**Unmatched backticks bypass masking**

When an incomplete link follows an unmatched backtick, `findClosingBacktickRun` advances to the end of the block even though CommonMark treats the backtick as literal text, causing the raw destination and any presigned URL parameters to remain visible until the link closes.

### Issue 2
products/desktop/packages/ui/src/features/editor/components/splitMarkdownBlocks.ts:185-193
**Destination grammar misdetects completion**

When a streamed link uses a CommonMark angle-bracket destination or quoted title, this parenthesis-only scanner disagrees with `react-markdown` about whether the link is complete, causing an unfinished destination to appear as literal text or a completed link containing parentheses to remain non-clickable.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(code): hide incomplete streaming lin..." | Re-trigger Greptile

adboio added 3 commits August 6, 2026 14:58
Apply incomplete link destination masking to the dedicated streaming Markdown component used by the current chat thread.

Generated-By: PostHog Code
Task-Id: 412b0a25-4e72-446e-812d-0574055968dd
Render incomplete chat links with their final visual treatment and an inline loading indicator until the destination closes.

Generated-By: PostHog Code
Task-Id: 412b0a25-4e72-446e-812d-0574055968dd
Handle unmatched backticks, angle-bracket destinations, and quoted link titles consistently with completed Markdown rendering.

Generated-By: PostHog Code
Task-Id: 412b0a25-4e72-446e-812d-0574055968dd
@adboio
adboio requested a review from a team August 6, 2026 19:12
@adboio adboio added the stamphog Request AI approval (no full review) label Aug 6, 2026
@adboio

adboio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

1 similar comment
@adboio

adboio commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

React Doctor found 1 issue in 1 file · 1 warning.

1 warning

packages/ui/src/features/sessions/components/chat-thread/ChatMarkdown.tsx

Reviewed by React Doctor for commit d097ab4.

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Contained frontend markdown-rendering fix outside risky territory; both Greptile concerns were fixed with regression tests and resolved, and a current-head reviewer approved with no outstanding holds.

  • puemos reviewed the current head.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 218L, 3F substantive, 382L/6F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1d-complex (382L, 6F, single-area, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ 90b6195 · reviewed head d097ab4

@trunk-io

trunk-io Bot commented Aug 7, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@trunk-io
trunk-io Bot merged commit 4411235 into master Aug 7, 2026
198 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/mask-streaming-markdown-links branch August 7, 2026 15:59
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-07 16:29 UTC Run
prod-us ✅ Deployed 2026-08-07 16:47 UTC Run
prod-eu ✅ Deployed 2026-08-07 16:47 UTC Run

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

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants