Repository navigation
fix(ui): prevent Control UI hangs on malformed progress content - #147528
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
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. |
|
Codex review: blocked before merge. Reviewed September 13, 2026, 8:03 PM ET / September 14, 2026, 00:03 UTC (Revision 3). ClawSweeper reviewWhat this changesReplaces slow progress-card Markdown preprocessing with a bounded tag scanner and adds compatibility and browser responsiveness regressions. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: this remains a useful fix absent from current main and v2026.9.4. The revised scanner resolves the prior compatibility findings, and the inspected WebKit evidence supports the targeted performance improvement. No blocking code defect remains. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI receives progress-card text and refresh events from the Gateway. Its Markdown renderer removes raw-content blocks and sanitizes the resulting HTML before displaying progress cards. flowchart LR
A[Gateway progress text] --> B[Markdown size guard]
B --> C[Raw-content scanner]
C --> D[Markdown or plain-text rendering]
D --> E[HTML sanitization]
E --> F[Visible progress card]
G[Gateway refresh event] --> A
Before merge
Agent review detailsSecurityNone. PR surfaceSource +134, Tests +166. Total +300 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep progress preprocessing bounded within the existing renderer while preserving raw-tag matching semantics and final HTML sanitization. Do we have a high-confidence way to reproduce the issue? Yes for the targeted defect: 17,500 unclosed script tags reach the current-main replacement regex before its parse-size fallback, with supplied JavaScriptCore and WebKit timing evidence. This review did not execute the reproducer, and the original reporter's payload remains unknown. Is this the best way to solve the issue? Yes: replacing the repeated-search preprocessing operation preserves the existing rendering owner and sanitization boundary; the revised matching rules address the prior behavioral differences. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0176c61961da. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4830ecb7a
ℹ️ 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".
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Before / after: progress-card renderingSame mocked-Gateway progress card with 140,000 characters of repeated unclosed
The corrected card also visibly updates after Independent reproductionOn system JavaScriptCore on macOS 26.3.1, the original preprocessing operation took 6,171 / 6,183 / 6,382 ms across three runs of the 140,000-character case. The corrected scanner took 2 / 1 / 2 ms, with identical output. These measure preprocessing only, separately from the WebKit hovercard timings above. The published renderer tests failed on the original implementation at approximately 198 ms against the 100 ms limit. With the corrected renderer, all 4 tests passed, including that case at 22 ms. node scripts/run-vitest.mjs ui/src/components/markdown.progress.node.test.ts --maxWorkers=1 --reporter=verbose --configLoader runnerRisk and coverageThis confirms the specific repeated-tag performance defect and the tested content-removal behavior. The original reporter's message remains unavailable, so this does not establish the cause of every hang reported in #143713. The screenshots are contributor-supplied WebKit evidence; the independent reproduction above covers system JavaScriptCore and the Node/jsdom renderer. |
|
Merged via squash.
|
…claw#147528) * fix(ui): prevent progress card regex stalls * test(ui): prove adversarial progress rendering * fix(ui): preserve progress raw tag semantics



Closes #143713
What Problem This Solves
Fixes: the macOS Control UI can spend seconds in JavaScriptCore RegExp processing when a progress-card message contains many unmatched raw-content opening tags.
User Impact
User impact: malformed or adversarial progress-card content no longer stalls the Control UI main thread, while normal progress rendering and sanitization remain unchanged.
Why This Change Was Made
The existing raw-content block regex restarts its closing-tag search for every unmatched opener. At the existing 140,000-character markdown limit, 17,500 unmatched
<script>tags reproduce the reportedString.replace/ JavaScriptCore Yarr hot path deterministically.This replaces that regex with a bounded scanner that tokenizes candidate tags once, indexes compatible closing tags, and pairs each opener with the first valid closer after its end without repeatedly rescanning the message. It retains the old
/giuregex's Unicode case-folding and word-boundary behavior, its complete\sclosing-tag whitespace set, and its overlapping-tag pairing semantics.Evidence
Maintainer before/after screenshots and independent reproduction.
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc).progressCard.changedand visibly refreshed the card in 25 ms. Browser version, Safari UA, payload size, and timings are burned into the screenshots below.node scripts/run-vitest.mjs ui/src/components/markdown.progress.node.test.ts --maxWorkers=1 --reporter=verbose— 4/4 passed, including Unicode folding/boundary, full closing whitespace, opener-end pairing, and both adversarial timing cases through the public progress-card renderer.progressCard.get, verifies the actual hovercard renders, emitsprogressCard.changed, and verifies the same hovercard updates. The focused test passed in 1.844 s.pnpm check:changedpassed through formatting, lint, UI typecheck, dead-export scans, and changed-code checks with the isolated worktree root.Before: pre-fix WebKit hovercard
Candidate: repaired WebKit hovercard
Candidate: responsive after Gateway refresh
The reporter's original WebSocket payload is not available. The regression case instead exercises the exact affected progress-card preprocessing path with the same
String.replace→ JavaScriptCore Yarr signature described in the issue.