Skip to content

🤖 feat: add smooth low-lag streaming text reveal#2482

Merged
ethanndickson merged 9 commits into
mainfrom
text-streaming-t125
Feb 18, 2026
Merged

🤖 feat: add smooth low-lag streaming text reveal#2482
ethanndickson merged 9 commits into
mainfrom
text-streaming-t125

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Feb 18, 2026

Copy link
Copy Markdown
Member

Summary

Implement smooth, replay-aware text streaming so assistant/reasoning output appears at a consistent cadence without re-animating replayed history, then tune the reveal policy to reduce visible lag during fast model bursts.

Closes #12

Background

Streaming deltas were rendered as soon as they arrived, which produced bursty transcript updates. The initial smoothing pass improved cadence, but in practice could still lag too far behind fast output and then jump forward on interrupt/abort.

Implementation

  • Added replay/live presentation hints for streamed assistant/reasoning rows (streamPresentation.source) in displayed message types + aggregator wiring.
  • Added a dedicated smooth-streaming subsystem:
    • STREAM_SMOOTHING constants (src/constants/streaming.ts)
    • SmoothTextEngine (pure deterministic jitter-buffer engine)
    • useSmoothStreamingText (RAF-driven presentation clock hook)
  • Wired smoothing into streaming markdown rendering:
    • TypewriterMarkdown now renders visibleText from useSmoothStreamingText
    • AssistantMessage + ReasoningMessage pass streamKey and replay/live source
    • replay streams bypass smoothing so catch-up/replay content is shown immediately
  • Tuned reveal policy to reduce lag:
    • increased baseline/ceiling rates
    • switched to normalized backlog-pressure adaptive ramp
    • added MAX_VISUAL_LAG_CHARS guard to cap hidden tail during active streaming
  • Pruned low-signal/redundant tests while keeping high-signal behavior coverage.

Validation

  • make static-check
  • bun test src/browser/utils/streaming/SmoothTextEngine.test.ts
  • bun test src/browser/hooks/useSmoothStreamingText.test.tsx
  • bun test src/browser/components/Messages/TypewriterMarkdown.test.tsx
  • bun test src/browser/components/Messages/ReasoningMessage.test.tsx
  • bun test src/browser/utils/messages/StreamingMessageAggregator.test.ts
  • bun test src/browser/utils/messages/applyWorkspaceChatEventToAggregator.test.ts

Risks

  • Streaming cadence is policy-driven by constants; if set too aggressively, markdown rendering could feel jumpy on very long bursts.
  • The replay bypass path depends on streamPresentation.source; regressions there would affect reconnect/catch-up UX.

Generated with mux • Model: openai:gpt-5.3-codex • Thinking: xhigh • Cost: $7.39

@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@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: edb3033968

ℹ️ 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".

Comment thread src/browser/hooks/useSmoothStreamingText.ts Outdated
Comment thread src/browser/hooks/useSmoothStreamingText.ts Outdated
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review
Please take another look.

@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: 55b618d0a5

ℹ️ 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".

Comment thread src/browser/hooks/useSmoothStreamingText.ts Outdated
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@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: c2ed4bcfdf

ℹ️ 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".

Comment thread src/browser/utils/streaming/SmoothTextEngine.ts Outdated
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@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: 990854cb21

ℹ️ 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".

Comment thread src/browser/utils/messages/StreamingMessageAggregator.ts
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@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: 2e309144a1

ℹ️ 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".

Comment thread src/browser/utils/messages/StreamingMessageAggregator.ts
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ 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".

@ethanndickson ethanndickson added this pull request to the merge queue Feb 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 18, 2026
@ethanndickson ethanndickson added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 060f54b Feb 18, 2026
23 checks passed
@ethanndickson ethanndickson deleted the text-streaming-t125 branch February 18, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: smooth text streaming

1 participant