Repository navigation
fix: don't delete ordinary bold reasoning text that looks like an OpenRouter phase label - #479
Closed
Satya Arjunan (satya-arjunan) wants to merge 1 commit into
Conversation
…nRouter phase label
reasoningDisplayText() strips OpenRouter's concatenated provider-summary
phase headings ("...done.**Next**") from reasoning text before rendering.
The regex matched any **bold** span anywhere in the text unconditionally,
with no check that it's actually one of those headings - so a completely
ordinary bold span in a direct (non-bridged) provider's reasoning, e.g.
"Let me also make sure about **featureCounts GTF requirement**: ...", got
silently deleted and replaced with a blank line, while the text immediately
before and after it rendered fine. The model's actual output was intact in
storage; only the UI display was wrong.
Confirmed against raw stored data before diagnosing this as a rendering
bug, not a generation bug.
OpenRouter's concatenated headings never have whitespace before the opening
`**` (they touch the previous phase's closing punctuation directly, or
start the string); ordinary inline emphasis in real prose always does.
Scopes the regex to only match at the start of the text or immediately
after a non-whitespace character, which distinguishes the two shapes
without needing to thread provider identity through the render tree.
Verified against all existing OpenRouter-shaped test cases (still pass
unchanged) plus a new regression test for the exact reported case.
|
Satya Arjunan (@satya-arjunan) is attempting to deploy a commit to the InkVell Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #480
Problem
reasoningDisplayText()(frontend/ui/src/components/tool-display.ts) strips OpenRouter's concatenated provider-summary phase headings from reasoning text before rendering — its doc comment explains the shape: "Each summary phase starts with a bold label, but adjacent phases are not guaranteed to include a separator (...done.**Next**)."The regex matching those headings had no check confirming a bold span is actually one of them:
It matches any
**bold**span anywhere in reasoning text, from any provider, and replaces it with"\n\n"— deleting it entirely while leaving the surrounding text untouched. Confirmed against a real session: a direct (non-OpenRouter) provider's reasoning contained completely ordinary inline emphasis —— and the bold span vanished from the rendered UI, leaving the text stopping after "about", a blank line, then ": featureCounts works best...". Checked the raw stored message data first: the model's actual output was completely intact — this is purely a display bug in
reasoningDisplayText, not anything wrong with generation or storage.Fix
OpenRouter's concatenated headings never have whitespace before the opening
**— they touch the previous phase's closing punctuation directly (done.**Next**), or start the string. Ordinary inline emphasis in real prose always has a space before it. That's a clean, provider-agnostic signal to distinguish the two shapes without threading provider identity through the render tree:Requires the match to be at the start of the text or immediately preceded by a non-whitespace character.
Verification
**Evaluating Titanic dataset analysis**...,...started!**Choosing a reputable Titanic dataset**,**Inspecting assay quality**\n...) is preceded by either start-of-string or punctuation with no space, so none of them regress.bun run typecheck(frontend/ui) — clean.