Repository navigation
fix(browser): make engine ledger sole frame authority and auto-attach owner - #350
Merged
Merged
Conversation
|
PR test build retired — merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the browser engine's
EngineCdpLedger(apps/browser-engine/src/frame_authority.rs,cdp_ledger.rs) the sole authority over frame tracking, child-target auto-attach, and extension-frame isolation at parity with official OpenCode (origin/devb9a60d9d078d87bfb90f039e431090508f88ac02), closing all four findings + four rev-2 gaps fromnotes/review-rd274.md.Key Changes
apps/browser-engine/src/frame_authority.rs,cdp_ledger.rs,engine/extensions.rs,prompts.rs):EngineCdpLedgerabsorbsprompts.cdp_ext_frames, tracksframes(parent,session,url: Option<String>,origin,extension),web_sessions,extension_targets,extension_contexts,contexts, and verifiedobjects(DOM.resolveNode->Runtime.callFunctionOn/Runtime.releaseObject).access(frame_id)implements official's cycle-bounded ancestor walk (policy.ts:279-293), treating frames with no URL yet asUnavailableand omittingfile://(#303).classify_surfacedistinguishesClean | Subframes | WholeTab(browser.is_none() -> WholeTab): rawHostMsg::CdpCallstays refused on!CleanAND refuses rawDOM.*/Accessibility.*while extensions are active;HostMsg::TypedCdpCallrefusesWholeTab, keeps a 3-line refusal ofInput.*on!Cleanuntil PR 2 (input_guard.rs) lands, refusesHeapProfiler.*/Profiler.*/Tracing.*while extensions are active (recorded difference), and leaves screenshots unmasked onSubframes(official parity).frame_access+ session ownership across all ref/node calls (DOM.resolveNode,DOM.describeNode,DOM.getBoxModel,DOM.getContentQuads,DOM.scrollIntoViewIfNeeded,DOM.focus,DOM.querySelector*,Accessibility.getFullAXTree,Accessibility.getPartialAXTree,Runtime.callFunctionOn), requiresframeIdonAccessibility.getFullAXTree, refuses excluded frames onDOM.getFrameOwner, and rejects forged/releasedobjectIds.page_context+extension_origin+extension_stackrules (diagnostics.ts:103-134) withoutext_exec_contextscaps or regex redaction.waitForDebuggerOnStartauto-attach lifecycle (frame_authority.rs,cdp_ledger.rs,engine.rs):Target.setAutoAttach { autoAttach: true, waitForDebuggerOnStart: true, flatten: true, filter: [iframe, worker, {exclude:true}] },Page.enable,Runtime.enable,Page.getFrameTreewith retry-on-commit if initial fetch fails).do_message_loop_workturn (avoiding CEF'sObserverListReentrancyPolicywhile requiring zero app round trips): workers resume and detach (child-targets.ts:22-29); extension iframes (and web OOPIFs that commit/redirect to extension origins) stay attached inextension_targetswith nestedTarget.setAutoAttach+Page.getFrameTreeand diagnostics disabled (chromium.ts:617-625, 1146-1157), never forwarded to the app.targetInfo.urlis empty until a clean non-extension URL commits; replays only announced clean web OOPIFs on rootPage.enable(Dispatch::ReplayWebTargets) and replays contexts onRuntime.enable(Dispatch::ReEnable)._cdp_regdrop) orUnprepared(never triggered by worker replies or"no session"/"target closed"races; re-arms automatically on next main-frame commit).Target.setAutoAttach,Target.attachToTarget,Target.detachFromTarget,Target.setDiscoverTargets, andRuntime.runIfWaitingForDebuggeronTypedCdpCall.crates/browser-policy/src/cdp.rs,crates/browser-pane/src/{protocol,machine,client,find,installer}.rs,apps/desktop/src/surfaces/browser/rpc/{session,mod,frames,exec/*}.rs):check_no_pierceforDOM.getDocument/DOM.describeNodeinbrowser-policy.#[serde(default)] Ready.frame_authorityand#[serde(default)] HostMsg::TypedCdpCall.frame_id, and bumpsENGINE_REVISIONfrom2to3incrates/browser-pane/src/installer.rs:17becausehttps://anoma.ly/release/opencode-rune/browser-engine/stable.jsonnow serves156.0.26-2(devwas2).exec/*calls throughTypedCdpCallwhenengine_agent_tools()is true, passesframe_idon ref calls, always sends explicitframeIdonAccessibility.getFullAXTree, skips app-sideTarget.setAutoAttach/detachFromTargetwhenengine_frame_authority()is true, and purges subtrees inTabFrameStateon URL-freeRune.frameExcludednotices.dev5157d6b77(#319Guard 1b,#286cookies,#328downloads,#329debug-only overrides): Preserves Guard 1b (refuse_reply/blocked_url) uniformly on all replies, flattened OOPIFs, and announced events; movesflush_outboxintoengine/picks.rs.Verification
proof/ws9/pr1c-frame-authority-proof.json,OPENCODE_RUNE_OTEL=0, real MV3 extension, re-run afterdev5157d6b77merge): 22/22 PASS + 5/5#319/#286compat probes PASS (Ready.cookies,ProfileCookiesList, Guard 1btyped_cdp_callrefusal +controlled_permission_refusednotice):top -> extension iframe -> cross-origin web iframe: both ran (never stalled), both emitted URL-freeRune.frameExcluded, neither forwarded or present inPage.getFrameTree, both refused onAccessibility.getFullAXTreeandDOM.getFrameOwner.Page.enablereplayed ONLY the clean web OOPIF with its real URL; tree & contexts clean.Unprepared), final iframe ran, typed AX + tree succeeded.DOM.resolveNode->Runtime.callFunctionOn->Runtime.releaseObjectpassed; forged/post-releaseobjectId, excluded-frameDOM.getBoxModel, auto-attach methods, profiling,Input.*on!Clean, rawDOM.*, andpierce: trueall refused.scripts/guardrails.ps1: 5/5 passed (frame_authority.rs763/800,cdp_ledger.rs576/800,engine.rs1,429/1,500,client.rs1,432/1,500).OPENCODE_RUNE_EMBED_PLUGINS=1 cargo.ps1 check --workspace: 0 warnings.cargo.ps1 check --manifest-path apps/browser-engine/Cargo.toml --bins: 0 warnings.scripts/web.ps1 -Check: 0 warnings.