Skip to content

Add end-to-end latency benchmarking and optimize axe scanning - #156

Merged
JustasMonkev merged 28 commits into
mainfrom
claude/mcp-perf-simplify-en6dxq
Aug 2, 2026
Merged

JustasMonkev merged 28 commits into
mainfrom
claude/mcp-perf-simplify-en6dxq

Conversation

@JustasMonkev

@JustasMonkev JustasMonkev commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Cuts end-to-end MCP tool latency by 66% (31.1s → 10.5s across the benchmark suite) and adds the benchmark that measures it. Every optimization removes work that was never needed, so the tool surface and its output are unchanged — except where this PR now reports coverage, or applies state, that it previously left implicit or got wrong.

Measured result

npm run bench, median of 5 iterations after 1 warmup, headless Chromium, against main:

Scenario before after Speedup
tools/list 3.6 ms 2.1 ms 1.75x
browser_click (ref + snapshot) 644.9 ms 223.2 ms 2.89x
browser_type (ref, fill only) 618.2 ms 176.7 ms 3.50x
browser_hover (ref + snapshot) 664.0 ms 251.3 ms 2.64x
browser_press_key 554.6 ms 159.2 ms 3.48x
scan_page (axe) 4728.3 ms 1615.1 ms 2.93x
audit_keyboard (12 tabs) 6218.8 ms 1362.2 ms 4.57x
scan_page_matrix (3 variants) 14066.9 ms 4402.7 ms 3.20x
audit_site (6 pages) 3391.6 ms 2020.9 ms 1.68x
TOTAL 31144.1 ms 10472.8 ms 2.97x (-66.4%)

Read the total, not the rows. This runner drifts: the baseline measured 4125, 4412 and 4728 ms for scan_page across three separate runs of unmodified main — a 15% spread on identical code. Treat individual rows as ±15%.

browser_navigate and browser_snapshot show single-digit percentage moves in both directions across runs — neither touches a changed code path; that is run-to-run variance on 40-130 ms scenarios.

The figure started at -73% and settled at -66.4%. Eight rounds of review fixes cost those points, and each one bought back a way for a result to be wrong or a coverage gap to go unreported. That is the right trade in an accessibility tool: the settle observation window, per-scan Axe injection, the ref resolve check and strict sequential emulation are all latency given back deliberately.

Scan path — scan_page, scan_page_matrix, audit_site

  • Run axe-core directly instead of through @axe-core/playwright. Its default path opens a blank helper page per scan, injects axe into it, and ships the whole partial-result set through it for axe.finishRun. Injecting into the frames that already exist and running axe.run in the main one produces identical results, cross-origin iframes included — verified against the wrapper on a page with same- and cross-origin frames before switching.
  • Reduce the result inside the page. Only violations, incomplete and the rule counts of passes/inapplicable are ever reported; a content-heavy page was serializing ~1.9 MB per scan to throw ~85% of it away.
  • Validate includeSelectors and excludeSelectors in one round trip instead of two.
  • Drops the @axe-core/playwright dependency, and with it the blank helper page that made scan_page fail on Electron CDP targets (Target.createTarget: Not supported).

Axe is injected fresh for every scan rather than reused when window.axe already looks right: that global belongs to the page, which may have installed its own axe or reconfigured ours.

Interaction path — click, type, hover, press_key, fill_form, audit_keyboard

  • Skip the fixed settle delay when the action issued no request and navigated nowhere — nothing was started, so there is nothing to settle. An action that finishes quietly is still watched for up to 100 ms (or the settle delay, whichever is shorter) in case it scheduled work on a timer rather than starting it; if something appears, the full settle applies. A request that fails releases the barrier the same way one that finishes does, so a doomed fetch cannot stall a click for ten seconds.
  • Resolve element refs against the snapshot already returned to the caller — which is where those refs came from — instead of capturing a fresh one per call. A cache hit is confirmed with a count() resolve check (~1.5 ms against the ~37 ms snapshot it avoids, and bounded by the same page-state timeout as every other read in Tab) so a ref whose element has gone still fails fast with "capture a new snapshot" rather than as an action timeout. The cache is invalidated on any main-frame navigation, which covers goBack(), page.reload(), meta refresh and page-driven location changes alike.

Coverage reporting (new behaviour)

A child frame Axe cannot be installed into contributes no violations, and previously said nothing about it — so a partly-scanned page read as clean. runAxeScan now returns an identifier for every such frame (URL plus frame name, since a srcdoc frame reports about:blank; both truncated, as either can carry a data URL), and all three scan tools surface them: a WARNING block, plus unscannedFrames per page and per variant in the JSON reports and in structuredContent. Reporting rather than failing, so one flaky third-party embed cannot break an entire audit.

Coverage is judged by probing each frame for this server's own configured injection after injection completes — not by what injection returned — so a frame that navigated mid-scan, or appeared late, or carries only the page's own axe, is counted as unscanned. Frames the caller scoped out with includeSelectors/excludeSelectors are not reported, since their contents were never going to be. Scope is resolved through the whole ancestor frame chain, so an include naming an ancestor still covers frames nested below it. Anything the check cannot resolve is reported rather than hidden.

Correctness fixes in scan_page_matrix

Both found in review, both changing what a report claims:

  • The page's own media emulation is preserved. Unset variant properties fell back to null, which resets a feature to the browser default rather than to the session's configured state — so a context created colorScheme: 'dark' was scanned light, including the baseline every other variant is diffed against, and was left light afterwards. The effective state is now measured from the page and used as both the per-variant fallback and the restore. applied.media consequently reports the effective value rather than null.
  • Zoom is applied after a reload, not before. Viewport and media emulation survive a reload; zoom is an inline style on documentElement and does not, so reloadBetweenVariants scanned unzoomed while applied.zoomPercent claimed otherwise.

Elsewhere

  • Snapshot the current tab and refresh the other tabs' titles concurrently.
  • Cache the tool list's JSON-schema conversion; look tools up by name instead of scanning.
  • truncateDataUrls: scan case-insensitively instead of lower-casing a copy of the whole text, and return the input untouched when it holds no data URL. This also fixes offsets after characters whose lower-case form is longer (e.g. İ).
  • audit_site reads each page's title and links in one evaluate.

Benchmark

bench/mcp-bench.mjs serves a fixed synthetic site, speaks MCP to the built server over stdio, and times real tools/call round trips. --server/--lib point it at another build so two revisions can be compared, and npm run bench:compare prints the table above. Documented in the README.

Verification

npm run lint and npm run typecheck clean; 707 tests pass. All 30 tools pass the direct MCP harness (npm run test:mcp) against a real browser.

23 failures in tests/tools-auditScreenReader.test.ts are container-only — they need a chromium.launch() this environment cannot provide — and reproduce unchanged on the base commit.

Note: the repo's CI workflow only triggers on PRs targeting feat/ branches, so no check runs appear on this PR.

https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

Summary by CodeRabbit

  • New Features

    • Accessibility scans now report unscanned frames and warn when results may be incomplete.
    • Page-matrix scans preserve and restore media preferences and zoom settings.
    • Added benchmark commands for measuring and comparing tool-call latency.
  • Bug Fixes

    • Improved settling for delayed network activity and navigation.
    • Enhanced accessibility scan coverage, nested-frame handling, selector scoping, snapshot reuse, and partial-scan comparisons.
    • Improved responsiveness through cached tool schemas, snapshots, and optimized data URL handling.
  • Documentation

    • Clarified timeout behavior, frame-scan warnings, scanning workflows, and benchmarking.

Every optimization here removes work that was never needed, so the tool
surface and its output are unchanged.

Scan path (scan_page, scan_page_matrix, audit_site)
- Run axe-core directly instead of through @axe-core/playwright. Its default
  path opens a blank helper page per scan, injects axe into it, and ships the
  whole partial-result set through it for `axe.finishRun`. Injecting into the
  frames that already exist and running `axe.run` in the main one produces
  identical results, cross-origin iframes included (verified against the
  wrapper on a page with same- and cross-origin frames).
- Reduce the result inside the page. Only violations, incomplete and the rule
  counts of passes/inapplicable are ever reported; a content-heavy page was
  serializing ~1.9MB per scan to throw ~85% of it away.
- Skip re-injecting axe into a frame that already holds this exact build.
- Validate include and exclude selectors in one round trip instead of two.
- Removes the @axe-core/playwright dependency, and with it the blank helper
  page that made scan_page fail on Electron CDP targets.

Interaction path (click, type, hover, press_key, fill_form, audit_keyboard)
- Skip the fixed settle delay when the action issued no request and navigated
  nowhere: nothing was started, so there is nothing to settle. Worth ~500ms per
  action, and ~25s on a default 50-step keyboard audit.
- Resolve element refs against the snapshot already returned to the caller -
  which is where those refs came from - instead of capturing a fresh one per
  call. A ref the cached snapshot does not hold still costs one capture.

Elsewhere
- Snapshot the current tab and refresh the other tabs' titles concurrently.
- Cache the tool list's JSON-schema conversion; look tools up by name.
- truncateDataUrls: scan case-insensitively instead of lower-casing a copy of
  the whole text, and return the input untouched when it holds no data URL.
  This also fixes offsets after characters whose lower-case form is longer.
- audit_site reads each page's title and links in one evaluate; scan_page_matrix
  applies viewport, media and zoom together.

Measured with the new benchmark (`npm run bench`), median of 5 iterations,
headless Chromium, against the previous commit:

  tools/list                       5.6ms  ->    1.8ms   3.10x
  browser_click                  657.4ms  ->  107.1ms   6.14x
  browser_type                   602.1ms  ->   60.9ms   9.88x
  browser_hover                  660.0ms  ->  124.5ms   5.30x
  browser_press_key              556.1ms  ->   51.4ms  10.81x
  scan_page                     4125.6ms  -> 1271.8ms   3.24x
  audit_keyboard (12 tabs)      6177.6ms  ->  100.0ms  61.76x
  scan_page_matrix (3 variants)13463.4ms  -> 4053.5ms   3.32x
  audit_site (6 pages)          3235.0ms  -> 2028.9ms   1.59x
  TOTAL                        29722.7ms  -> 8037.1ms   3.70x  (-73.0%)

bench/mcp-bench.mjs serves a fixed synthetic site, speaks MCP to the built
server over stdio, and times real tools/call round trips; `--server`/`--lib`
point it at another build so two revisions can be compared, and
`npm run bench:compare` prints the table above.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn
@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@JustasMonkev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b620c2d0-28f0-411b-84de-f190518bd3a9

📥 Commits

Reviewing files that changed from the base of the PR and between 750f6c2 and 7443761.

📒 Files selected for processing (4)
  • bench/mcp-bench.mjs
  • src/tools/axe.ts
  • tests/bench.test.ts
  • tests/tools-axe.test.ts

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds an MCP latency benchmark and updates Axe scanning, frame reporting, accessibility snapshot reuse, conditional settling, data-URL processing, tests, and documentation.

Changes

Runtime and benchmarking changes

Layer / File(s) Summary
MCP latency benchmark workflow
bench/*, package.json, README.md, AGENTS.md, .oxlintrc.json, tests/bench.test.ts
Adds deterministic fixtures, MCP scenarios, microbenchmarks, reports, comparison mode, scripts, documentation, tests, and lint overrides.
Direct Axe scanning and audit flow
src/tools/axe.ts, src/tools/auditSite.ts, src/tools/scanPageMatrix.ts, src/tools/snapshot.ts, tests/tools-axe.test.ts, tests/tools-auditSite*, tests/tools-scanPageMatrix.test.ts, tests/tools-snapshot.test.ts, SKILL.md
Uses injected axe-core, combines page reads, preserves full violation objects, reports unscanned frames, and preserves ordered scan variant state.
Tool dispatch and browser state reuse
src/browserServerBackend.ts, src/response.ts, src/tab.ts, src/tools/tool.ts, tests/tab.test.ts
Caches tool schemas and accessibility snapshots, uses direct tool lookup, and runs independent finalization work concurrently.
Conditional settling and data-URL processing
src/tools/utils.ts, src/utils/dataUrl.ts, tests/tools-utils.test.ts, tests/utils.test.ts, README.md
Applies settle delays after requests or navigation and reduces allocations during data-URL scanning.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Benchmark
  participant FixtureServer
  participant MCPClient
  participant BuiltCLI
  Benchmark->>FixtureServer: Serve synthetic pages
  Benchmark->>MCPClient: Connect to built CLI
  MCPClient->>BuiltCLI: List and call tools
  BuiltCLI->>FixtureServer: Load benchmark pages
  MCPClient-->>Benchmark: Return results and timings
Loading

Possibly related PRs

Suggested labels: codex

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.03% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two primary changes: end-to-end latency benchmarking and Axe scanning optimization.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/mcp-perf-simplify-en6dxq

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (5)
bench/mcp-bench.mjs (2)

40-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use os.tmpdir() for the benchmark output directory.

process.env.TMPDIR is unset on Windows, so the fallback /tmp is used there and mkdtempSync fails. os.tmpdir() reads TMPDIR, TMP, and TEMP and returns a valid platform default.

♻️ Proposed fix
 import http from 'node:http';
+import os from 'node:os';
 import path from 'node:path';
-const outputDir = fs.mkdtempSync(path.join(process.env.TMPDIR ?? '/tmp', 'mcp-bench-'));
+const outputDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mcp-bench-'));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bench/mcp-bench.mjs` at line 40, Update the benchmark output directory
initialization to use os.tmpdir() as the base path instead of manually reading
process.env.TMPDIR with a /tmp fallback, and ensure the os module is imported or
otherwise available in bench/mcp-bench.mjs.

145-166: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Wrap the measurement phase in try/finally so a failed scenario still releases resources.

Cleanup at lines 164-166 runs only when every scenario and micro-benchmark succeeds. If a scenario throws, for example when refFor finds no matching ref or a tool call returns isError, the client is not closed, the fixture server is not closed, and the temp outputDir is left behind. Repeated failed runs then accumulate temp directories and can leave the spawned browser process alive.

♻️ Proposed restructure
-const results = [];
-for (const scenario of scenarios) {
-  const samples = [];
-  let state;
-  for (let index = 0; index < warmups + iterations; index++) {
-    state = scenario.setup ? await scenario.setup() : undefined;
-    const startedAt = performance.now();
-    await scenario.run(state);
-    const elapsed = performance.now() - startedAt;
-    if (index >= warmups)
-      samples.push(elapsed);
-  }
-  const stats = summarize(samples);
-  results.push({ name: scenario.name, ...stats });
-  process.stderr.write(`${scenario.name.padEnd(34)} median ${stats.median.toFixed(1).padStart(9)} ms   mean ${stats.mean.toFixed(1).padStart(9)} ms\n`);
-}
-
-results.push(...await runMicroBenchmarks());
-
-await client.close().catch(() => {});
-await new Promise(resolve => server.close(resolve));
-fs.rmSync(outputDir, { recursive: true, force: true });
+const results = [];
+try {
+  for (const scenario of scenarios) {
+    const samples = [];
+    let state;
+    for (let index = 0; index < warmups + iterations; index++) {
+      state = scenario.setup ? await scenario.setup() : undefined;
+      const startedAt = performance.now();
+      await scenario.run(state);
+      const elapsed = performance.now() - startedAt;
+      if (index >= warmups)
+        samples.push(elapsed);
+    }
+    const stats = summarize(samples);
+    results.push({ name: scenario.name, ...stats });
+    process.stderr.write(`${scenario.name.padEnd(34)} median ${stats.median.toFixed(1).padStart(9)} ms   mean ${stats.mean.toFixed(1).padStart(9)} ms\n`);
+  }
+
+  results.push(...await runMicroBenchmarks());
+} finally {
+  await client.close().catch(() => {});
+  await new Promise(resolve => server.close(resolve));
+  fs.rmSync(outputDir, { recursive: true, force: true });
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bench/mcp-bench.mjs` around lines 145 - 166, Wrap the scenario and
micro-benchmark execution, including the results processing, in a try/finally
block, and move the existing client close, server close, and outputDir removal
into the finally block. Use the existing client, server, and outputDir cleanup
operations unchanged so resources are released when any benchmark fails.
src/tools/axe.ts (2)

185-204: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Consider recording which child frames went unscanned.

A child frame that rejects injection, or that exceeds childFrameInjectionTimeoutMs, is skipped with no record. The scan then reports a clean result for a page whose iframe content was never examined. axe's frame-tested rule would flag this, but it carries the best-practice tag and defaultAxeTags selects only wcag* and section508, so it does not run by default.

Returning the skipped frame URLs from injectAxeIntoFrames and adding them to AxeScanResult would let audit_site and scan_page_matrix state the coverage limit in their reports. This mirrors how the crawl already reports session losses instead of silently auditing signed-out pages.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tools/axe.ts` around lines 185 - 204, Update injectAxeIntoFrames to
collect and return the URLs of child frames whose injection rejects or exceeds
childFrameInjectionTimeoutMs, while preserving successful injection behavior.
Add this skipped-frame information to AxeScanResult and propagate it through
audit_site and scan_page_matrix so their reports explicitly state when iframe
coverage is incomplete.

269-295: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Widening the trimmed type removes the compile-time trimming guarantee.

trimAxeResults now returns AxeViolation[] instead of a distinct trimmed type. PageReport.violations in src/tools/auditSite.ts and VariantResult.violations in src/tools/scanPageMatrix.ts are also AxeViolation[]. Assigning axeResult.violations straight into either field now compiles, which would bypass maxNodesPerViolation and write an unbounded node list into the JSON report.

Both call sites are correct today. A branded return type would keep the compiler enforcing that only trimmed violations reach a report field.

♻️ Optional: brand the trimmed result
+declare const trimmed: unique symbol;
+export type TrimmedAxeViolation = AxeViolation & { readonly [trimmed]?: true };
+
 export function trimAxeResults(
   violations: AxeViolation[],
   options: { maxNodesPerViolation: number; dedupe?: boolean }
-): AxeViolation[] {
+): TrimmedAxeViolation[] {

PageReport.violations and VariantResult.violations then declare TrimmedAxeViolation[].

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tools/axe.ts` around lines 269 - 295, Restore a distinct branded
trimmed-violation type for trimAxeResults and use it for the report-facing
violations fields in PageReport and VariantResult. Update prepareAxeResults so
its trimmed result preserves this type, while deduped results remain untrimmed;
ensure direct assignment of untrimmed AxeViolation[] to report violations is
rejected at compile time.
tests/tools-axe.test.ts (1)

17-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

The harness cannot exercise injection reuse or the child-frame timeout.

The fake frame returns undefined for the version probe, so injected === axe.version in src/tools/axe.ts is never true and the skip-redundant-injection path never runs. frames() returns only the object that mainFrame() also returns, so frame === mainFrame always holds and the child-frame Promise.race against childFrameInjectionTimeoutMs never runs.

Both paths are new in this PR. The injection skip is a stated performance goal, and the race carries the unhandled-rejection concern that the source comment at lines 195-196 calls out. Adding a second frame to the harness and letting the probe report a configurable version would cover both.

♻️ Sketch: make the probe and the frame list configurable
-function pageWithSelectorCounts(countBySelector: Record<string, number> = {}) {
-  const frame = {
+function pageWithSelectorCounts(
+  countBySelector: Record<string, number> = {},
+  frameOptions: { injectedVersion?: string; childFrames?: { evaluate: (...args: any[]) => any }[] } = {}
+) {
+  const frame = {
     evaluate: async (script: unknown, arg?: unknown) => {
-      // Injection: the version probe, then the axe source as a string.
-      if (typeof script === 'string' || arg === undefined)
-        return undefined;
+      if (typeof script === 'string')
+        return undefined;
+      // The version probe: answering with the injected build exercises the skip path.
+      if (arg === undefined)
+        return frameOptions.injectedVersion;
       if (Array.isArray(arg))
         return arg.map(selector => countBySelector[selector as string] ?? 0);
       lastScan = arg as ScanCall;
       if (scanResult instanceof Error)
         throw scanResult;
       return scanResult;
     },
   };
   return {
     ...frame,
-    frames: () => [frame],
+    frames: () => [frame, ...(frameOptions.childFrames ?? [])],
     mainFrame: () => frame,
   } as any;
 }

A child frame whose evaluate never settles then covers the timeout branch, and one that rejects covers the swallowed-failure branch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/tools-axe.test.ts` around lines 17 - 36, Update pageWithSelectorCounts
to accept configurable injected-version and child-frame behavior: have the
version probe return the configured version so axe injection reuse is exercised,
and make frames() include a distinct child frame while mainFrame() continues
returning the main frame. Allow the child frame’s evaluate to remain pending or
reject so tests cover the timeout and swallowed-failure branches around
child-frame injection.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bench/mcp-bench.mjs`:
- Around line 313-316: Validate the values parsed for the --iterations and
--warmups flags before storing them in parsed, rejecting missing, non-numeric,
or otherwise invalid values with a clear command-line error. Update the
argument-parsing logic around these flag branches so execution stops with the
validation message instead of allowing NaN to reach the sampling loop and
summarize.

In `@src/tab.ts`:
- Around line 358-377: Invalidate collected artifacts before navigating back so
refLocators cannot reuse a snapshot from the page being left. Update goBack() to
call _clearCollectedArtifacts() before page.goBack(), and add a regression test
covering snapshot capture, goBack(), and a subsequent ref lookup that triggers a
fresh capture.

In `@src/tools/auditSite.ts`:
- Around line 578-587: Update the nav branch that assigns linkSelector so it
also requires item.depth < params.maxDepth, matching the links strategy and
preventing depth-1 URLs when maxDepth is 0. Keep the existing item.depth === 0
requirement for nav crawling.

In `@tests/tools-auditSite.test.ts`:
- Around line 714-716: Strengthen the assertion around the readPage evaluation
in the audit-site test so it verifies evaluate was called at least once, while
retaining the check that every call uses no selector argument. Update the
assertion associated with crawlTab.page.evaluate to cover both page-title
reading and disabled link discovery.

---

Nitpick comments:
In `@bench/mcp-bench.mjs`:
- Line 40: Update the benchmark output directory initialization to use
os.tmpdir() as the base path instead of manually reading process.env.TMPDIR with
a /tmp fallback, and ensure the os module is imported or otherwise available in
bench/mcp-bench.mjs.
- Around line 145-166: Wrap the scenario and micro-benchmark execution,
including the results processing, in a try/finally block, and move the existing
client close, server close, and outputDir removal into the finally block. Use
the existing client, server, and outputDir cleanup operations unchanged so
resources are released when any benchmark fails.

In `@src/tools/axe.ts`:
- Around line 185-204: Update injectAxeIntoFrames to collect and return the URLs
of child frames whose injection rejects or exceeds childFrameInjectionTimeoutMs,
while preserving successful injection behavior. Add this skipped-frame
information to AxeScanResult and propagate it through audit_site and
scan_page_matrix so their reports explicitly state when iframe coverage is
incomplete.
- Around line 269-295: Restore a distinct branded trimmed-violation type for
trimAxeResults and use it for the report-facing violations fields in PageReport
and VariantResult. Update prepareAxeResults so its trimmed result preserves this
type, while deduped results remain untrimmed; ensure direct assignment of
untrimmed AxeViolation[] to report violations is rejected at compile time.

In `@tests/tools-axe.test.ts`:
- Around line 17-36: Update pageWithSelectorCounts to accept configurable
injected-version and child-frame behavior: have the version probe return the
configured version so axe injection reuse is exercised, and make frames()
include a distinct child frame while mainFrame() continues returning the main
frame. Allow the child frame’s evaluate to remain pending or reject so tests
cover the timeout and swallowed-failure branches around child-frame injection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ee38020-a1f6-4364-9e07-94185f13c51f

📥 Commits

Reviewing files that changed from the base of the PR and between d870130 and 8802371.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • .oxlintrc.json
  • AGENTS.md
  • README.md
  • SKILL.md
  • bench/fixture.mjs
  • bench/mcp-bench.mjs
  • package.json
  • src/browserServerBackend.ts
  • src/response.ts
  • src/tab.ts
  • src/tools/auditSite.ts
  • src/tools/axe.ts
  • src/tools/scanPageMatrix.ts
  • src/tools/tool.ts
  • src/tools/utils.ts
  • src/utils/dataUrl.ts
  • tests/tab.test.ts
  • tests/tools-auditSite.integration.test.ts
  • tests/tools-auditSite.test.ts
  • tests/tools-axe.test.ts
  • tests/tools-utils.test.ts
  • tests/utils.test.ts

Comment thread bench/mcp-bench.mjs Resolved
Comment thread src/tab.ts Resolved
Comment thread src/tools/auditSite.ts Resolved
Comment thread tests/tools-auditSite.test.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8802371a82

ℹ️ 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".

Comment thread src/tools/utils.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread src/tab.ts Resolved
Comment thread bench/mcp-bench.mjs Resolved
Comment thread bench/mcp-bench.mjs Resolved
Comment thread bench/fixture.mjs Resolved
Codex and CodeRabbit findings on #156.

- waitForCompletion: an action that finished quietly is now watched for up
  to 100ms (or the settle delay, whichever is shorter) for the first request
  or navigation before the settle is skipped. Work a handler schedules on a
  timer rather than starting outright is caught, and then settles in full.
  The previous unconditional 500ms sleep never actually waited for such work
  either - it resolved its barrier first and covered the case by luck.
- Tab: clear the cached aria snapshot on any main-frame navigation instead of
  only in Tab.navigate(). goBack(), the page.reload() behind
  reloadBetweenVariants, a meta refresh and a page-driven location change all
  swap the document without going through it, and a ref resolved against the
  page the caller left would target the wrong document. Sub-frame navigations
  leave the cache alone.
- axe: always inject and configure axe-core rather than reusing a matching
  `window.axe`. That global belongs to the page, which may have installed its
  own copy or reconfigured ours; a scan must run this build with this
  configuration. The reuse was worth ~4%.
- bench: reject non-integer or out-of-range --iterations/--warmups before the
  fixture server and browser start, where NaN used to surface as a crash while
  formatting undefined statistics.
- bench: browser_type without `slowly` or `submit` takes no snapshot, so the
  scenario is named for the fill it actually measures.
- bench fixture: the intentionally unnamed buttons carried visible text, which
  supplied an accessible name, so button-name never fired. They now hold only
  an aria-hidden glyph.
- Test that asserted no link discovery passed vacuously on an empty call list;
  it now also asserts the page was read.

Four new tests: the quiet window catching scheduled work, and snapshot-cache
invalidation on main-frame versus sub-frame navigation.

Headline latency figures are being re-measured against the corrected fixture
and will follow on the PR; the quiet window and per-scan injection give back
some of the original margin by design.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

Copy link
Copy Markdown
Owner Author

Re-measured after the review fixes

The fixture changed (the intentionally unnamed buttons now really are unnamed, so button-name fires), so both sides were re-run from scratch. These supersede the numbers in the first commit message.

npm run bench, median of 5 iterations after 1 warmup, headless Chromium, 9de0113 against main:

Scenario before (ms) after (ms) Change Speedup
tools/list 3.6 2.0 -44.8% 1.81x
browser_navigate (heavy page) 118.2 135.0 +14.2% 0.88x
browser_snapshot (heavy page) 45.5 48.0 +5.3% 0.95x
browser_click (ref + snapshot) 644.9 221.0 -65.7% 2.92x
browser_type (ref, fill only) 618.2 160.6 -74.0% 3.85x
browser_hover (ref + snapshot) 664.0 238.1 -64.1% 2.79x
browser_press_key 554.6 148.0 -73.3% 3.75x
browser_find 45.7 42.6 -6.7% 1.07x
scan_page (axe) 4728.3 1324.3 -72.0% 3.57x
audit_keyboard (12 tabs) 6218.8 1362.4 -78.1% 4.56x
scan_page_matrix (3 variants) 14066.9 4250.0 -69.8% 3.31x
audit_site (6 pages) 3391.6 1969.1 -41.9% 1.72x
audit_screen_reader 43.6 41.8 -4.3% 1.04x
micro: truncateDataUrls (no data urls, 240 KB) 0.192 0.044 -77.1% 4.37x
micro: truncateDataUrls (data url heavy) 73.9 3.08 -95.8% 24.0x
micro: tool schema → JSON schema (all tools) 2.28 1.80 -21.2% 1.27x
TOTAL (end-to-end tool calls) 31144.1 9942.9 -68.1% 3.13x

What the two P1 fixes cost

Both were priced in deliberately, and the totals below are what the branch now claims:

  • The quiet observation window adds up to 100ms to each action that finishes without touching the network: browser_press_key 51 → 148ms, audit_keyboard 100 → 1362ms (12 steps × the window). That is the price of not skipping the settle on work a handler scheduled from a timer.
  • Per-scan axe injection adds ~70ms per frame to repeat scans of one page: scan_page_matrix 4054 → 4250ms. scan_page and audit_site are unaffected, since neither reused an injection anyway.

Together they take the headline from -73.0% to -68.1%.

Reading the two apparent regressions

browser_navigate (+14.2%) and browser_snapshot (+5.3%) are noise, not regressions — neither touches a changed code path. Across three paired runs they land on both sides of zero: browser_navigate measured -7.5% and +10.2% in the two earlier runs, browser_snapshot -6.0% and +0.4%. On 40-130ms scenarios that is run-to-run variance on a shared runner; the scenarios that actually changed move by 40-80% and are stable across all three pairs.


Generated by Claude Code

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/tab.ts (1)

57-59: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Invalidate cached AI refs when the page DOM changes.

refLocators() trusts _lastAriaSnapshot when the requested refs are present, so same-document mutations such as clicks, timers, form fills, or response handlers can leave stale refs in the snapshot. Invalidate the cache at mutation boundaries, or capture a fresh snapshot before resolving those refs. Add a regression test for a DOM-only mutation between captureSnapshot() and refLocators().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tab.ts` around lines 57 - 59, Ensure cached AI refs in _lastAriaSnapshot
are invalidated whenever the page DOM changes, including mutations caused by
clicks, timers, form fills, and response handlers, before refLocators() resolves
requested refs. Preserve the existing snapshot flow for unchanged pages, and add
a regression test covering a DOM-only mutation between captureSnapshot() and
refLocators().
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/tab.ts`:
- Around line 57-59: Ensure cached AI refs in _lastAriaSnapshot are invalidated
whenever the page DOM changes, including mutations caused by clicks, timers,
form fills, and response handlers, before refLocators() resolves requested refs.
Preserve the existing snapshot flow for unchanged pages, and add a regression
test covering a DOM-only mutation between captureSnapshot() and refLocators().

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 102f9163-ffe9-4c02-9824-ed732230fbca

📥 Commits

Reviewing files that changed from the base of the PR and between 8802371 and 9de0113.

📒 Files selected for processing (9)
  • README.md
  • bench/fixture.mjs
  • bench/mcp-bench.mjs
  • src/tab.ts
  • src/tools/axe.ts
  • src/tools/utils.ts
  • tests/tab.test.ts
  • tests/tools-auditSite.test.ts
  • tests/tools-utils.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • tests/tab.test.ts
  • bench/fixture.mjs
  • tests/tools-auditSite.test.ts
  • tests/tools-utils.test.ts
  • bench/mcp-bench.mjs
  • src/tools/axe.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9de01135e9

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
…olve

Second review round on #156.

Codex P1 - a child frame whose Axe injection failed or timed out was skipped
silently, so its violations vanished from a report that still looked clean.
runAxeScan now returns the URLs of those frames, and scan_page, audit_site and
scan_page_matrix all say so: a WARNING block naming the frames, plus
`unscannedFrames` per page and per variant in the JSON reports and in
structuredContent. Failing the whole scan instead would let one flaky embed
break every audit; what was missing is the report, not the tolerance. Frames
without an http(s) URL stay unreported - about:blank holds nothing to miss.

CodeRabbit - refLocators() trusting the cached snapshot for a page whose DOM
has since changed. Measured against a real page first: Playwright keeps a ref
bound to the element it was issued for, so a DOM change never moves a ref onto
a different element, and both the cached and the fresh-snapshot paths resolve
the same one. The case that does differ is an element that has since been
removed or replaced - the ref is still in the cached text but matches nothing,
which used to surface as our clear "capture a new snapshot" error and would now
have been an action timeout. So the cache hit is confirmed with a resolve
check: 1.5ms against the ~37ms snapshot it still avoids, and a stale ref fails
fast with the same message as before.

Tests: a cached ref that no longer resolves re-captures; a failed child-frame
injection is reported; about:blank frames are not; a healthy frame reports
nothing. README documents the new warning and the JSON fields.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3935b8aef

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/scanPageMatrix.ts Resolved
Comment thread bench/mcp-bench.mjs Resolved
…n up bench

Third review round on #156.

Codex P1 - the `^https?:` filter on unscanned frames suppressed exactly the
failures worth reporting. A srcdoc or scripted about:blank frame reports
"about:blank" while holding a complete document, and injection into a genuinely
empty frame succeeds, so a frame that reached that filter had already failed for
a reason. Every failed frame is now reported, identified by URL plus the frame's
name when it has one, since "about:blank" alone would not say which frame went
unscanned.

Codex P2 - scan_page_matrix carried unscannedFrames into its JSON report and
markdown warning but not into structuredContent, so a client reading only
structured output could read a partly-scanned variant as clean - which is what
the README promises it can tell apart. Added per variant.

Codex P2 - the benchmark cleaned up its client, fixture server and temp output
directory only on the success path, so a throwing scenario left the server
process, its browser and the directory behind. Wrapped in try/finally.

Verified: invalid --iterations/--warmups still fail before anything is started
(exit 1, named flag and value), a full benchmark run leaves no stray browser
behind, and all 30 tools pass the direct MCP harness.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tools/auditSite.ts`:
- Around line 735-738: Add non-empty partial-scan coverage in
src/tools/auditSite.ts lines 735-738 by extending the nearby audit_site Vitest
test to assert pagesWithUnscannedFrames and its text warning; also update the
nearby scan_page test in src/tools/snapshot.ts line 105 to assert the formatted
frame warning. Preserve existing empty-array cases and test the public reporting
for pages containing unscanned frames.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a98bd3e6-16d7-4219-b1b1-a1f0d6521143

📥 Commits

Reviewing files that changed from the base of the PR and between 9de0113 and 0e54e82.

📒 Files selected for processing (13)
  • README.md
  • bench/mcp-bench.mjs
  • src/tab.ts
  • src/tools/auditSite.ts
  • src/tools/axe.ts
  • src/tools/scanPageMatrix.ts
  • src/tools/snapshot.ts
  • tests/tab.test.ts
  • tests/tools-auditSite.integration.test.ts
  • tests/tools-auditSite.test.ts
  • tests/tools-axe.test.ts
  • tests/tools-scanPageMatrix.test.ts
  • tests/tools-snapshot.test.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • tests/tools-auditSite.integration.test.ts
  • tests/tools-auditSite.test.ts
  • src/tab.ts
  • bench/mcp-bench.mjs
  • tests/tab.test.ts
  • src/tools/scanPageMatrix.ts
  • README.md
  • src/tools/axe.ts

Comment thread src/tools/auditSite.ts Resolved
Fourth review round on #156.

CodeRabbit - the unscanned-frame reporting added last round was only tested
where the list is empty. runAxeScan populating it was covered, but nothing
asserted that the tools actually say so, which is the part that stops a
partly-scanned page reading as clean.

Four tests: scan_page naming every frame it could not reach and staying silent
when it reached them all, and audit_site doing the same across a crawl - warning
text, per-page unscannedFrames in the JSON report, and pagesWithUnscannedFrames
in structuredContent, since a client reading only structured output has to be
able to tell the difference too.

Checked they are not vacuous: stubbing out unscannedFrameLines() and the
audit_site page filter makes both warning tests fail, and restoring them passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be17d680db

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread bench/mcp-bench.mjs Resolved
Comment thread src/tools/scanPageMatrix.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread bench/mcp-bench.mjs Resolved
…bench args

Fifth review round on #156.

Codex P1 - frame coverage was decided from what injection returned, so a frame
that navigated while a slower sibling was still injecting kept its "injected"
verdict while its new document had no Axe. The run then skipped it and the
report looked complete. Coverage is now decided by probing the frames as they
are, immediately before the run, against a freshly read frame list - which also
catches a frame that appeared after injection started. The remaining window
(a navigation between that probe and the run) is microseconds instead of the
length of the slowest injection, and is documented as the ceiling.

Codex P2 - a failed data: frame put its entire encoded document into
unscannedFrames, and from there into tool text, structured content and JSON
reports. Routed through the repo's existing truncateDataUrl helper.

Codex P2 - the Set collapsed frames that describe identically, so two unnamed
about:blank frames were reported as one. Duplicates are kept: two failures are
two unscanned documents.

Codex P2 - scan_page_matrix applied viewport, media and zoom in parallel. A page
that writes document.documentElement.style.zoom from a resize or media handler
could overwrite the variant's zoom, and the report would then claim a zoom that
was never active. Back to the original strict ordering on both the apply and
restore paths; the parallelism was worth ~60ms of a ~4250ms scan.

Codex P2 - the benchmark created its temp output directory before connecting,
so a missing or unbuilt --server left the directory behind. Connection moved
inside the cleanup scope. String flags now reject a missing value during parsing
rather than running the whole suite and silently skipping the report.

Verified: `--out` with no value and a missing --server both exit 1 leaving no
temp directory, and all 30 tools pass the direct MCP harness.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

Copy link
Copy Markdown
Owner Author

Re-measured at f868246

The matrix emulation went back to sequential this round, so the numbers moved. Same baseline (main), same fixture, median of 5 after 1 warmup:

Scenario before (ms) after (ms) Change
tools/list 3.6 2.1 -43.0%
browser_click (ref + snapshot) 644.9 223.2 -65.4%
browser_type (ref, fill only) 618.2 176.7 -71.4%
browser_hover (ref + snapshot) 664.0 251.3 -62.2%
browser_press_key 554.6 159.2 -71.3%
scan_page (axe) 4728.3 1615.1 -65.8%
audit_keyboard (12 tabs) 6218.8 1362.2 -78.1%
scan_page_matrix (3 variants) 14066.9 4402.7 -68.7%
audit_site (6 pages) 3391.6 2020.9 -40.4%
micro: truncateDataUrls (data url heavy) 73.9 2.9 -96.0%
TOTAL 31144.1 10472.8 -66.4%

Down from -68.1% at 0e54e82. The correctness rounds cost about 1.7 points in total, which is the right trade: the settle observation window, per-scan Axe injection, the ref resolve check and now sequential emulation each bought back a way for a result to be wrong or a coverage gap to go unreported.

On reading these per-scenario

This runner drifts. The baseline measured 4125, 4412 and 4728 ms for scan_page across three separate runs of unmodified main — a 15% spread on the same code. So treat individual rows as ±15% and the total as the reliable figure; scan_page reading 1615 here against 1324 at 0e54e82 is within that band, and nothing in this round's diff touches the no-iframe path that scenario exercises.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f86824650f

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread src/tab.ts Resolved
Sixth review round on #156, all four on code added in the previous two rounds.

Codex P1 - the post-injection coverage probe called frame.evaluate with no
timeout, so an unresponsive child renderer hung the scan indefinitely instead of
producing the partial-coverage warning the probe exists to produce. Every read
from a child frame now shares one bound (withFrameTimeout), and a probe that
times out counts as unscanned. The injection race collapses into the same
helper.

Codex P2 - the probe compared window.axe.version, which a frame carrying the
page's own axe of the same version would satisfy while lacking the
allowedOrigins configuration the top-level run needs; it would then answer no
ping, contribute nothing, and still read as covered. The configure step now sets
a marker and the probe checks that instead. Any in-page marker can be forged by
the page, which is documented as the ceiling.

Codex P2 - frame.name() went into reports raw while only the URL was truncated.
It is author-controlled and unbounded, and can carry a data URL of its own, so
it is now whitespace-normalized, truncated and capped at 80 characters.

Codex P2 - Tab._refsResolve used locator.count(), which takes Playwright's
no-timeout query path, so an unresponsive renderer hung a ref-based interaction
on what is meant to be a ~1.5ms check. Wrapped in the same page-state timeout
the rest of the class uses; a check that cannot answer falls through to a fresh
capture.

Three tests: a frame with a page-owned axe is reported unscanned, an
author-controlled name is capped and truncated, and the existing coverage cases
still hold. All 30 tools pass the direct MCP harness.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c296ec9000

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/utils.ts Resolved
Comment thread src/tab.ts Resolved
…of the scan

Seventh review round on #156.

Codex P2 - waitForCompletion removed requests on `requestfinished` only. A
request that fails - offline, CORS-blocked, aborted - emits `requestfailed`
instead and stayed in the pending set until the 10s hard timeout, stalling the
tool call. The bug predates this branch, but the quiet window made it reachable
where it was not before: a delayed fetch that fails now gets detected and waited
on, where it used to fall through the 500ms settle. Both events share one
removal path.

Codex P2 - a frame scoped out of the scan was still reported as a coverage gap.
`excludeSelectors: ["iframe.chat-widget"]` is the documented way to drop a flaky
third-party widget, and that widget failing injection produced a warning about
content the caller deliberately removed. Scope is now checked from the iframe
element in its parent document, and only for frames that actually failed - which
is normally none, so a healthy scoped scan pays nothing. The check is fail-open:
an unreachable frame element, an unresolvable selector or a nested frame whose
exclusion lives in a grandparent document all fall through to reporting, so no
genuine gap is suppressed by a check that could not answer.

Not changed, with reasons in the PR threads: verifying that `axe.source` really
replaced a booby-trapped `window.axe` (any in-page postcondition is forgeable by
the same page, and this is the documented ceiling), and regenerating OpenWiki
(generated by external tooling with no in-repo entry point, and 89 commits stale
independently of this branch).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/tools/scanPageMatrix.ts (2)

222-232: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Capture and restore the page’s original media emulation before cleanup.

The cleanup block currently passes null for every media option, which disables emulation rather than restoring any existing non-default values set before scan_page_matrix runs. Save the original emulation state and restore it in the finally block for colorScheme, forcedColors, contrast, reducedMotion, and media.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tools/scanPageMatrix.ts` around lines 222 - 232, Update the
scan_page_matrix setup and cleanup flow around the visible viewport/zoom
restoration and tab.page.emulateMedia calls: capture the page’s original media
emulation values before applying scan settings, then restore those captured
values in the finally block for colorScheme, forcedColors, contrast,
reducedMotion, and media instead of passing nulls. Preserve the existing
viewport and zoom restoration behavior.

165-173: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reload before applying variant state.

page.reload() refreshes the page after document.documentElement.style.zoom is set. When params.reloadBetweenVariants is true, the scan can run with the original zoom while applied.zoomPercent still reports the requested zoom. Move the reload before setViewportSize/emulateMedia/zoom, or reapply those states after the reload. Add a regression test for zoom variants with reloadBetweenVariants.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tools/scanPageMatrix.ts` around lines 165 - 173, Move the reload in the
variant-processing flow before applying state through setViewportSize,
emulateMedia, and the zoom evaluate call, ensuring reloadBetweenVariants leaves
the requested zoom active for scanning and reporting. Add a regression test
covering zoom variants when params.reloadBetweenVariants is enabled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/tools/scanPageMatrix.ts`:
- Around line 222-232: Update the scan_page_matrix setup and cleanup flow around
the visible viewport/zoom restoration and tab.page.emulateMedia calls: capture
the page’s original media emulation values before applying scan settings, then
restore those captured values in the finally block for colorScheme,
forcedColors, contrast, reducedMotion, and media instead of passing nulls.
Preserve the existing viewport and zoom restoration behavior.
- Around line 165-173: Move the reload in the variant-processing flow before
applying state through setViewportSize, emulateMedia, and the zoom evaluate
call, ensuring reloadBetweenVariants leaves the requested zoom active for
scanning and reporting. Add a regression test covering zoom variants when
params.reloadBetweenVariants is enabled.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ec33c7b-ee11-4102-bc93-2e5a7b74fed3

📥 Commits

Reviewing files that changed from the base of the PR and between 0e54e82 and 246c124.

📒 Files selected for processing (8)
  • bench/mcp-bench.mjs
  • src/tab.ts
  • src/tools/axe.ts
  • src/tools/scanPageMatrix.ts
  • src/tools/utils.ts
  • tests/tools-auditSite.test.ts
  • tests/tools-axe.test.ts
  • tests/tools-snapshot.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • tests/tools-snapshot.test.ts
  • src/tab.ts
  • src/tools/utils.ts
  • tests/tools-auditSite.test.ts
  • bench/mcp-bench.mjs
  • tests/tools-axe.test.ts
  • src/tools/axe.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

// 32-bit FNV-1a hash; gives occurrence dedup a fixed-size key so the
// per-violation fingerprint sets do not retain full HTML strings.
function fastFingerprint(value: string): string {

P2 Badge Keep occurrence fingerprints collision-resistant

When distinct Axe nodes have normalized HTML values that collide under this 32-bit FNV-1a hash—a realistic birthday-bound risk across large 200-page audits and something page markup can deliberately induce—the second node is treated as an existing occurrence, so uniqueOccurrences is undercounted and sampleNodes may omit it. Retain the fixed-size storage benefit with a collision-resistant digest rather than replacing the previous SHA-256 fingerprint with 32 bits.

AGENTS.md reference: AGENTS.md:L27-L27

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
…d frame scope

scan_page_matrix reset media emulation to the browser default instead of the
state the page arrived in. A context created with colorScheme "dark" was
therefore scanned light - including the baseline every other variant is diffed
against - and left light after the tool returned. The effective state is now
measured from the page up front (matchMedia, folded into the existing zoom read
so it costs no extra round trip) and used both as the per-variant fallback and
to restore the page, the same way viewport and zoom already were.

With reloadBetweenVariants the zoom was applied before the reload. Viewport and
media emulation survive a reload but zoom is an inline style on documentElement
and the new document does not carry it, so the variant was scanned unzoomed
while applied.zoomPercent still claimed the requested zoom.

Frame scope was resolved only against the immediate parent document, but
closest() stops at a frame boundary while an Axe context does not: an iframe
nested inside an iframe inside #main was treated as scoped out of an
includeSelectors: ["#main"] scan and dropped from unscannedFrames, letting a
partial scan look clean. The whole ancestor chain is walked now, which also
makes an exclude on an outer frame correctly cover the frames beneath it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

Copy link
Copy Markdown
Owner Author

Round 8 — replies to the findings posted outside the diff

Three findings landed in review bodies rather than as inline threads, so there is nowhere to reply in place. Answering them here.

✅ scan_page_matrix: restore the page's own media emulation (CodeRabbit, 222-232)

Correct, and worse than the cleanup issue it was filed as — the same null fallback was on the apply path too, via normalizeMedia. So with a context created colorScheme: 'dark':

  • the baseline variant was scanned light, not dark — and every other variant's diffFromBaseline was computed against that wrong baseline;
  • applied.media.colorScheme reported null, so the report did not reveal it;
  • the page was left light after the tool returned.

I checked the premise before changing anything, because the fix depends on what null actually does:

context created with { colorScheme: 'dark', reducedMotion: 'reduce' }
after emulateMedia({colorScheme: null, ...})  →  { dark: false, reduce: false }

null resets to the browser default, not the context's value. Playwright exposes no getter for the effective state, so it is now measured from the page with matchMedia and used for both purposes — the per-variant fallback and the restore — exactly as originalViewport and originalZoom already were. Folded into the existing zoom read, so it costs no extra round trip.

prefers-contrast: less / custom are values emulateMedia cannot express; those restore as null, since leaving the feature un-emulated reproduces them exactly while naming a value would not.

Verified end-to-end in a real browser, not just against mocks:

measured original : {"zoom":"150%","media":{"colorScheme":"dark",...,"reducedMotion":"reduce",...}}
during variant    : {"colorScheme":"dark","forcedColors":"active","reducedMotion":"reduce",...}
after restore     : {"zoom":"150%","media":{"colorScheme":"dark",...,"reducedMotion":"reduce",...}}
RESTORED CORRECTLY: true

Note a deliberate output change: applied.media now reports the effective state ("light", "none", …) instead of null for properties a variant does not set. The field is named applied, and reporting what the variant actually ran under is the point of the fix.

✅ scan_page_matrix: apply zoom after the reload (CodeRabbit, 165-173)

Real, and the same class of bug as the emulation-ordering revert two rounds ago: a report claiming a zoom the variant never had. Measured rather than assumed:

before reload: { vw: 375, dark: true, forced: true, zoom: '200%' }
after  reload: { vw: 375, dark: true, forced: true, zoom: '(none)' }

Viewport and media emulation survive a reload; zoom does not, because it is an inline style on documentElement and the new document does not carry it. So with reloadBetweenVariants: true the scan ran unzoomed while applied.zoomPercent still said 200.

Rather than moving the reload to the front as suggested, it now sits between the media call and the zoom: viewport → media → reload → zoom. That keeps the property the original ordering was for — the page loads at the variant's viewport and media, which matters for anything that reads them at load — while putting zoom on the fresh DOM, still last.

⏭️ auditSite.ts:145 — 32-bit FNV-1a occurrence fingerprints (Codex, P2)

Skipping: the finding describes this PR as "replacing the previous SHA-256 fingerprint with 32 bits", and that is not what happened here. fastFingerprint is already on main at the same line 145, and this branch does not touch it:

$ git log origin/main..HEAD -S "fastFingerprint" -- src/tools/auditSite.ts
(no commits)
$ git show origin/main:src/tools/auditSite.ts | grep -n fastFingerprint
145:function fastFingerprint(value: string): string {

The underlying concern is legitimate — 32 bits gives a ~50% collision chance around 77k distinct nodes, which a 200-page audit can plausibly reach, and undercounting uniqueOccurrences is a real consequence. But changing the fingerprint changes audit output, and it belongs in its own change with its own test rather than riding along in a latency PR that never touched that line.


Verification: npm run lint and npm run typecheck clean; 707 tests pass (23 pre-existing chromium.launch() failures in tools-auditScreenReader.test.ts are container-only and reproduce on the base commit).

All four new tests were confirmed discriminating — I reverted each fix in turn and checked the test actually fails, rather than trusting a green run:

FAIL  keeps the session’s own media emulation across the scan
FAIL  applies zoom after a reload, not before it
FAIL  keeps a nested frame in scope when the include names an ancestor frame
FAIL  drops a nested frame when an ancestor frame is excluded

Running tally across eight rounds: 30 findings — 26 fixed, 4 declined with reasons.


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57dbf462e6

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/utils.ts Resolved
…me coverage

An interaction that navigates only a child frame skipped the settle delay
entirely. Swapping an iframe's srcdoc or pointing it at a data: URL replaces a
document without touching the network, so neither the request path nor the
main-frame path marked it as page work and the response was captured while the
replacement document was still initializing. It now signals like any other page
work, tracked separately so it does not gate the barrier on a top-level load
state a sub-frame navigation never produces.

Frame scope was resolved with closest(), which stops at a shadow boundary as
well as a frame one. An iframe inside a shadow root therefore did not match an
includeSelectors entry naming an ancestor of its host, and was dropped from
unscannedFrames - a partial scan looking clean. The walk now steps onto the host
via getRootNode() and continues, which also makes excluding a shadow host cover
the frames inside it.

Coverage was decided per frame, so a nested frame that took its own injection
counted as covered even when an ancestor had none. Axe reaches a nested document
only by relaying through the frames above it, and a frame without Axe relays
nothing, so both documents go unscanned. Coverage failure now propagates down
the frame tree and every affected document is listed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 581ddb9921

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/scanPageMatrix.ts Resolved
Comment thread src/tools/scanPageMatrix.ts Resolved
Comment thread bench/mcp-bench.mjs Resolved
…bench output

isFrameInScope looked up frameElement() unbounded. That call takes no timeout of
its own, so an unresponsive parent renderer would hang the scan on the very
check that exists to report unresponsive frames. It now shares the same 1s bound
as every other child-frame read, fails open to reporting the frame, and disposes
a handle that arrives after the bound rather than leaking it.

scan_page_matrix computed baseline deltas unconditionally. When a frame goes
unscanned on one side, a rule absent from that run may simply live in the
document nobody looked at, and the report called it resolved - or its
reappearance new. The warning said coverage was incomplete while the numbers
next to it stated an accessibility outcome the run could not support. Deltas are
now null whenever either side has unscanned frames: null rather than an empty
list in structuredContent, and "n/a (partial scan)" in the table, because an
empty list reads as "compared, nothing changed".

A page where neither prefers-color-scheme query matches was recorded as light,
which pins a preference it never had and leaves it pinned afterwards. It is now
left un-emulated, matching how the unrepresentable contrast values are handled.

Compare mode called process.exit() straight after writing the table. stdout is
only synchronous on a TTY, so piped into a consumer that applies backpressure
the tail was discarded: measured 608 of 4003 lines surviving, cut at the 64 KB
pipe buffer. It now waits for the writes to drain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0169kf5JnRWzLgwDDcBSmsnn

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Triggering explicitly: the last three commits (57dbf46, 581ddb9, 5e9f847) each hit the per-developer review rate limit and were never reviewed. They are not cosmetic — between them they change coverage reporting, media emulation, settle behaviour and delta suppression, so a review pass over them is worth having before this merges.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the unreviewed commits, including coverage reporting, media emulation, settle behavior, and delta suppression.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/tab.ts (1)

389-420: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject cached refs when the page changes during validation.

_refsMatchSnapshot() validates a cached snapshot across asynchronous locator.ariaSnapshot() calls. A main-frame navigation during those calls clears _lastAriaSnapshot, but the local cached value remains usable. If each locator call resolves with the old document state, refLocators() can return locators from the new document using refs from the old snapshot.

Record _pageGeneration before validation. Return false if it changes before validation completes. Add a regression test that navigates during ref validation and verifies that refLocators() captures a fresh snapshot.

Proposed fix
 private async _refsMatchSnapshot(params: { ref: string }[], snapshot: string): Promise<boolean> {
+  const pageGeneration = this._pageGeneration;
   const lines = snapshot.split('\n');
   const timeout = Math.min(this._pageStateTimeoutMs(), 1000);
   const matches = await Promise.all(params.map(async param => {
     // ...
   }));
-  return matches.every(Boolean);
+  return pageGeneration === this._pageGeneration && matches.every(Boolean);
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tab.ts` around lines 389 - 420, Update _refsMatchSnapshot to record
_pageGeneration before starting asynchronous ref validation and return false if
the generation changes before all checks complete, preventing stale cached refs
from being reused after navigation. Add a regression test covering navigation
during ref validation and verify refLocators captures and uses a fresh snapshot.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 224-230: Update the README descriptions for timeouts.settle and
--timeout-settle/PLAYWRIGHT_MCP_TIMEOUT_SETTLE to reflect conditional settling:
quiet actions return after the observation window, while the configured settle
delay applies when an action starts or schedules navigation or network activity.
Remove wording that says the delay applies after every action.

In `@tests/tools-axe.test.ts`:
- Around line 389-403: Update the injected evaluation counter in the stale
readiness-marker test so the hanging promise occurs on evaluation four, not
evaluation two. Keep the existing two runAxeScan calls and expectations
unchanged, ensuring the first scan completes and leaves its marker while the
second scan is blocked to verify stale-marker rejection.

---

Outside diff comments:
In `@src/tab.ts`:
- Around line 389-420: Update _refsMatchSnapshot to record _pageGeneration
before starting asynchronous ref validation and return false if the generation
changes before all checks complete, preventing stale cached refs from being
reused after navigation. Add a regression test covering navigation during ref
validation and verify refLocators captures and uses a fresh snapshot.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a0165405-61ee-49a4-9c43-8eb7a7b782c2

📥 Commits

Reviewing files that changed from the base of the PR and between e70d16c and 763b998.

📒 Files selected for processing (11)
  • README.md
  • bench/mcp-bench.mjs
  • src/tab.ts
  • src/tools/axe.ts
  • src/tools/scanPageMatrix.ts
  • src/tools/utils.ts
  • tests/bench.test.ts
  • tests/tab.test.ts
  • tests/tools-axe.test.ts
  • tests/tools-scanPageMatrix.test.ts
  • tests/tools-utils.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • bench/mcp-bench.mjs
  • tests/tab.test.ts
  • tests/tools-scanPageMatrix.test.ts
  • src/tools/scanPageMatrix.ts
  • src/tools/axe.ts

Comment thread README.md Resolved
Comment thread tests/tools-axe.test.ts Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

CodeRabbit outside-diff finding from review 4838573171 is fixed in d720e14.

_refsMatchSnapshot now records the page generation before asynchronous locator validation and rejects the cached snapshot if navigation changes it before completion. The regression navigates while validation is pending and proves refLocators performs a fresh full snapshot instead of accepting the old ref.

Validation: focused tab suite 58 passed, lint and build passed.

@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the current changes in #156.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d720e14264

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the current changes in #156.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 247f136097

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the current changes in #156.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/tools-axe.test.ts (1)

717-740: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Set an explicit timeout for the real-browser test.

This test launches Chromium, loads content, and waits for a frame navigation. The default Vitest test timeout is 5000 ms. A cold browser launch in CI can exceed that limit and produce a flaky failure. Add a per-test timeout.

♻️ Proposed change
-      expect((await runAxeScan(page)).unscannedFrames).toEqual(['about:srcdoc']);
-    } finally {
-      await browser.close();
-    }
-  });
+      expect((await runAxeScan(page)).unscannedFrames).toEqual(['about:srcdoc']);
+    } finally {
+      await browser.close();
+    }
+  }, 30_000);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/tools-axe.test.ts` around lines 717 - 740, Set an explicit,
sufficiently generous per-test timeout on the real-browser test in the “axe
frame coverage in a real browser” describe block, covering Chromium launch and
frame navigation without changing the test logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/tools-axe.test.ts`:
- Around line 717-740: Set an explicit, sufficiently generous per-test timeout
on the real-browser test in the “axe frame coverage in a real browser” describe
block, covering Chromium launch and frame navigation without changing the test
logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a3a5892-2a34-4c21-b333-c14d84f04a65

📥 Commits

Reviewing files that changed from the base of the PR and between 763b998 and 750f6c2.

📒 Files selected for processing (4)
  • src/tab.ts
  • src/tools/axe.ts
  • tests/tab.test.ts
  • tests/tools-axe.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/tab.test.ts
  • src/tab.ts
  • src/tools/axe.ts

@JustasMonkev

Copy link
Copy Markdown
Owner Author

CodeRabbit exact-head nitpick from review 4839311458 is already covered: vitest.config.ts sets the suite-wide testTimeout to 30,000 ms, so the real-browser regression already receives the suggested 30-second timeout. A duplicate per-test override would not change behavior.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 750f6c25d5

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
Comment thread bench/mcp-bench.mjs Resolved
Comment thread src/tools/axe.ts Resolved
Comment thread src/tools/axe.ts Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the current changes in #156.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 343d05de5c

ℹ️ 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".

Comment thread bench/mcp-bench.mjs Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the current changes in #156.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c73fef18cd

ℹ️ 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".

Comment thread src/tools/axe.ts Resolved
@JustasMonkev

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

@JustasMonkev I will review the current changes in #156.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 744376129a

ℹ️ 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".

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.

2 participants