feat(extension): coordinate browser execution across panels - #5694
Open
iscekic wants to merge 9 commits into
Open
feat(extension): coordinate browser execution across panels#5694iscekic wants to merge 9 commits into
iscekic wants to merge 9 commits into
Conversation
This was referenced Aug 29, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (9 files)
Reviewed by grok-4.6 · Input: 384.6K · Output: 31.6K · Cached: 796.3K Review guidance: REVIEW.md from base branch |
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
BrowserExecutionCoordinatorseparatesPROVIDER_OWNER_LOCKfromBROWSER_EXECUTION_LOCK;BrowserAdmissiongrants shared local or exclusive delegatedBrowserExecutionLeasevalues, rejecting local requests behind delegated owners or waiters.BrowserLockStoragestoressafetySchemaunderBROWSER_EXECUTION_SAFETY_KEYandownerSchemaunderOWNER_KEY; missing safety records default empty, uncertainty or storage errors block execution, andBrowserExecutionSnapshotreports display-only ownership.BrowserRecoveryneeds Web Locks, drained actions, and closed affected tabs; unsupported browsers permit local work but persist uncertainty asallTabs, requiring all target tabs closed.Files
apps/extension/entrypoints/sidepanel/browser-execution-lock.ts— Source, added, 509 changed lines. Adds origin-scoped coordination, authenticated-session ownership labels, cancellable delegated admission, and lease release after runners and awaited actions finish. Storage watchers and 500 ms polling report native occupancy; sanitized owner records never authorize work. Serializes native quarantine writes, retains failed leases for coordinator-owned recovery retries, and preservesallTabsthrough reloads and restored support. Recovery never steals an active execution lock or waits behind one.apps/extension/entrypoints/sidepanel/browser-execution-lock.test.ts— Test, added, 701 changed lines. Adds coordinator regression coverage for shared local execution, exclusive delegation, waiter cancellation, quarantine persistence, unsupported contexts, and explicit recovery.BrowserRunContextcarries credentials, settings, approvals, and callbacks; callers must supplyExecutionGuard, a lease, and a fixed tab withallowTabFallback: false.runBrowserTurnandrunBrowserWorkflowreuse existing runners and returnLlmTurnOutcomeorBrowserWorkflowOutcome; local callers resolve fallback first, while delegated callers supply approved tabs.effectsUncertainpersists quarantine before result conversion or another model turn;toolResultsexcludes unconfirmed actions, and target-tab closure aborts execution.Files
apps/extension/entrypoints/sidepanel/browser-run-context.ts— Source, added, 234 changed lines. Extracts existing safe and dangerous runner setup and workflow and remote Model Context Protocol (MCP) adapters without adding another agent. Keeps gateway credentials separate from remote fetch and shares one lease across workflows, actions, and recursive continuation. A transient WeakMap transfers workflow reservations without changing the existing request shape or persisting a lease.AgentChatPanelacquiresBrowserAdmissionbefore clearing drafts, draining queued messages, or consuming workflows, then rechecks conversation activity and model availability. Blocked input requires explicit resubmission or resume; a changed or closed target cannot redirect a pending submission. Stop, conversation closure or deletion, history replacement, and unmount cancel pending admission; workflow execution and model continuation retain one lease until awaited work ends.Files
apps/extension/entrypoints/sidepanel/agent-chat-panel.tsx— Source, modified, 894 changed lines. Routes chat and direct workflows through the guarded context, snapshots targets before admission, checks actual tab existence, and preserves edits made during admission. Adds current blocker feedback, explicit queue and workflow resume controls, and reservation cleanup; uncertain workflow results stop before any model continuation. Workflow requests now use the panel’s Jotai store consistently; legacy requests without a reserved lease acquire admission before execution.apps/extension/entrypoints/sidepanel/agent-chat-panel.test.ts— Test, modified, 1,282 changed lines. Expands regression coverage for admission races, retained input, fixed tabs, cancellation, local concurrency, workflow uncertainty, and release after awaited work ends.WorkflowRow.onRunnow accepts anAbortSignaland returnsPromise<boolean>; the newblockerprop keeps rejection feedback above the parameter form. Settings usesreserveWorkflowLeaseand chat usestakeWorkflowLeaseto share admission without changingWorkflowRunRequestorworkflowRunRequestAtom. Cancelled or unmounted forms cannot publish delayed requests; failed admission retains parameters, and pending workflows reject duplicate submissions.Files
apps/extension/entrypoints/sidepanel/workflow-settings.tsx— Source, modified, 91 changed lines. Acquires admission before publishing a request or closing Settings, preserves the initiating conversation, rejects replacement of pending requests, and releases unused leases. Displays current ownership, quarantine, and unsupported-browser messages instead of retaining an old owner claim.apps/extension/entrypoints/sidepanel/workflow-row.tsx— Source, modified, 69 changed lines. Awaits admission before dismissing the parameter form, prevents duplicate submissions, and aborts pending submissions on Cancel or unmount. Shows blocker feedback above the open form.apps/extension/entrypoints/sidepanel/workflow-settings.test.tsx— Test, modified, 364 changed lines. Expands Settings and parameter-form coverage for retained values, cancellation, lease transfer, pending requests, and ownership feedback.An abstract syntax tree (AST) inventory rejects unguarded runner imports, calls, aliases, element access, and direct browser dispatch outside approved adapters. New callers use
runBrowserTurnorrunBrowserWorkflow; onlyexecuteEvalToolCall(event)and the read-onlysendTabDebuggerRequestretain named legacy exceptions with removal conditions. Admission-order checks and mutation fixtures protect the boundary; runtime guards and native browser verification remain necessary for model-authored JavaScript and scheduling.Files
apps/extension/entrypoints/sidepanel/browser-action-boundary.test.ts— Test, added, 504 changed lines. Adds table-driven chat, queue, Settings, workflow, and continuation checks, plus alias, direct-dispatch, and static injected-code mutation fixtures. Inventories fixed injected helpers and permits later provider callers through the guarded public run interface without expanding the adapter exceptions.Tests: 4 files changed—
agent-chat-panel.test.ts,browser-action-boundary.test.ts,browser-execution-lock.test.ts, andworkflow-settings.test.tsx—with 2,851 changed lines. The handoff records 4/4 passing checks: focused Vitest, formatting, type-aware lint/type checking, andgit diff --check.Generated: 0 files changed.
Verification
Manual browser and visual verification did not run. This slice limits local verification to changed-file checks and unit tests; native multi-panel proof remains assigned to level 13.
Visual Changes
Visual Changes: N/A
Reviewer Notes
This level adds coordination infrastructure only; it does not enable the complete browser provider. Approvals, persistence integration, provider execution, and supervision controls are outside this level.
Human steps
allTabsis set: Close every target tab before requesting explicit recovery.This level requires no new environment values, secrets, database migrations, or manual data conversion.
Notes
Live browser verification is pending. Native Chrome and Firefox behavior, the real CLI, and the local relay remain required before human-ready.
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
browser-task-0787— feat(browser-task): define negotiated job contracts #5638browser-task-0787-s2— feat(session-ingest): persist owned browser jobs #5644browser-task-0787-s3— feat(session-ingest): route fenced browser providers #5648browser-task-0787-s4— feat(cloud-agent-sdk): support browser provider jobs #5653browser-task-0787-s7— fix(extension): expose honest browser runner outcomes #5681browser-task-0787-s8— feat(extension): coordinate browser execution across panels #5694 ← this PRbrowser-task-0787-s9— fix(extension): invalidate ended browser task approvals #5698browser-task-0787-s10— feat(extension): persist browser jobs and profile consent #5702 (tip)