Skip to content

refactor: refresh Rust CDP and retire hidden windows#2013

Merged
Nikhil (shadowfax92) merged 7 commits into
mainfrom
chore/refresh-rust-cdp-retire-hidden
Jul 23, 2026
Merged

refactor: refresh Rust CDP and retire hidden windows#2013
Nikhil (shadowfax92) merged 7 commits into
mainfrom
chore/refresh-rust-cdp-retire-hidden

Conversation

@shadowfax92

@shadowfax92 Nikhil (shadowfax92) commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • vendor the exact 58-domain ch1 protocol with pinned SHA-256 provenance and generate only the focused Rust surface plus transitive referenced types
  • remove hidden page/window state and wire behavior from browseros-core and Rust server call sites while retaining source-derived compatibility tombstones
  • remove hidden controls, structured output, and prompt guidance from the Rust MCP tools and JavaScript run bridge

Design

browseros-cdp now owns a byte-exact combined Chromium protocol input, a declarative focused surface, and deterministic transitive reference closure in its build generator. The generated wire layer may retain Chromium's hidden-window compatibility tombstones, but core, MCP, and server runtime code no longer advertises, sends, caches, branches on, or serializes hidden state. Ordinary background-tab, default-window, tab-group, and visibility-reporting behavior remains intact.

Integration

Test plan

  • canonical protocol byte comparison, SHA-256, and 58-domain source contract
  • cargo fmt --all --check
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • bun run check
  • bun run test
  • git diff --check
  • Rust runtime boundary audit for retired hidden-window calls and state

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Greptile (@greptileai) review

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Claude (@claude) review

@claude

claude Bot commented Jul 23, 2026

Copy link
Copy Markdown

Claude finished Nikhil (@shadowfax92)'s task in 3m 12s —— View job


Review

Todo list

  • Read repo CLAUDE.md and setup instructions
  • Review protocol vendoring / build.rs changes (browseros-cdp)
  • Review hidden-window removal in browseros-core
  • Review MCP tool changes (run.rs, windows.rs, tabs.rs, prompt.rs)
  • Review server call sites (tab_registry.rs, tab_activity.rs, audit.rs)
  • Post final review

Reviewed against d9d6ad9 (the actual fork point — 4 commits, matches the PR's stated diff stats exactly). Overall this is a clean, well-tested refactor.

Strengths

  • Protocol vendoring (crates/browseros-cdp/build.rs, protocol/protocol.sha256, tests/protocol_source.rs): SHA-256-pinned combined ch1 protocol with a declarative surface.json selection + deterministic transitive-reference closure is a solid design — reproducible, no network I/O at build time, and protocol_source.rs locks in both the 58-domain source contract and the fact that Chromium's hidden-window compatibility fields (TabInfo.isHidden, createWindow.hidden, getTabs.includeHidden, showTab, setWindowVisibility) are intentionally retained in the generated wire layer as tombstones, even though nothing in application code calls them anymore. That's a good way to make the "generated surface keeps compat, app logic doesn't use it" claim in the PR description verifiable rather than just asserted.
  • Hidden-state removal is thorough and consistent. I grepped crates/ and apps/claw-server-rust/src for is_hidden, hidden_window, set_visibility, and .hidden outside of tests/generated code and found nothing left dangling — WindowManager::create (crates/browseros-core/src/windows.rs), PageManager::list/new_page (crates/browseros-core/src/pages.rs), Browser::new_page (crates/browseros-core/src/browser.rs), and TabRegistry (apps/claw-server-rust/.../tab_registry.rs) all drop includeHidden/hidden params cleanly.
  • Good regression coverage for the removal itself, not just the happy path: crates/browseros-mcp/src/tests.rs adds tab_and_window_schemas_omit_hidden_controls and retired_hidden_inputs_are_rejected, which assert that a client still passing hidden/visible/activate gets a rejected-argument error rather than being silently ignored. run.rs's pages.newPage JS bridge similarly returns an explicit "hidden is no longer supported" error instead of silently dropping the option. This is the right behavior for a breaking API change — good attention to detail.
  • prompt.rs and service.rs both had their tool-guidance prose updated to stop mentioning hidden windows, with a test (prompt_recommends_only_ordinary_window_isolation) locking that in.

Observation worth confirming (not necessarily a blocker for this PR)

  • The TypeScript runtime under packages/browseros-agent/packages/browser-core/src/core/{windows,pages}.ts still actively calls Browser.setWindowVisibility / Browser.showTab and reads/sends isHidden/includeHidden (e.g. windows.ts:50, pages.ts:19,70,319,323,455). Commit 08abb8d ("retire hidden window implementation") already gutted the underlying Chromium C++ handler for these commands on main. If that TS path is still a live runtime (not fully superseded by claw-server-rust), those calls may now fail or behave differently against the trimmed native implementation. If the TS server is already fully deprecated in favor of the Rust one, this is moot — but if not, it'd be good to confirm there's a tracked follow-up for the TS side, since this PR explicitly scopes itself to "browseros-core and Rust server call sites."

Process notes

  • CI so far has only run the CLA check (PR is draft, as expected). No cargo test/clippy/bun run check results are visible from CI yet, so I relied on reading the diff rather than a green build signal.
  • The PR body's disclosed blockers (bun run check Biome failures in acpx-runtime.test.ts, bun run test failures in claw-app path aliases and the release workflow test) are all in files untouched by this diff and pre-existing on origin/main, consistent with keeping this PR in draft rather than merging on a red base.

No bugs found in the Rust changes themselves. Nice, disciplined refactor with tests that specifically pin down the "removed from app logic, retained as wire-format tombstone" design.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Refactors the Rust browser stack to use a pinned, focused Chromium protocol surface and removes hidden-window behavior.

  • Vendors and validates the combined 58-domain CDP protocol while generating selected commands, events, and transitive types.
  • Removes hidden-tab and hidden-window state, controls, serialization, and prompt guidance from core, MCP, and server paths.
  • Retains protocol-level compatibility tombstones while preventing runtime callers from using retired hidden-window options.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

Important Files Changed

Filename Overview
packages/browseros-agent/crates/browseros-cdp/build.rs Replaces reduced-protocol generation with SHA-validated focused-surface generation, transitive reference closure, and automatic recursive-type boxing.
packages/browseros-agent/crates/browseros-cdp/protocol/surface.json Declares the focused nine-domain Rust CDP surface while relying on generator-driven transitive type inclusion.
packages/browseros-agent/crates/browseros-core/src/pages.rs Removes hidden-page state and creation/show behavior while retaining ordinary page discovery, creation, movement, and lifecycle handling.
packages/browseros-agent/crates/browseros-core/src/windows.rs Removes hidden-window creation and visibility mutation, leaving list, create, close, and activate operations.
packages/browseros-agent/crates/browseros-mcp/src/tools/run.rs Removes hidden state from the JavaScript bridge and explicitly rejects the retired hidden new-page option.
packages/browseros-agent/crates/browseros-mcp/src/tools/windows.rs Narrows the windows tool schema and implementation to ordinary list, create, close, and activate actions.

Reviews (2): Last reviewed commit: "test(core): align getProperties fixtures..." | Re-trigger Greptile

@shadowfax92

Copy link
Copy Markdown
Contributor Author

Review follow-up: the TypeScript runtime concern is resolved by #2014, which is now merged. I merged the resulting origin/main additively, kept the retired Rust snapshot deleted, added canonical Runtime.getProperties to the focused surface for #2011's new consumer, and aligned its fake CDP PropertyDescriptor payloads with the exact protocol. Full Rust and repository-wide gates pass; there are no inline or unresolved review threads.

@shadowfax92
Nikhil (shadowfax92) marked this pull request as ready for review July 23, 2026 23:25
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

✅ Tests passed — 1694/1698

Suite Passed Failed Skipped
agent 350/350 0 0
build 34/34 0 0
claw-app 215/215 0 0
⚠️ claw-mcp 0/0 0 0
⚠️ claw-onboard 0/0 0 0
⚠️ claw-server-rust-quality 0/0 0 0
⚠️ claw-server-rust 0/0 0 0
server-agent 313/313 0 0
server-api 171/171 0 0
server-browser 10/10 0 0
server-integration 10/10 0 0
server-lib 299/300 0 1
server-root 38/41 0 3
server-tools 254/254 0 0

View workflow run

@shadowfax92
Nikhil (shadowfax92) merged commit 381266a into main Jul 23, 2026
22 checks passed
Dani Akash (DaniAkash) added a commit that referenced this pull request Jul 24, 2026
* chore(deps): bump golang.org/x/crypto to v0.52.0 in apps/cli (#1994)

Refresh go.sum and the x/sys transitive dependency.

* chore(deps): bump the uv group across 1 directory with 5 updates (#1995)

Bumps the uv group with 5 updates in the /packages/browseros directory:

| Package | From | To |
| --- | --- | --- |
| [requests](https://github.com/psf/requests) | `2.32.5` | `2.33.0` |
| [python-dotenv](https://github.com/theskumar/python-dotenv) | `1.2.1` | `1.2.2` |
| [cryptography](https://github.com/pyca/cryptography) | `46.0.3` | `48.0.1` |
| [idna](https://github.com/kjd/idna) | `3.11` | `3.15` |
| [urllib3](https://github.com/urllib3/urllib3) | `2.5.0` | `2.7.0` |



Updates `requests` from 2.32.5 to 2.33.0
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.5...v2.33.0)

Updates `python-dotenv` from 1.2.1 to 1.2.2
- [Release notes](https://github.com/theskumar/python-dotenv/releases)
- [Changelog](https://github.com/theskumar/python-dotenv/blob/main/CHANGELOG.md)
- [Commits](theskumar/python-dotenv@v1.2.1...v1.2.2)

Updates `cryptography` from 46.0.3 to 48.0.1
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@46.0.3...48.0.1)

Updates `idna` from 3.11 to 3.15
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](kjd/idna@v3.11...v3.15)

Updates `urllib3` from 2.5.0 to 2.7.0
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.5.0...2.7.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.0
  dependency-type: direct:production
  dependency-group: uv
- dependency-name: python-dotenv
  dependency-version: 1.2.2
  dependency-type: direct:production
  dependency-group: uv
- dependency-name: cryptography
  dependency-version: 48.0.1
  dependency-type: direct:production
  dependency-group: uv
- dependency-name: idna
  dependency-version: '3.15'
  dependency-type: indirect
  dependency-group: uv
- dependency-name: urllib3
  dependency-version: 2.7.0
  dependency-type: indirect
  dependency-group: uv
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): pin transitive dependency resolutions in browseros-agent (#1997)

Refresh a batch of pinned transitive resolutions to their current patch
releases via overrides and update bun.lock.

* Revert "fix(claw-app): scale Audit tab navigation (#1987)" (#1998)

This reverts commit ee46ec4.

* feat(claw): rewrite BrowserClaw harness skill (#1999)

Frontmatter description now carries the standing instruction — default to
BrowserClaw for browser work unprompted, over in-app browser surfaces —
and the body becomes a compact operating manual: session etiquette,
task-owned tabs, the snapshot -> act -> verify loop, read/grep and tool
escalation, failure handling, and the untrusted-page-content rule.
Validation test probes and line budget updated to match.

* fix(agent): reconcile aliased skill targets by identity (#2001)

* fix(agent): reconcile aliased skill targets by identity

* fix(claw): use app resources in local launchers

* test(claw): assert physical skill manifest paths

* fix: address review findings for browserclaw-skill-target-identity

* feat(claw): show total tokens consumed on Audit surfaces (#2000)

* feat(claw): show total tokens consumed on Audit surfaces

Materialize per-session token estimates (input+output, summed across
dispatches) onto the tasks table via recompute_task, so the total is
available live and not only from the post-teardown efficiency projection.
Expose it through the canonical OpenAPI path as an optional SessionSummary
tokenUsage field, present only when the session has dispatches and every one
carries token-estimator v1 (legacy/unmeasured sessions omit it).

Both Audit surfaces render it from the one shared field: a compact Tokens
column on the session list (exact count on hover, em dash when unmeasured)
and a Tokens entry on the session-detail summary card.

* fix(claw): sort unmeasured token totals last in both directions

The Tokens-column accessor mapped unmeasured sessions to 0, which only
sank them on a descending sort — an ascending sort surfaced them ahead of
every measured session. Return undefined and use tanstack's
sortUndefined:'last' so unmeasured rows stay at the bottom either way.

* fix(claw): hide tokens in audit list (#2002)

* fix(claw): ground screenshot token baseline (#2003)

* fix(claw): ground screenshot token baseline

* test(claw): update cockpit efficiency expectation

* test(claw): preserve signed savings coverage

* feat(claw): move audit observation off the tool path (#2005)

* refactor(claw): separate tool observers from effects

* feat(claw): queue audit observations in bounded worker

* fix(claw): flush coalesced audit previews on session close

* test(claw): verify async audit shutdown lifecycle

* fix: address review findings for 260723-1154_async_audit_observer

* fix(claw): sum tool durations for human time saved (#2004)

* fix(claw): sum tool durations for time saved

* fix(claw): preserve retained efficiency history

* fix(claw): guard efficiency backfill from session reuse

* fix(claw): stop cockpit saved-stats labels from overlapping (#2006)

Both the "used" and "screenshot-first" token labels were absolutely
positioned inside the same overflow-hidden budget track. Around the
mid-range their text occupied the same pixels and painted through each
other (e.g. "used 63.2K" over "112.3K").

Lift both numbers into a legend row above the bar — a flex
justify-between row that wraps to two lines before the labels could ever
meet — and keep the track as a pure gauge: accent fill = what
BrowserClaw used, striped remainder = what a screenshot-first agent
would have spent. The bar carries no text now, so nothing can collide or
clip at any used/total ratio or label length.

Accessibility, reduced-motion (the pulsing dot keeps motion-reduce),
theme tokens, and the stats/API contract are unchanged. Tests assert the
structural invariant (no labels inside the bounded bar) across low, mid,
and full ratios, and the fill width replaces the old marker-position
assertions.

* refactor(patches): retire hidden window implementation (#2007)

* refactor(patches): retire hidden window implementation

* fix(patches): preserve single-close window teardown

* chore: sync internal-docs submodule (#2008)

Co-authored-by: browseros-bot <bot@browseros.ai>

* chore: sync internal-docs submodule (#2009)

Co-authored-by: browseros-bot <bot@browseros.ai>

* fix(claw): use session duration for human time saved (#2010)

* fix(claw): use session duration for saved time

* fix(claw): backfill saved time from task durations

* perf(core): acquire snapshots concurrently (#2011)

* perf(core): batch cursor backend-node resolution

* refactor(core): separate snapshot frame acquisition

* perf(core): acquire snapshot sibling frames concurrently

* perf(core): trace concurrent snapshot capture

* fix: address review findings for snapshot-concurrent-acquisition

* fix: address review findings for snapshot-concurrent-acquisition

* fix: address review findings for snapshot-concurrent-acquisition

* fix: suppress intentional cursor asset expression

* fix(core): clear frame sessions after reconnect

* fix(core): address snapshot PR review notes

* feat(claw-app): default replays to 2x (#2015)

* chore: refresh TypeScript CDP and retire hidden surfaces (#2014)

* chore(cdp): refresh TypeScript protocol definitions

* refactor(server): use background pages for scheduled tasks

* refactor(browser-core): retire hidden page and window behavior

* refactor(browser-mcp): remove hidden tab and window controls

* test: repair TypeScript verification baselines

* test(claw-app): prepare WXT aliases before tests

* fix(claw): exclude red from automatic tab-group colors (#2016)

* fix(claw): exclude red from automatic tab groups

* test(claw): update automatic tab color fixture

* test(claw): cover snapshot concurrency contracts (#2017)

* test(claw): add snapshot concurrency fixtures

* test(claw): cover live cursor snapshot acquisition

* test(claw): cover concurrent iframe snapshot contracts

* test(claw): stress overlapping snapshot contracts

* fix: address review findings for snapshot-concurrency-contract-tests

* fix: address review findings for snapshot-concurrency-contract-tests

* refactor: refresh Rust CDP and retire hidden windows (#2013)

* chore(cdp): sync Rust protocol from Chromium

* refactor(core): retire hidden window state

* refactor(mcp): remove hidden window controls

* refactor(server): drop hidden window runtime references

* test(core): align getProperties fixtures with protocol

* test(mcp): retire hidden conformance cases

* chore(release): build v0.48.3 [skip ci]

Automated nightly macOS version bump.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nikhil <nikhilsv92@gmail.com>
Co-authored-by: browseros-bot <bot@browseros.ai>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant