Skip to content

fix(browser): stop malformed localhost pages from freezing the new tab page probe - #34427

Merged
AmoabaKelvin merged 1 commit into
mainfrom
sta-11898-port-probe-quadratic-parse
Oct 27, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
sta-11898-port-probe-quadratic-parse

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24

The browser's new tab page probes local servers for their title and icon. A localhost page full of unclosed <link or <title> tags could freeze Orca's main process, or the runtime server for a remote workspace, for seconds. Those pages now parse in a few milliseconds.

The title and icon-link regexes rescanned the rest of the body from every opener that had no closing > or </title>, so the parse grew quadratically with page size. It runs synchronously, so the 1.5 s HTTP timeout couldn't cut it short. Both now scan forward once: find the opener, then indexOf('>'), then continue from there. Titles and icons come out the same as before for every input (real sites plus a 200k-case differential fuzz against the old regexes). The loopback, same-origin and size checks are unchanged.

Time spent in probeWorkspacePortPage with a loopback server serving each page:

Page Before After
<title>ok</title> + '<link '.repeat(32000) (192 KB) 2.3 s 9 ms
'<title>'.repeat(27000) (189 KB) 0.75 s 8 ms

Linear: STA-11898

…b page probe

The title and icon-link regexes rescanned the rest of the body from every
unclosed opener, so a 192 KB page of repeated '<link ' or '<title>' blocked
the main or runtime event loop for seconds. Scan tags forward only.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7b7fa0b1-6a6e-45c1-84ba-faa040a2ed1a
Commits

Reviewing files that changed from the base of the PR and between 89dea21 and c035ecc.

Files selected for processing: 2
  • src/main/ports/workspace-port-page-probe.test.ts
  • src/main/ports/workspace-port-page-probe.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Walkthrough

The page probe now scans forward to extract a title and find link tags. It returns no title or icon when the required closing delimiter is missing. New tests check the parsed results and runtime for pages with many unclosed link or title tags.

Priority: Normal

Merge Risk: Minimal · up to c035e

The change is ready to merge after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the problem, mechanism, performance impact, and testing results, but it does not follow the required template. It lacks an actual linked issue, required section headings, visu… Add the required template sections. Include a direct issue link under Linked Issue, complete Visual Proof with attachments or N/A plus a reason, document testing and platforms, complete AI Disclosure when applicable, and address the Notes a…
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: preventing malformed localhost pages from freezing the new tab page probe.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, mechanism, performance impact, and testing results, but it does not follow the required template. It lacks an actual linked issue, required section headings, visual proof or an N/A explanation, testing checklist details, and the remaining checklist information.

Resolution

Add the required template sections. Include a direct issue link under Linked Issue, complete Visual Proof with attachments or N/A plus a reason, document testing and platforms, complete AI Disclosure when applicable, and address the Notes and Checklist items.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmoabaKelvin
AmoabaKelvin merged commit f61e7f8 into main Oct 27, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant