Skip to content

fix(tui,core): resolve 5 streaming and permission bugs - #36086

Closed
umi008 wants to merge 5 commits into
anomalyco:v2from
umi008:fix-reasoning-streaming
Closed

umi008 wants to merge 5 commits into
anomalyco:v2from
umi008:fix-reasoning-streaming

Conversation

@umi008

@umi008 umi008 commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Five focused bug fixes targeting TUI streaming stability and core permission behavior.

  1. fix(tui): use markdown renderer for reasoning content (Reasoning/thinking content renders one token per line in TUI during streaming #36037)

    • ReasoningPart was using <code filetype="markdown"> which rendered tokens one-per-line. Changed to <markdown> matching TextPart's approach.
  2. fix(tui): normalize carriage returns in question text (TUI: question/ask prompt renders one word per line when model emits carriage returns #36040)

    • Model-emitted question strings containing \r caused single-word-per-line rendering. Added .replace(/\r/g, "") in parseQuestions.
  3. fix(core): map DeepSeek cache miss tokens to cache write (DeepSeek provider: prompt_cache_miss_tokens not mapped to cache.write #35974)

    • DeepSeek API returns prompt_cache_miss_tokens in provider metadata but getUsage() never read it. Added fallback to the metadata chain alongside Anthropic/Vertex/Bedrock/Venice.
  4. fix(tui): batch streaming delta updates to prevent scroll freeze (TUI scroll freezes for seconds during fast-streaming responses (message.part.delta applied per-chunk with no batching) #36043)

    • Each SSE delta triggered a full store mutation + re-render. Added 16ms buffer with Solid's batch() so rapid delta bursts coalesce into a single render cycle.
  5. fix(core): coalesce equivalent pending permission requests (Duplicate equivalent external_directory permission requests are emitted for concurrent tool calls #36055)

    • Multiple tools requesting the same permission type (e.g., fs_write) spawned duplicate dialogs. Now coalesces by sessionID + action so one approval resolves all pending requests of that type.

Testing

  • bun typecheck passes from packages/tui and packages/opencode
  • Manual verification: reasoning content now renders as flowing markdown, questions display correctly, DeepSeek usage stats show cache tokens, streaming is smooth, permission dialogs don't duplicate

Checklist

umi008 added 5 commits July 9, 2026 08:34
The ReasoningPart component was using the `<code>` renderable with
`filetype="markdown"`, which renders content as a code block with
one token per line during streaming. Switch to the `<markdown>`
renderable (same as TextPart) so markdown is rendered inline with
proper word-wrapping.

Fixes #36037
Models that emit \r characters in question strings cause the TUI to
render one word per line. Strip carriage returns in parseQuestions
before passing text to the renderer.

Fixes #36040
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title fix(tui,core): resolve 5 streaming and permission bugs doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@umi008

umi008 commented Jul 9, 2026

Copy link
Copy Markdown
Author

Splitting into 5 individual PRs for better review granularity.

@umi008 umi008 closed this Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found one potential duplicate:

PR #35979: fix(llm): map DeepSeek cache miss tokens
#35979

This appears to be addressing the same issue as fix #3 in the current PR (mapping DeepSeek cache miss tokens to cache write). However, since the current PR references issue #35974, these may be related but separate efforts. You should verify whether #35979 supersedes or complements the DeepSeek cache fix in PR #36086.

The other 4 fixes in this PR (markdown renderer, carriage returns, streaming batching, and permission coalescing) do not have matching open PRs.

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

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:title

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant