Repository navigation
Studio: render escaped inline math in lists - #9796
Conversation
|
Confirmed the preprocessor in studio/frontend/src/lib/latex.ts left paired escaped dollar spans as literal dollars, and the added guards keep currency, code spans and link destinations untouched. Will get this reviewed. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Reviewed and fixed the escaped inline math path. The problem is real and in scope. An isolated Playwright run against merge base Concrete issues found and fixed:
Testing performed:
Focused fork CI is being staged from the pushed head. I will link its result separately. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f93474673e
ℹ️ 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".
| if (phase === "exit" && token.type === "characterEscape") { | ||
| updateLatexBracketState(state, context.sliceSerialize(token)); | ||
| } |
There was a problem hiding this comment.
Reset unmatched bracket math at block boundaries
When an unmatched \( or \[ appears earlier in the message, this persistent delimiter stack never clears, so every later \$…\$ candidate remains literal—even on subsequent paragraphs or list items. For example, `unfinished (
-
$v_s$ fails to recoverv_s, althoughpreprocessLaTeX` leaves the unmatched bracket opener as ordinary text. Reset unmatched bracket state when its Markdown block ends, or determine complete bracket-math ranges before suppressing escaped-dollar parsing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reproducible at f934746. normalizeEscapedInlineMath(String.raw'unfinished \(\n\n- \$v_s\$') returns unfinished \\(\n\n- $v_s$; micromark starts a new tokenization context at the next Markdown block, so the WeakMap state does not persist across this boundary.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec2e029b23
ℹ️ 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".
|
Final review and convergence result for pushed head The PR fixes a real Studio rendering defect. Merge-base Concrete issues found and fixed:
Verification:
The remaining broad-workflow failures reproduce in unchanged upstream areas: five audio source-assertion tests, two Python dependency scans, and the MCP fixture waiting on a disabled button. The focused Markdown run, build, typecheck, lint, Linux chat UI, and relevant package audits pass. |
mahiatlinux
left a comment
There was a problem hiding this comment.
Verified escaped inline math end to end, fixed confirmed parser and streaming regressions, and validated the final head with focused cross-platform CI and Playwright evidence.
|
All reviewed and fixed, LGTM. CI results |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e584ffc49f
ℹ️ 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".
| item = nested; | ||
| itemIndent = contentColumn + relativeIndent; |
There was a problem hiding this comment.
Track emptiness of the innermost same-line item
When a same-line nested item is empty, such as - -, this loop records the inner content column but openLists still computes emptyItem from the outer marker, whose remaining text is -. The following blank line therefore leaves the empty inner item open rather than dropping it as the existing blank-line logic requires. For example, in - -\n\n \\(x\\), the six-space line should be indented code relative to the still-open outer item, but the stale inner column makes it ordinary text, so findCodeBlockRegions allows preprocessLaTeX and search-image rewriting to modify code content. Return or otherwise propagate whether the final nested marker is empty.
Useful? React with 👍 / 👎.
| const start: State = (code) => { | ||
| const previousToken = this.events.at(-1)?.[1]; | ||
| if ( | ||
| code !== BACKSLASH || | ||
| isInHtmlLiteral(this) || | ||
| isInLatexBracketMath(this) || | ||
| (this.previous === DOLLAR && previousToken?.type !== TOKEN) |
There was a problem hiding this comment.
Respect escaped backslashes before math openers
When an escaped-dollar sequence is itself escaped in Markdown, such as three backslashes before each dollar in \\\$x\\\$, micromark first consumes the initial backslash pair as a literal backslash and then invokes this construct on the third backslash. Because the start guard does not reject a backslash immediately following that escape token, the remaining \$x\$ is normalized into active math, changing text intended to render literally as \$x\$ into KaTeX. Check the preceding escape/run parity before accepting the opener.
Useful? React with 👍 / 👎.
…ordless pip install (#9959) * Fix three CI regressions: code-span anchor, load-dispatch anchor, recordless pip install Three unrelated failures, all reproduced locally first. 1. tests/studio/test_update_release_notes.py::test_code_span_closers_ignore_backslashes #9796 moved the code-span scanner into scanCodeSpans, which is defined ABOVE `export function codeSpans`. The test sliced the file from that export and counted `escaped(text` in the remainder, so the count went from 1 to 0 and the assertion "only an opener can be escaped" fired on a file where exactly one opener is still the only escaped thing. Count over the whole module and check the surviving call guards the opening run, so a wrapper moving again cannot read as "no opener is escaped either". 2. studio/backend/tests/test_parallel_slots_per_load.py::test_route_resolves_slots_once_before_dedupe_guard_and_load The GGUF load moved into _run_gguf_load_attempt, a health-wait helper defined above _load_model_impl, so `llama_backend.load_model` left the function body and .index() raised ValueError. Every ordering the test guards still holds. Anchor on whichever call the body dispatches a load through instead of on one backend's method name. 3. startup windows-latest pip will not replace a distribution whose .dist-info carries no RECORD, and an interrupted install leaves exactly that. The job reuses its venv, so the stub is not transient: once written, every later run dies the same way on "Cannot uninstall pydantic-core / no RECORD file was found". pip_install now retries once after clearing only the distributions pip named as unremovable, and only when it named one. pip's own hint is --ignore-installed, which would apply to every package in the command and skip real upgrades with it. run() grows check=False so pip_install can inspect a failure instead of exiting inside it; every existing caller keeps the old exit-on-failure behaviour. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Mirror the StageRoot branch into install.ps1's shared copy #9890 added staging support to studio/setup.ps1 and put an early `if ($StageRoot)` return inside Get-ManagedLlamaCppDir, which sits in the block install.ps1 holds a byte-identical copy of. The copy never got it, so test_denied_llama_cpp_preflight.py failed on exactly the drift it exists to catch, taking Repo tests (CPU) down with it. install.ps1 never assigns $StageRoot, and it runs under Set-StrictMode -Off from line 25 onwards, so the read is $null there and the branch is inert. Parity is what the block is for: the copies have to match or the next person edits one of them and only finds out in production. --------- Co-authored-by: danielhanchen <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
findInlineCodeRegions masks every block region to spaces and rescans the result for code spans. When no backtick sits outside a block region that mask cannot contain one, so the scan can only return nothing and the rebuild is spent to learn that. The streaming path calls this once per frame over a growing prefix, and preprocessLaTeX calls findCodeBlockRegions twice per frame, so the mask is O(n) per frame and O(n^2) over a reply. Recovers most of the regression #9796 introduced: on the streaming-latex-retro-edit fixture the math arm goes from 217ms to 136ms and the measured ratio from 3.35x to 2.11x, against 1.5x before #9796. The new test pins both directions, since an early return that fires too eagerly would look like a pure win.
Summary
\$v_s\$Why
Markdown treats
\$...\$as literal dollars, so Studio displayed$v_s$in list items even when the same reply's display equation rendered correctly. The preprocessor now selectively converts paired, math-looking escaped delimiters back to inline math before Streamdown parses the reply.Validation
npm test— 5,209 passednpm run typecheck