Skip to content

fix(browser): preserve the declared consequential hint in WebMCP discovery - #2263

Closed
aznikline wants to merge 9 commits into
morluto:mainfrom
aznikline:fix/webmcp-annotations
Closed

aznikline wants to merge 9 commits into
morluto:mainfrom
aznikline:fix/webmcp-annotations

Conversation

@aznikline

Copy link
Copy Markdown

Summary

  • The CDP WebMCP.Annotation type carries an optional consequential boolean; normalizeTool dropped it, so the declared hint never reached Evidence.
  • Surface consequential in webMcpToolSchema.annotations as z.boolean().nullable().optional(): true/false are declared values, null means the declaration did not provide the hint, and a missing key keeps older captures parseable in compare_web_captures (same pattern as effective_url).
  • Update docs/browser-observation.md: WebMCP discovery prerequisites (origin-trial conditions vs WebMCPTesting flag, attach-only/no-navigation semantics) and the annotation value semantics.
  • Known gap (unchanged behavior, documented): a protocol debugging hint exists on Chromium main (JS-visible from Chrome ~156) and is not surfaced; nothing is claimed about it.

Test plan

  • src/domain/webMcpDiscovery.test.ts — declared true/false/null, historical capture missing the key, createEvidenceBundle → serialize → parse round-trip
  • cdpBrowserProvider.document_script.test.ts, browserCli.test.ts — provider and CLI Evidence paths; vitest --maxWorkers=4 pass
  • npx tsc --noEmit, oxlint, verify:module-boundaries clean
  • Real-provider check (Chrome 154, attached CDP): zapier.com declared consequential: false; value survived inspect-evidence-bundle re-read and evidence-export canonical re-encode (Evidence ev_e451abd5…)

Scope note

Passive discovery only — no WebMCP.invokeTool, no page evaluation, no navigation is added.

Generated with Devin

aznikline and others added 2 commits October 12, 2026 16:12
…overy

The CDP WebMCP Annotation type carries an optional consequential
boolean (booking a flight, transferring money), but normalization
dropped it. Report it per registration alongside the existing hints:
true or false as declared, null when the declaration omits it, and
absent only in captures recorded before the field was surfaced.

Also document the WebMCP prerequisites: the origin trial starts at
Chrome 149, a site token and the WebMCPTesting flag are distinct
switches, and discovery is attach-only on an existing CDP endpoint
and target without navigation.
…tics

- Origin-trial token enables the API only while the trial is active and
  version/platform/settings permit; token presence is not a guarantee.
- Flag-vs-default difference labeled as one observed pilot result;
  third-party-token non-enrollment marked as inference.
- WebMCP.enable domain availability recorded as a Chrome 154 observation.
- Annotation semantics: true/false declared, null absent-in-declaration,
  missing key marks older captures.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
aznikline added a commit to aznikline/rea that referenced this pull request Oct 12, 2026
- Draft PRs: morluto#2262 (inspect_signature non-Mach-O gate, minimal
  cherry-pick onto d96550f with corrected comment) and morluto#2263 (WebMCP
  consequential fidelity + qualified prereq docs.
- Real signed-pkg control: python-3.13.9-macos11.pkg (Developer ID
  Installer-signed + notarized per pkgutil oracle) now yields honest
  capability_unavailable instead of signed:false; Mach-O regression intact.
- L3 content-egress prep design only: dedicated test user/VM options,
  proxy-delivered vs egressed distinction, no trust/proxy/pf/VPN changes.
- environment.md/branch-audit.md updated with new worktrees, SHAs, PRs.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EOF
)
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking gap in tests for invalid annotations.

Findings

  1. P2 Invalid annotations lack tests ▶
Fix with agent prompt
### Issue 1
src/browser/CdpWebMcpDiscovery.ts:449-459
The new invalid-annotation branches in `normalizeTool` have no browser-level tests. Current cases cover declared booleans and omitted hints, but not a non-boolean `consequential` value or a malformed `annotations` object.

Add cases that check the tool is retained, `consequential` is omitted, and discovery is marked incomplete. Without them, a regression could silently claim complete coverage.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Preserves declared consequential hints in passive WebMCP discovery and Evidence.

  • WebMCP discovery keeps each tool’s declared consequential hint.
  • Capture comparisons keep missing consequential hints from looking like changes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[CDP tool declaration] --> B[normalizeTool]
  B --> C[Boolean: preserve value]
  B --> D[Omitted: null]
  B --> E[Invalid: omit hint and mark incomplete]
  C --> F[Discovery and Evidence]
  D --> F
  E --> F
  F --> G[Compare captures]
  G --> H[Missing recorded hint: unknown unless another change is observed]
Loading

Reviews (8) · Last reviewed commit: "Merge branch 'main' into fix/webmcp-anno..." · Reviewed by Greptile

Comment thread src/domain/webMcpDiscovery.test.ts Resolved
@morluto
morluto marked this pull request as ready for review October 13, 2026 11:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T18:41:39.003853Z aec3226 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 354ec7cee0

ℹ️ 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/domain/webMcpDiscovery.ts Resolved
Comment thread src/browser/CdpWebMcpDiscovery.ts Resolved
Comment thread src/domain/webCaptureDiff.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: 273286fee1

ℹ️ 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 docs/browser-observation.md Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Handled in 273286f. The fake CDP producer now accepts a caller-selected consequential hint, and the browser discovery scenario runs true and false through CdpBrowserProvider normalization rather than checking only schema parsing.

Source inspection and git diff --check completed. Tests, builds, typechecking, lint, and real-provider verification were skipped at the user's explicit request.

  1. thread 1

Handled in 273286f. The comparison owner identifies matching registrations whose consequential annotation was not recorded. It compares their other observed fields together, preserves independently proven changes, and returns unknown when only that unavailable hint prevents equality. Missing legacy data is never hashed as a different declaration value.

Source inspection and git diff --check completed. Tests, builds, typechecking, lint, and real-provider verification were skipped at the user's explicit request.

  1. thread 1

Handled in 273286f. CDP admission validates hint presence and type. Explicit null/non-boolean consequential values and malformed annotation records produce invalid_protocol_value exclusions; the registration remains retained with incomplete coverage and its consequential fact omitted. Comparison treats that omitted fact as unknown, rather than turning malformed input into a declared absence.

Source inspection and git diff --check completed. Tests, builds, typechecking, lint, and real-provider verification were skipped at the user's explicit request.

@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: cf136ee3b2

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

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

Root cause: comparison behavior for unavailable annotation facts had schema admission coverage but no comparison coverage. Added comparison cases for a missing consequential hint on either side, true versus false, and independent description changes accompanying each missing hint. These use the existing captured browser/discovery boundary and assert unknown without a fabricated change, while preserving observed independent modifications. Validation: inspected producing boundaries and affected consumers; targeted source formatting and git diff --check completed. Tests, typechecks, lint, builds, provider runs and CI reruns were not executed, per the user's explicit instruction. No directly related cleanup is deferred.

  1. thread 1

Root cause: the documentation and comparison reason still described every omitted consequential field as historical, although the admission owner also omits invalid current values. Documentation now distinguishes null (declaration omitted the hint) from an unrecorded/invalid absent key and directs consumers to completeness/exclusions. It accurately describes retained registrations with invalid_protocol_value exclusions; the comparison reason uses the same semantics. Validation: inspected producing boundaries and affected consumers; targeted source formatting and git diff --check completed. Tests, typechecks, lint, builds, provider runs and CI reruns were not executed, per the user's explicit instruction. No directly related cleanup is deferred.

@morluto morluto added bug Something isn't working area: runtime Process capture and runtime observation area: mcp MCP server, transport, and tool registration area: domain Domain logic, errors, and pure functions P2: medium Medium priority issue labels Oct 13, 2026
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

The second consequential comparison table duplicated all five scenarios from the table near the top of the file. The main-sync commit removed that duplicate, leaving one owner for these cases and avoiding repeated browser setup. Source diff was checked with git diff --check; tests were not run during this continuation.

Comment on lines +449 to +459
const malformedAnnotations =
Object.hasOwn(value, "annotations") && annotations === undefined;
if (malformedAnnotations)
completeness.exclude("webmcp_tools", "invalid_protocol_value");
const annotation = (key: string): boolean | null => {
if (annotations === undefined || !Object.hasOwn(annotations, key))
return null;
const hint = annotations[key];
if (typeof hint === "boolean") return hint;
completeness.exclude("webmcp_tools", "invalid_protocol_value");
return null;

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.

P2 Invalid annotations lack tests

The new invalid-annotation branches in normalizeTool have no browser-level tests. Current cases cover declared booleans and omitted hints, but not a non-boolean consequential value or a malformed annotations object.

Add cases that check the tool is retained, consequential is omitted, and discovery is marked incomplete. Without them, a regression could silently claim complete coverage.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/CdpWebMcpDiscovery.ts
Line: 449-459

Comment:
**Invalid annotations lack tests**

The new invalid-annotation branches in `normalizeTool` have no browser-level tests. Current cases cover declared booleans and omitted hints, but not a non-boolean `consequential` value or a malformed `annotations` object.

Add cases that check the tool is retained, `consequential` is omitted, and discovery is marked incomplete. Without them, a regression could silently claim complete coverage.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added in 092a86c: a browser-level it.each in tests/boundary/browser/cdpBrowserProvider.document_script.test.ts covering (1) a non-boolean consequential value and (2) a malformed annotations payload, using a new webMcpAnnotations fixture override in tests/fixtures/fakeCdpBrowserEvents.ts. Both cases assert the tool registration is retained, annotations.consequential is omitted, and coverage is marked incomplete (invalid_protocol_value exclusion + webmcp_tools in unavailable_sections). Verified at this SHA: 28/28 in cdpBrowserProvider.document_script.test.ts and 19/19 in webCaptureDiff.test.ts pass; npm run check:fast clean.

@morluto morluto closed this in f690571 Oct 14, 2026
aznikline added a commit to aznikline/rea that referenced this pull request Oct 14, 2026
…morluto#2262

Per-thread verdicts, fix SHAs, validation scope, and thread states at
current remote heads; open bound-invocation P1s recorded as confirmed or
not-reproduced with counterexample evidence.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
aznikline added a commit to aznikline/rea that referenced this pull request Oct 15, 2026
…, and morluto#2465 call-site P1

Records the call-site member-read fix a13b935, the main merge 02ef51a (writeSite origin + [null] mutation encoding), the author-readiness human attestation requirement, and the morluto#2263 test-only follow-up draft PR morluto#3837.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@morluto

morluto commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Thanks @aznikline for preserving the page-declared WebMCP consequential hint instead of dropping it during normalization. Main carries the nullable annotation into Evidence and comparison in f6905719c (main).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions area: mcp MCP server, transport, and tool registration area: runtime Process capture and runtime observation bug Something isn't working P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants