Skip to content

refactor(browser): simplify requests and page-state ownership - #149651

Merged
steipete merged 1 commit into
mainfrom
codex/browser-production-simplification
Sep 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/browser-production-simplification

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #149628

What Problem This Solves

Maintainer-requested follow-up to #149354 to reduce duplicated browser logic after the readiness and lifecycle fixes.

User Impact

No intended user-visible behavior change. Browser startup allowances, cancellation, profile ownership, navigation guards, and response shapes are preserved; no configuration changes or migrations are required.

Why This Change Was Made

Consolidate JSON POST construction, profile-map copying, action result handling, and Playwright page-state bookkeeping in their existing owners. Remove redundant wrappers and casts, including an entire CDP send wrapper, and avoid serializing tool results twice. This removes 410 net production lines without moving production logic into test code. Type-assertion exceptions shrink with the deleted assertions.

Evidence

Full browser suite: 4,309 passed, 46 skipped; final client/tool follow-up: all 312 passed. This includes startup/lifecycle, local and node tool routing, HTTP payloads and cancellation, storage/emulation, evaluation, and stale-ref coverage. A frozen-input config test checks that default resolution preserves caller-owned profiles and prototype-like names. No behavior tests were deleted.

Full build and complete changed-file checks passed, including production/test typechecks, lint, dead-export scans, plugin boundaries, and import-cycle guards.

Independent Codex review: no actionable P0–P2 findings. Local validation uses isolated fixtures; live remote-provider and Windows desktop behavior was not exercised.

Exact-head CI passed for 9d62ad36a0739e5e471b57928642e83f1ede19b2. The scanner refusal on unchanged synthetic config fixtures was repaired in ClawSweeper #1596. The repaired production scanner admits this same complete committed browser range with native verification enabled; scanner and source-binding checks remain active.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

ClawSweeper will not retry this unchanged revision.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The scanner false positive is fixed on ClawSweeper main by openclaw/clawsweeper#1596. The PR body now links the repair and native admission proof. Browser head 9d62ad36a0739e5e471b57928642e83f1ede19b2 is unchanged, with CI and native preparation complete.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 12:58 AM ET / 04:58 UTC.

ClawSweeper review

What this changes

Consolidates browser request construction, profile copying, result formatting, and Playwright page bookkeeping while preserving existing behavior.

Merge readiness

✅ Ready for maintainer review

This remains useful, explicitly requested cleanup for the linked open issue. No actionable introduced defect was found; the scanner repair is merged and CI passed for the reviewed head.

Priority: P3
Reviewed head: 9d62ad36a0739e5e471b57928642e83f1ede19b2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent, behavior-preserving cleanup with useful validation and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor gate does not apply to this maintainer-authored internal refactor, and no material authority change triggers additional proof. Browser tests and exact-head CI are supplemental validation; the linked native trace proves scanner admission only.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor gate does not apply to this maintainer-authored internal refactor, and no material authority change triggers additional proof. Browser tests and exact-head CI are supplemental validation; the linked native trace proves scanner admission only.
Evidence reviewed 10 items Introduced scope verified: The local merge-base-to-head comparison matches the host's introduced file list. Review used this delta rather than endpoint drift; git diff --check passed and the checkout remained clean.
Still distinct from main: Fetched main and the PR merge-base have identical browser trees, so main retains the duplication addressed here. The supplied context identifies #149628 as the open, explicitly requested cleanup; #149354 is its merged lifecycle predecessor, not a replacement.
Request contracts preserved: The shared POST helper preserves explicit payload construction, profile encoding, transport timeouts, and cancellation. Migrated callers continue constructing their existing field allowlists rather than serializing transport options.
Findings None None.
Security None None.

How this fits together

The browser plugin translates agent and CLI requests into browser-control operations. Its profile lifecycle and page-state owners manage browser availability, interactions, snapshots, and returned results.

flowchart TD
  A[Agent and CLI requests] --> B[Browser request construction]
  B --> C[Profile and tab routing]
  C --> D[Browser lifecycle]
  C --> E[Playwright page operations]
  E --> F[Page state and snapshot references]
  F --> G[Browser tool results]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -410, Tests +19, Other -2. Total -393 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 17 522 932 -410
Tests 4 26 7 +19
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 3 -2
Total 22 549 942 -393

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #149628
Summary: This PR implements the linked browser-simplification request following the earlier lifecycle fix.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep request construction and page bookkeeping in their existing browser owners while retaining the established payload, cancellation, profile, and reference-invalidation contracts.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR removes internal duplication rather than claiming a new bug fix; no introduced failing path was identified.

Is this the best way to solve the issue?

Yes: the consolidation reuses existing owners, removes redundant wrappers, and preserves the inspected behavior contracts without expanding public APIs.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 335e80dc8fc1.

Labels

Label changes:

  • add P3: This is explicitly requested internal cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor gate does not apply to this maintainer-authored internal refactor, and no material authority change triggers additional proof. Browser tests and exact-head CI are supplemental validation; the linked native trace proves scanner admission only.

Label justifications:

  • P3: This is explicitly requested internal cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor gate does not apply to this maintainer-authored internal refactor, and no material authority change triggers additional proof. Browser tests and exact-head CI are supplemental validation; the linked native trace proves scanner admission only.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 425df19 into main Sep 16, 2026
222 checks passed
@steipete
steipete deleted the codex/browser-production-simplification branch September 16, 2026 05:03
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: browser maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify browser internals after readiness and lifecycle fixes

1 participant