Skip to content

perf(ui): speed up progress-card raw scanning - #147991

Closed
steipete wants to merge 1 commit into
mainfrom
codex/control-ui-startup-budget-fix
Closed

steipete wants to merge 1 commit into
mainfrom
codex/control-ui-startup-budget-fix

Conversation

@steipete

@steipete steipete commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Progress-card Markdown preprocessing repeatedly allocates substrings and runs Unicode regular expressions for ordinary ASCII raw-content tags. On large malformed progress text, that work can cross the bounded preprocessing budget under runner load.

Add allocation-light ASCII checks for raw tag names, word boundaries, and closing-tag whitespace. Keep the existing Unicode regular expressions as fallbacks, preserving mixed-case, Unicode case-folding and boundary behavior, malformed closing-tag rejection, and raw-block removal semantics.

Validation on the current-main replacement head:

  • repeated-unclosed-tag preprocessing: 12 ms locally against the 100 ms bound
  • malformed-closing-tag preprocessing: 5 ms locally against the 100 ms bound
  • all 4 progress-card Markdown tests passed
  • node scripts/check-changed.mjs passed
  • pinned-base P0-P2 autoreview: clean

There is no visual output change, so screenshot evidence does not apply.

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XS maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 14, 2026, 5:18 AM ET / 09:18 UTC (Revision 5).

ClawSweeper review

What this changes

The PR reduces substring allocation and regular-expression work when scanning progress-card Markdown while preserving existing tag-matching behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: the remaining optimization is distinct from the merged repairs, and the pinned diff introduces no actionable correctness finding. The earlier startup-loading concern no longer applies to this narrowed patch.

Priority: P2
Reviewed head: ead8e0591705bbb7c467b0ac5c6dd56ab2750623

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving optimization with relevant existing coverage and reported targeted validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal optimization is exempt from the external contributor proof gate. Reported timings exercise the changed preprocessing owner; no browser speedup is independently established, and unchanged visual output does not require screenshots.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored internal optimization is exempt from the external contributor proof gate. Reported timings exercise the changed preprocessing owner; no browser speedup is independently established, and unchanged visual output does not require screenshots.
Evidence reviewed 8 items Pinned introduced change: The verified merge-base-to-head diff changes only raw-tag recognition and character classification. ASCII checks accept subsets of the existing regular expressions; the original expressions remain fallbacks. The five tag names cannot compete for the same prefix, so the two-pass lookup preserves candidate selection.
Optimization remains absent from reviewed main: Fetched main still uses sliced tag names and regular expressions for every candidate and closing whitespace character. Its pairing and removal algorithm already exists; this PR optimizes that owner rather than introducing a competing implementation.
Existing semantic and timing coverage: The four existing tests cover progress-only markup, unsafe-attribute removal, mixed case, Unicode folding and boundaries, closing whitespace, overlapping tags, 17,500 unmatched openers, and malformed closers. Both preprocessing limits remain 100 ms. Tests were inspected, not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

Control UI progress cards send their Markdown through raw-content removal before rendering and HTML sanitization. This scanner removes paired raw-content blocks and passes the remaining text to the existing renderer.

flowchart LR
  A[Progress card Markdown] --> B[Input length limit]
  B --> C[ASCII tag checks]
  C --> D[Unicode fallback when needed]
  C --> E[Pair and remove raw blocks]
  D --> E
  E --> F[Markdown rendering and sanitization]
  F --> G[Displayed progress card]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +32. Total +32 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 40 8 +32
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 40 8 +32

Review metrics

None.

Technical review

Best possible solution:

Keep the optimization within the existing scanner, preserving Unicode semantics, removal behavior, sanitization, and the unchanged preprocessing budgets.

Do we have a high-confidence way to reproduce the issue?

No independently established timing failure: the existing adversarial inputs provide a concrete check, but exceeding 100 ms depends on runtime load and was not reproduced in this read-only review.

Is this the best way to solve the issue?

Yes. The patch optimizes the existing scanner without changing its pairing algorithm, accepted character sets, public interfaces, or performance thresholds.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5c12872ea0f0.

Labels

Label justifications:

  • P2: This is a bounded performance improvement to progress-card preprocessing with existing semantic and timing contracts.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored internal optimization is exempt from the external contributor proof gate. Reported timings exercise the changed preprocessing owner; no browser speedup is independently established, and unchanged visual output does not require screenshots.

Evidence

What I checked:

  • Pinned introduced change: The verified merge-base-to-head diff changes only raw-tag recognition and character classification. ASCII checks accept subsets of the existing regular expressions; the original expressions remain fallbacks. The five tag names cannot compete for the same prefix, so the two-pass lookup preserves candidate selection. (ui/src/components/markdown-raw-content.ts:11, ead8e0591705)
  • Optimization remains absent from reviewed main: Fetched main still uses sliced tag names and regular expressions for every candidate and closing whitespace character. Its pairing and removal algorithm already exists; this PR optimizes that owner rather than introducing a competing implementation. (ui/src/components/markdown-raw-content.ts:28, 5c12872ea0f0)
  • Existing semantic and timing coverage: The four existing tests cover progress-only markup, unsafe-attribute removal, mixed case, Unicode folding and boundaries, closing whitespace, overlapping tags, 17,500 unmatched openers, and malformed closers. Both preprocessing limits remain 100 ms. Tests were inspected, not executed during this read-only review. (ui/src/components/markdown.progress.node.test.ts:20, ead8e0591705)
  • Production entry point and security boundary: Progress cards call the shared Markdown renderer with progress bars enabled. Raw-block scanning runs before parsing, and every rendering branch retains HTML sanitization. The patch changes no permissions, authority-bearing values, dependencies, or sanitization options. (ui/src/components/markdown.ts:541, ead8e0591705)
  • Scanner history and related merged repair: The scanner was added by ad157ba; comparison against its raw recorded parent shows the new file. GitHub verifies fix(ui): prevent Control UI hangs on malformed progress content #147528 merged that scanner repair. It addresses the earlier repeated-search algorithm and does not contain this ASCII optimization. (ui/src/components/markdown-raw-content.ts:1, ad157baa20b1)
  • Prior merged area contributions: Main history identifies Jacqueline Henriksen's scanner repair and Peter Steinberger's progress-card feature and subsequent timing-test maintenance. These provide routing context independently of authorship of the proposed branch. (ui/src/components/markdown.progress.node.test.ts, 5c12872ea0f0)

Likely related people:

  • Jacqueline Henriksen: Raw commit ad157ba adds ui/src/components/markdown-raw-content.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ad157baa20b1; files: ui/src/components/markdown-raw-content.ts)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-14T06:26:33.349Z sha 4ce8731 :: blocked before merge. :: [P2] Preserve nonblocking loading when first opening System busyness
  • reviewed 2026-09-14T07:08:44.401Z sha ddcf4d4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T07:17:32.024Z sha ddcf4d4 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T07:40:14.903Z sha 53812ca :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 14, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete force-pushed the codex/control-ui-startup-budget-fix branch from 53812ca to 0b444df Compare September 14, 2026 08:12
@steipete steipete changed the title fix(ci): restore Control UI quality gates perf(ui): reduce startup and progress-card work Sep 14, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete force-pushed the codex/control-ui-startup-budget-fix branch from 0b444df to ead8e05 Compare September 14, 2026 08:46
@steipete steipete changed the title perf(ui): reduce startup and progress-card work perf(ui): speed up progress-card raw scanning Sep 14, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

#148030 landed the remaining transcript file-budget repair, while #147911 covered the sidebar/timing failures. The lazy-catalog reduction and ASCII scanner fast path here are optional, unrelated optimizations rather than current qualification blockers; they should return as focused changes only if current evidence requires them. Closing this conflicting mixed branch as superseded.

@vincentkoc vincentkoc closed this Sep 14, 2026
@RomneyDa
RomneyDa deleted the codex/control-ui-startup-budget-fix branch October 22, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants