Repository navigation
fix(browser): preserve literal names and formatter-owned snapshot refs - #130599
Conversation
Decode the emitted Playwright name grammar once across snapshot consumers and keep CDP and Chrome MCP string producers consistent. Fixes #130571.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 26, 2026, 10:40 PM ET / August 27, 2026, 02:40 UTC. ClawSweeper reviewWhat this changesThis PR centralizes browser snapshot-line parsing so quoted and escaped control names retain usable action references across Playwright, CDP, and Chrome MCP output. Merge readinessKeep this maintainer-owned PR open: the snapshot-parser repair targets the verified owner boundary, but the release-owned CHANGELOG entry must be removed before merge. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe browser plugin converts accessibility snapshots into role lines and reference maps, which later browser actions use to locate controls. Playwright, CDP, and Chrome MCP are separate snapshot producers feeding that shared action flow. flowchart LR
A[Browser accessibility tree] --> B[Playwright CDP and Chrome MCP]
B --> C[Snapshot text producer]
C --> D[Shared role snapshot parser]
D --> E[Actionable reference map]
E --> F[Click navigation and labels]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +114, Docs +2. Total +116 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Remove the release-owned CHANGELOG hunk, retain the single shared parser, and merge only after the exact PR-head validation completes successfully. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main's ref regex cannot parse a YAML single-quoted snapshot key, while actions require the decoded stored name for exact role lookup. This review did not execute the provided browser reproduction because the checkout has no installed dependencies. Is this the best way to solve the issue? No, not yet: the shared parser is the best repair location, but the unrelated CHANGELOG modification conflicts with the repository release boundary and should be removed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7f0547293863. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Reviewed the latest ClawSweeper finding and both rank-up moves on
The dependency gap is covered by direct inspection of installed Playwright 1.62.1 serialization and Chrome DevTools MCP 1.8.0 structured snapshots, plus the real Gateway-handler → snapshot → click checks documented above. The inline-state check exercises the actual post-navigation helper, not an end-to-end navigation action or complete WebSocket Gateway process. The serialized-state heuristic does not indicate a storage migration here: this changes transient browser snapshot text and in-memory ref maps, not a persisted schema, file format, configuration, or database. No migration is needed. The review's captured test output itself shows 35 passing snapshot tests; its terminal-harness timeout is not counted as successful live proof. The separately completed owner and independent runs supply that proof. |
|
Reconciled this PR with the now-landed #130623 in 2d58f1ae29866c61ac442cb224b9640c19228207, preserving its canonical parser, native frame refs, tests, and docs. The remaining change fixes slash-only name metadata, ref-looking value/description text, compaction, and CDP iframe placement. The body now distinguishes current-main proof from the follow-up and precisely scopes the real Gateway/browser and structured-producer checks. The complete committed patch matches reviewed SHA-256 The requested changelog removal remains explicitly skipped under maintainer direction and the scoped native allowance. The exact-head CI rank-up move remains a landing gate. This substantive reconciliation warrants a fresh review: @clawsweeper re-review |
|
Merged via squash.
|
…-retirement-v13 * origin/main: (243 commits) fix: preserve Gateway error reasons in text logs (#130645) refactor(video): deduplicate generation contracts (#130635) fix(agents): preserve direct-message sender identity (#124548) fix(agents): preserve silent reply after settled tools (#130675) fix(talk): preserve replacement speech when an old utterance is canceled (#130687) fix(browser): preserve literal names and formatter-owned snapshot refs (#130599) fix(auth): reset only the profile replaced by a successful login (#124014) fix: bind session creation to admitted Gateway (#130686) refactor(qa-lab): reuse model reference splitter (#130317) docs(gateway): clarify independent HTTP endpoint switches (#130690) fix(ui): Control UI smooth scrolling ignores the reduced-motion preference (#130428) refactor(lmstudio): remove unreachable catalog merge (#130689) fix(crabbox): restore cloud machine CPU and RAM (#130684) fix(secrets): compare proxy bearer tokens directly (#127054) fix(matrix): show recovery key availability in text status (#128051) fix(ios): restore approval settings navigation and remove duplicate shell state (#130651) refactor(agents): use fixed tool-loop defaults directly (#130681) refactor(qa-lab): share process tree metric reader (#130419) refactor(models): simplify prepared owner access (#130683) fix(parallels): main install and update smoke cannot complete (#130658) ...
openclaw#130599) * fix(browser): preserve refs for quoted control names Decode the emitted Playwright name grammar once across snapshot consumers and keep CDP and Chrome MCP string producers consistent. Fixes openclaw#130571. * chore(browser): document snapshot JSON string invariant * docs: place browser snapshot note beside related fixes * test(browser): use an event listener in snapshot fixture
Closes #130571
What Problem This Solves
Preserves the exact
/accessible name in browser snapshots and prevents ref-looking page content from being treated as a real element identity. In current main, a slash-only control loses its name metadata; a value or description can keep a truncated element's ref and falsely mark it new; and a preceding control name can make CDP attach an iframe's children under the wrong element.Why This Change Was Made
While this PR was awaiting landing, #130623 fixed ordinary quoted/escaped labels and added native frame-qualified Playwright refs. This PR now builds on that landed canonical lexical parser, preserving its separate name decoder, native
fNeMidentity, raw MCP control-character handling, tests, and documentation. It does not replace or duplicate that fix.The remaining repair reads a ref once from the leading contiguous formatter-attribute prefix inside the snapshot key. AI metadata, finalization, deltas, compaction, and CDP iframe placement share that result; names, scalar tails, values, descriptions, and nested bracket text cannot impersonate attributes. Literal slash names remain literal, including the one-character
/case. The two small CDP/MCP escaping helpers are replaced with standard JSON encoding as a net-negative simplification, not because main was dropping raw MCP control-character refs.Rejected alternatives: overwriting main with the original PR parser would lose native frame refs; separate substring guards would leave the same ownership error in sibling consumers. No locator fallback, extra timeout, dependency, configuration, persistence, protocol, or authorization change.
Production LOC against the reconciled main base: +31/-38 (net −7); tests +128; one user-facing changelog line. The root changelog exception is retained under explicit maintainer direction and the native scoped allowance. It is not an unaddressed request to remove a changelog entry.
User Impact
Slash-only controls retain names needed for exact actions. Returned refs and new-element counts describe visible complete snapshot lines, and frame output stays attached to the actual iframe. The ordinary quoted labels and native frame-qualified refs already repaired by #130623 remain working.
Evidence
Before/after proof baseline:
7c6a79828a0a97d0642e081ed4f9ab3036167c98, containing #130623 (f1bef4b3a2fbd050766f8fd3fc7837d59aae2e62). Final integration base:e87fcb0850697e747e1c73f414aabe4bd6155531. Complete final patch SHA-256:91d1f4bfaf1f79e2ed312f8ca818a97a50faa15eadfd1749609200990a7840cb. All seven changed browser production/test files and browser documentation are byte-identical to the reviewed4666fc5bad18315b0ddf5f2c1e9eeb18007317f3head. The earlier test-only follow-up changedonclicktoaddEventListenerto satisfy CI lint./name metadata in efficient and AI modes, and fails the CDP placement case. Actual Chrome DevTools MCP passes all 13 label cases on both versions, including control characters.browser.requestGateway handler and real browser drivers; it is not a complete authenticated WebSocket Gateway process. Inline page-state coverage calls the actual helper with a seeded successful-navigation result, not a full navigation action. All temporary browser processes, ports, state, and credentials were cleaned up.onclickstyle rule; after correcting it, the actual Chromium test and scoped type-aware lint for all seven changed TypeScript files pass. The latter reused those already-generated declarations by skipping preparation only, without skipping lint rules. Full new-head hosted CI remains required.RootWebAreawith an inline URL attribute, which the current producer cannot emit. CDP attaches URLs only to already-referenced links and writes their genuine refs before URL text. A real malicious data URL containing] [ref=e2]preserves only the genuine link ref after the actuale2button is truncated; the root's ref-looking title stays quoted page text. Playwright and MCP sibling producers do not create the reported state. No speculative parser branch was added.Focused commands:
The final pushed head is
9e6e43451eed2d2003a3bfddcb1813e32b89d80b. Exact-head CI33039972084 and Workflow Sanity33039972106 both completed successfully. Fresh REST run identity confirms this PR and head; no prior-head check is substituted. The latest ClawSweeper changelog removal move is explicitly skipped under maintainer direction, and its exact-head CI move is satisfied. Native prepare/merge enforcement remains required. No persisted-state migration is involved: these are transient snapshot text and in-memory refs.CI refresh context: run33038704223 passed lint and both type-check jobs but failed the Control UI startup gzip budget by7bytes (343449B vs343442B) while testing4666 with main110eb787. Newer main e87 contains the actual UI owner refactor #130669 and passed CI33038923385/build98408000313 at343403B. This PR incorporates that verified main revision without editing UI, budget, baseline, Vite config, package or lock files. Changed UI inputs justify the refresh; exact31byte gzip causality is not claimed because the failed run retained no raw bundle artifact. The browser proof carries forward only by verified source-byte parity. Final build98411282977 passed at343422B,20B below the unchanged343442B limit, while testing merge103f084b (9e6 into main e907f41); the complete exact-head CI is green.
Additional instructions
This is a same-repository branch. Maintainers can edit it through their repository access; the fork-collaboration toggle does not apply.