Skip to content

perf(components): use Streamdown static mode for finished markdown - #494

Open
slashdevcorpse wants to merge 6 commits into
LodyAI:mainfrom
slashdevcorpse:perf/streamdown-static-mode
Open

perf(components): use Streamdown static mode for finished markdown#494
slashdevcorpse wants to merge 6 commits into
LodyAI:mainfrom
slashdevcorpse:perf/streamdown-static-mode

Conversation

@slashdevcorpse

Copy link
Copy Markdown
Contributor

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, which is on the first-visit markdown path for session switch.

Summary

MarkdownRenderer selects Streamdown static when isStreaming is false and streaming while a turn is growing. isAnimating is unchanged. Does not add a publish-interval cap or change Shiki caching.

Before / after

Before After
Finished and streaming turns both use mode="streaming". Finished turns use mode="static". Growing turns stay streaming.

Test plan

  • pnpm --filter @lody/components exec vitest run tests/markdown-streamdown-mode.test.ts — 2 passed.
  • Full MarkdownRenderer jsdom suite not rerun here: worktree lacks ACP extension submodules (acp-extension-dsh/capabilities).
  • No live desktop session-switch trace.

Context handoff

Instructions for reviewing agents

Authoring context

Finished turns no longer run the streaming remend path. Growing turns keep mode streaming.

Model: grok-4.6
@slashdevcorpse
slashdevcorpse marked this pull request as ready for review September 8, 2026 03:21
Copilot AI lite review requested due to automatic review settings September 8, 2026 03:21

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread packages/components/src/components/ai-gui/markdown-renderer.tsx Outdated
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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread packages/components/src/components/ai-gui/markdown-streamdown-mode.ts Outdated
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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread packages/components/src/components/ai-gui/markdown-streamdown-mode.ts Outdated
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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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).

@github-actions github-actions Bot added the status:needs-pr-attention External PR needs contributor attention before review label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@slashdevcorpse, this pull request needs updates before review.

It is marked status:needs-pr-attention. Address the findings below by 2026-09-16 08:23:42 UTC. The label and this comment are removed automatically after the PR passes validation.

If the PR remains invalid for 7 days, it will be closed and marked status:pr-policy-expired. Continue afterward by opening a new pull request with the current template.

Policy findings
PR does not meet Lody contribution requirements:

- Missing required heading: ## Visual explanation
- Context handoff must include ### Original user prompt.

See `CONTRIBUTING.md` and `.github/PULL_REQUEST_TEMPLATE.md`.

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

Labels

scope: components status:needs-pr-attention External PR needs contributor attention before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Reduce streaming-time renderer energy: per-frame full-message markdown re-parse and Shiki re-highlight

2 participants