Repository navigation
fix(browser): keep negative script columns Chrome reports - #8684
Conversation
Chrome reported a Debugger.scriptParsed event with startColumn -60 and endColumn -15 for an inline script in WordPress's helper frame. CDP declares these columns as plain integers, but REA's admission required min(0), so one script failed the whole observe-web-execution run with unreadable_output. CDP resource columns now share one representation, cdpResourceColumnSchema, for script start/end columns, initiator call frames, parser initiators and event listeners. Positions on a script's first line include its start column, so keeping the reported values keeps the documented script-relative conversion consistent. The domain contract and web runtime docs state that a negative column does not locate a column in the resource. Fixes morluto#8674 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The reviewed changes appear safe to merge. SummaryKeeps negative columns reported by Chrome instead of rejecting the observation.
Reviews (2) · Last reviewed commit: "fix(browser): apply the CDP column polic..." · Reviewed by Greptile |
💡 Codex Reviewrea/src/browser/CdpScriptContextFacts.ts Line 15 in ad2d93c When a negative-start inline script emits a request or console frame on its first line, the passive AGENTS.md reference: AGENTS.md:L29-L29 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
inspect_web_page and discover_webmcp_tools still read CDP columns through cdpSourceCoordinates, whose own >= 0 check turned a negative column into null and reported invalid_protocol_value. WebMCP discovery also dropped the tool's whole registration_source. cdpResourceColumnSchema now lives with the domain's CDP observation schemas. Runtime admission, the passive coordinate helper and the runtime, console, initiator and WebMCP output schemas all use it. Lines keep their non-negative rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Fixes #8674.
observe-web-executionfailed for a whole page withunreadable_output("Too small: expected number to be >=0") when Chrome reported oneDebugger.scriptParsedevent with a negative column. The reporter sawstartColumn: -60,endColumn: -15for an inline script in WordPress 7.1's helper frame. CDP declares these columns as plain integers. REA's ownmin(0)refused the whole observation.REA now keeps the column CDP reports, so the rest of the page is observed. A negative column is documented as one that does not locate a column in
url. The passiveinspect_web_pageanddiscover_webmcp_toolspaths now use the same column rule, so they keep that column instead of reporting it as an invalid protocol value.Problem and expected behavior
Debugger.scriptParsedevent, from any frame in the attached page, withstartColumnorendColumnbelow zero. Unowned helper-frame scripts are parsed too, so one such script fails the page.docs/tool-design.md: limits must follow real protocol constraints). One producer value discarded every other observation.resource_start, and positions in it keep their reported columns.Change and scope
One column representation:
cdpResourceColumnSchema(src/domain/cdpObservationSchemas.ts) isz.int()for CDP resource columns. It is used for:Debugger.scriptParsedstartColumnandendColumn;columnNumber;cdpSourceCoordinates.Domain contract: these column fields accept any integer:
src/domain/webRuntime.ts:resource_start.column_number, and callsite/listenerlocation.column_number;src/domain/browserObservationSchemas.ts: consolecolumnand networkinitiator.column;src/domain/webMcpDiscovery.ts:registration_source.column.The web runtime descriptions say Chrome can report a negative column, which then does not locate a column in
url.Passive capture (from Codex review):
cdpSourceCoordinateshad its own>= 0rule. A negative column becamenulland was reported asinvalid_protocol_value, and WebMCP discovery dropped the tool's wholeregistration_source. It now uses the shared schema for columns, and lines keep their non-negative rule.Docs:
docs/web-runtime.mdadds this to the existing script-relative conversion guidance, anddocs/browser-observation.mdto the passive source-location description.Why keep the reported value rather than null or omitting the script:
fetchcall frame at column 38, and a second-line one at column 2. So the documentedcolumn_number - resource_start.column_numberstill gives the script-relative column.Why callsites, listeners and parser initiators are included:
scriptParsedwould move the failure to the first request stack or listener in that script.Intentionally not included:
min(0), because no negative line was reported.min(0).Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
cdpResourceColumnSchemainsrc/domain/cdpObservationSchemas.tsowns the column policy.CdpScriptContextFacts.ts,CdpRuntimeProtocol.ts(stacks, listeners),CdpNetworkEventFacts.ts(initiators), andCdpRuntimeSources(projectsresource_startand locations).cdpSourceCoordinatesinCdpCaptureEventHelpers.ts, for console events, network initiators and WebMCP registrations.integer(min(0)), andcdpSourceCoordinates' own column check.minimum: 0from these columns.observe_web_executionandinspect_web_event_listeners:resource_start.column_numberandlocation.column_number, with extended descriptions.inspect_web_page: consolecolumnand networkinitiator.column.discover_webmcp_tools:registration_source.column.trace_web_source_location's script-relative columns, are unchanged.nulland marked incomplete.docs/public/product-catalog.json), package, or installation impact: none beyond the generated tool schemas.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
tests/boundary/mcp/webRuntimeMcp.test.ts(public path): a fake CDP browser replays the reported script (startColumn -60,endColumn -15) and a listener on its first line at column -50.inspect_web_event_listenerssucceeds. ItsstructuredContentvalidates against the advertised output schema with Ajv 2020.inspect-web-event-listeners --jsonexits 0.location.column_number: -50and the script'sresource_start.column_number: -60.tests/boundary/browser/cdpWebRuntimeReview.test.ts(production provider):observeExecutionwith the same script, a script-initiated request whose call frame is at column -40, and a parser-initiated request at column -30. It succeeds and keeps all three columns. Requests are emitted inside the armed window through the progress hook, which the public path does not expose.tests/fixtures/webRuntime.ts: the shared negative-column fake browser.tests/boundary/mcp/browserSourceCoordinates.test.ts(public path): a fake CDP browser reports one call frame at line 21, column -40, for a console event, a script-initiated request and a WebMCP registration.inspect_web_pageanddiscover_webmcp_toolssucceed through MCP, and their results validate against the advertised output schemas with Ajv 2020.column: -40for the console event, the request initiator andregistration_source.console_events,network_initiatorsandwebmcp_toolsrecord noinvalid_protocol_value.srcanddocsrestored tomain(144843c), both new tests fail with the reporter's message, "Too small: expected number to be >=0".CdpRuntimeProtocol.tsfails both. Restoring onlyCdpNetworkEventFacts.tsfails the execution test (parser initiator). Restoring onlysrc/domain/webRuntime.tsfails both at output validation.srcanddocsrestored to the first commit (ad2d93cd3), the passive test fails: all three columns arenull. Restoring onlybrowserObservationSchemas.tsandwebMcpDiscovery.tsmakes its MCP call return an error.unreadable_outputwith "Too small: expected number to be >=0". After, the observation's Evidence, for example"resource_start": { "line_number": 21, "column_number": -60 }, from the fake browser above.document.writeinto frames, parser-timedocument.write, DOM-inserted, contextual-fragment andinsertAdjacentHTMLscripts, and inline event-handler attributes.document.writeframe reported against the parent URL at line 0, columns 321–397. That is one reason the description says such columns may not locate a position inurl.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
Debugger.scriptParsedrefusal still stops the runtime window. The passive path's existing malformed case (line -3, column 7.5) still reportsnullcoordinates withinvalid_protocol_value.excludedsource alongside usable sibling facts.For evidence-bearing changes:
Validation performed
Run on Linux with Node 24.22.1 (
.nvmrc) and npm 11.19.1 (packageManagerpins 11.16.0), onupstream/main144843c:npm run test:focused -- tests/boundary/browser/cdpWebRuntimeReview.test.ts tests/boundary/mcp/webRuntimeMcp.test.ts tests/acceptance/webRuntimeCli.test.ts: 3 files, 37 tests passed.npm run test:focusedon the 13 browser boundary files (cdpWebRuntime*,cdpScriptMetadata,cdpCaptureScriptMetadata,cdpConnection,cdpProtocolFailure,browserLifecycleFollowup): 123 tests passed. This was before the listener case moved to the MCP file; that move changed only test files.npm run test:focused -- tests/boundary/mcp/toolSchemaValidity.test.ts tests/boundary/mcp/mcpSchemaValidation.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts tests/boundary/mcp/outputSchemaSemanticConstraints.test.ts(with the web runtime MCP/CLI files): 6 files, 53 tests passed.npm run test:local -- src/application/WebRuntimeService.test.ts src/browser/CdpCaptureValues.test.ts src/browser/execution/CdpExecutionWindow.test.ts src/browser/execution/CdpRuntimeRequests.test.ts src/contracts/toolEffects.test.ts: 5 files, 29 tests passed.npx tsc --noEmit -p .,npm run check:fastandnpm run docs:checkpassed.npx oxfmt --checkandnpx oxlinton the changed files, andgit diff --check: clean.ddaf2e367(Codex review: passive capture):npm run test:focusedon 29 boundary and acceptance files covering console events, initiators, WebMCP registrations, the web runtime and MCP schema validity: 429 tests passed.npm run test:localon 19 passive capture, WebMCP, capture-diff and web runtime unit files: 249 tests passed.npx tsc --noEmit -p .,npm run check:fast,npm run docs:check,npx oxfmt --check,npx oxlinton the changed files andgit diff --checkpassed.npm run check:pr, a real WordPress page, or a real-browser public CLI/MCP run.Compatibility, safety, and release
Author readiness
Human owner: @SandstromPL
Before merge
type(scope): outcome.🤖 Generated with Claude Code