perf(components): use Streamdown static mode for finished markdown - #494
slashdevcorpse wants to merge 7 commits into
Conversation
Finished turns no longer run the streaming remend path. Growing turns keep mode streaming. Model: grok-4.6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9eb160757e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The invariant now matches isStreaming: static for frozen markdown, streaming while a turn is growing. Word-level animated stays off. Model: grok-4.6
Interrupted finished turns with an open fence stay in streaming mode. Complete finished markdown still uses static mode. Model: grok-4.6
Model: grok-4.6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2da32471c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Interrupted finished turns with indented or tilde fences stay in streaming mode so remend still runs. Closing fence length and 4-space indents follow CommonMark. Model: grok-4.6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d98de526f9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Interrupted finished turns with blockquote or list-nested fences stay in streaming mode. Open-fence detection uses the existing CommonMark scanner. Model: grok-4.6
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59dcfd3c07
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| isStreaming: boolean, | ||
| text = '' | ||
| ): 'static' | 'streaming' { | ||
| if (isStreaming || markdownHasUnclosedFence(text)) return 'streaming'; |
There was a problem hiding this comment.
Track list context across continuation lines
When a cancelled response opens a fence on a continuation line of an existing list, such as 1. explanation\n ```ts\nconst x = 1, markdownFenceAt sees four leading spaces without knowing they include the list-item indent and returns no fence. This makes the new resolver choose static mode and skip incomplete-Markdown repair even though the fence remains open. This is fresh evidence beyond the prior container-prefix comment: direct-marker forms are now handled, but ordinary continuation-line forms are still missed. Preserve list-container state while scanning.
AGENTS.md reference: packages/components/src/components/ai-gui/AGENTS.md:L96-L96
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Leaving this. Open-fence detection now uses the same per-line CommonMark scanner as normalizeTexMathDelimiters. Same-line list/blockquote markers (10. ```tex, > ```tex) and 0–3 space continuation fences already stay on Streamdown streaming. A 4-space continuation after 1. explanation is an indented code block at document scope unless we carry list indent across lines. That is a full list parser, not this #421 slice. Interrupted mid-list continuation fences are an accepted freeze-path edge case (.github/codex-review.md).
Keep the completed-Markdown mode policy alongside main's Mermaid interaction rules. Model: gpt-6
Related issue
Refs #421
Problem / pressure
Finished chat turns still render Streamdown with
mode="streaming". That path runs remend and block splitting on content that will not grow, adding work to the first-visit Markdown path when switching sessions.Summary
MarkdownRendererusesstaticfor completed Markdown with closed fences. Growing content and completed content with an unclosed fence stay instreamingmode, preserving incomplete-fence repair.isAnimatingis unchanged; this does not change Shiki caching or the publish interval.The maintainer follow-up merges main
0b7ef6e6and resolves the adjacentAGENTS.mdrules: this mode policy and main's Mermaid click-to-activate, wheel, and fullscreen rules both remain intact. The original contribution remains the five-file rendering change.Visual explanation
flowchart TD A[Markdown content] --> B{Still growing?} B -->|Yes| C[Streamdown streaming] B -->|No| D{Fence left open?} D -->|Yes| C D -->|No| E[Streamdown static]Before / after
streaming.streaming; completed content with closed fences usesstatic.Test plan
Validated on
a04b9a8f, which merges main0b7ef6e6:markdown-streamdown-mode,markdown-streaming-reparse,markdown-idle-rerender,markdown-math-delimiters,markdown-mermaid-plugin, andmarkdown-mermaid-fullscreen(including mounted rendering).pnpm --filter @lody/components typecheckpassed.pnpm run docs checkreported no errors after pinned ACP submodules were checked out; existing size warnings remain.Context handoff
Instructions for reviewing agents
resolveMarkdownStreamdownMode, fence detection, and themodeprop inmarkdown-renderer.tsx.Authoring context
Original user prompt
The original contributor's triggering prompt was not provided in this maintainer handoff. The following is the current maintenance request, reproduced verbatim; it is not presented as the original contribution's authoring prompt.
Show maintenance request