Skip to content

fix(browser): require owned stream capabilities - #758

Open
Zeus-Deus wants to merge 152 commits into
mainfrom
security/browser-stream-capability
Open

Zeus-Deus wants to merge 152 commits into
mainfrom
security/browser-stream-capability

Conversation

@Zeus-Deus

@Zeus-Deus Zeus-Deus commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Problem

The bundled browser sidecar exposed a loopback stream and command endpoint to other local web origins. The paired browser proxy could contact an unrelated listener in the browser port range, and a stale stream URL could point at a different process after a daemon restart. Browser actions requiring confirmation could leave the host pane retrying or lose a second pending request.

Solution

Upgrade the bundled browser sidecar to v0.44 with Origin checks. Route desktop stream traffic through an app-local capability bridge, verify the connected peer before sending HTTP or WebSocket bytes, rotate capabilities when the daemon changes, and limit the paired proxy to an owned browser session and the pane's required API. Revalidate identity when publishing a capability so an older request cannot revoke a replacement daemon's token. Keep status probes responsive during long automation commands and verify browser attachment before returning a stream URL.

Preserve pending confirmation across pane retries, including when its PID appears late, return structured details for the verified daemon, and let the host approve or deny the current request. The host pane also detects a pending action raised by an agent while its stream remains connected. A second approval is shown immediately without reopening the stream. Each approval step gets a fresh host token even when the daemon reuses its command ID; an old prompt cannot decide the next step. Already-open desktop and paired remote WebSocket bridges close when an approval becomes pending. Desktop and paired HTTP forwarding also stop on revocation during peer verification, request writing, or response reading. An on-time decision stays marked in flight while the daemon processes it, so another pane cannot expire it before a follow-up prompt is published. A consumed approval whose replay fails clears its spent prompt and displays the action error. Host-only approval details and desktop bridge commands remain unavailable to paired remote clients. A paired pane can request its first preset navigation and read only the cached preset status. Expired requests stop automatic retries. Retry secure sidecar lookup after a failed probe so a transient failure does not strand a fresh launch.

Paired browser HTTP actions now use typed pane commands. The proxy builds each allowed daemon action itself and rejects unknown actions, fields, and host-only commands before connecting to the daemon. The frontend preserves an approved prompt and polls its expiry without replaying the spent decision. The first preset URL open is tracked in the backend per verified daemon and confirmation prompt, so pane remounts and socket reconnects observe one result; a failed open requires an explicit retry. Remote panes learn approval completion through status without receiving the host prompt token. Pane and prompt epochs discard late socket frames, polls, and approval responses after a session switch or follow-up. Delayed startup and preset prompt reads cannot restore a spent prompt, and a second host pane can observe approval through the preset status even after the prompt disappears. For the bound Windows relay, a completed open with an inconclusive identity probe remains unverified until the next check; retry on the same verified daemon returns completion without opening the URL again. Windows preset dispatch checks the selected daemon against the preverified port, PID, and native process start before the private relay sends command bytes. If a successful open is followed by a verified daemon replacement, the command peer is ambiguous: the pane reports an unconfirmed result and requires an explicit retry after checking the page. Pending startup reads also reconcile a preset that has completed or failed, and a stale approval click keeps observing the preset when another host pane consumed its prompt. An inconclusive Unix identity probe after an unbound CLI open now requires explicit retry, so a replacement daemon cannot receive an automatic second open. While an unrelated browser action awaits approval, preset status reports only redacted approval_pending before any cached result, including when no preset exists. Paired panes keep watching that approval and reconnect after it clears; a cached preset failure is checked through the normal preset path. A pending startup check also reconnects when approval has already settled with no preset, and a failed status read stays on the observer poll. Host approval errors that may have reached the daemon remain visible even over an older cached preset; only known pre-send stale decisions reconnect automatically. An unbound Unix preset reply that is pending without an attributed prompt, failed, or lost remains ambiguous across stream-port retirement and reallocation until explicit Retry or session close. If a preset approval may have been applied but its confirmation reply or final daemon check is lost, the same guard survives prompt expiry and replacement. That uncertain outcome invalidates the old host approval token and keeps stream capabilities, ordinary commands, and direct vision or OS input blocked across reconnect and port retirement until a matching verified prompt resolves or verified close teardown proves the old daemon gone. A definite before-send failure remains retryable with its existing token. After a maybe-applied decision, recovery retains the daemon identity verified by the sender even when the prompt was initially unpinned. Close returns a retryable error until teardown is verified, including on Windows where the owner record is retained. Expiring a prompt and checking recovery and pending state are now one session-locked admission decision, so a concurrent host poll cannot let a command through. For an initially unpinned prompt, Windows accepts its retained private owner record only after it identifies this app's departed process, every control namespace is empty, and the stream port is free; live or ambiguous records keep recovery blocked. A missing stream listener now keeps the pending host token, screenshot waiter, and exact daemon identity while revoking stream bridges and blocking restart; a definitely departed daemon pins recovery before session retirement. The allocation retire path also refuses to discard pending approval state. Unix decisions now use a direct control connection whose peer PID and owned daemon record are verified before writing; the decision path cannot start a replacement daemon. A failure before any decision byte remains retryable, while a lost or partial reply keeps the verified sender pinned for recovery.

On Windows, a pinned departed daemon can release confirmation recovery despite an unrelated listener on its stale control port only when the exact private owner record still matches and endpoint ownership proves that listener unrelated. Pane close pins any pending approval or screenshot capture before retiring the session, and returns a retryable error while verified daemon departure remains unproved. Agent-facing close requests structured JSON and refuses dispatch while an approval, screenshot capture, or recovery guard is pending. A definite Action 'close' denied by policy: response preserves the live session; a close confirmation with an actionable ID and verified owned daemon publishes a host prompt. A generic failed response, lost reply, malformed completion, or unverified prompt pins recovery and invalidates the old token. Direct close resets host state only for success:true,data.closed:true. Approval of a parked close resets state only after the verified peer reports nested result.success:true,result.data.closed:true and the pinned daemon process and captured control endpoint have departed. A missing acknowledgment or unverified teardown keeps recovery pinned. If a changed policy denies a parked close before replay dispatch, the exact nested policy error retires only the spent prompt and preserves the verified live session; other replay failures remain recovery guarded. Explicit pane close remains the guarded recovery path.

Host screenshot, direct vision or OS input, and spawn reject an existing approval before dispatch. Empty snapshot DOM fallback preserves an approval raised by its eval command. Desktop and generic/MCP screenshot requests wait for the approved image on the original request, without dispatching a second screenshot. Confirmed image paths are read as bounded regular files before returning a PNG data URI. The screenshot caller has a 95-second budget; the internal host token retains its 60-second recovery lifetime, while the public approval deadline is the earlier of that expiry and the last safe replay-start time. A canceled caller or exhausted replay window makes the public approval deadline immediate on host poll while preserving Deny and verified-close recovery. The pane refreshes a same-ID deadline change and disables Approve when it expires. A deny-only follow-up immediately returns its shortened public expiry, rather than waiting for the next pane poll. The pinned sidecar itself does not expire its parked action. When the host token expires, recovery is pinned to the verified daemon before the prompt is removed, and the same command invocation rechecks that guard. When the caller's budget ends, the prompt remains blocked, including through a follow-up, and approval cannot dispatch without enough time to replay and return the image. Unix confirmation checks again before its first control byte; the Windows private relay distinguishes expiry before forwarding from a possible partial write. Denial or verified close remains available for recovery.

This head includes #744's daemon ownership checks. Shutdown keeps the daemon's native-start record until guarded cleanup confirms exit, including when binary resolution fails and verified process termination is used.

UI evidence

Both images use the repository's mock browser workspace and a sample pending request.

Before: retry only After: host decision
Before After

The expiry follow-up uses mock screenshot approval data. The same prompt remains available for Deny after its safe approval window ends.

Before: Approve still enabled After: Approve disabled, Deny available
Before expiry fix After expiry fix

Verification

  • On published head 90287500c, the two approved_close_replay Rust regressions passed (2/2): a verified nested Action 'close' denied by policy: keeps the live session and PID without recovery, while a non-policy consumed failure still pins recovery. Final-tree agent_close passed 8/8, confirmation passed 36/36, cargo check -j 2 --manifest-path src-tauri/Cargo.toml and git show --check passed. Independent pinned-sidecar source review found no reachable post-close path that emits this exact policy prefix; it is returned before handle_close. Full exact-head CI is pending; Mario review of this head is pending. Daemon-side confirmationId validation remains in stacked fix(browser): authenticate sidecar stream and daemon #784.
  • On published head 26dea6a97, cargo test -j 2 --manifest-path src-tauri/Cargo.toml --lib agent_close -- --test-threads=2 passed 8/8; --lib confirmation passed 36/36; browser close and browser_close filters passed 5/5 and 6/6. cargo check -j 2 --manifest-path src-tauri/Cargo.toml and git show --check passed. The fake CLI regressions cover exact JSON policy denial, a verified parked close, an approved nested close acknowledgment with concurrent daemon exit and control-endpoint disappearance, missing-ack recovery, and generic failed dispatch. An independent read-only source review found no blocker. Its exact-head CI is historical after the new head; at last read, changes, Iroh/WASM, and Ubuntu web passed while both Rust jobs and Windows web were still running. Mario found the parked-close policy replay gap fixed by 90287500c. The sidecar's direct confirmationId validation remains in stacked fix(browser): authenticate sidecar stream and daemon #784.
  • On published head 91c54cb86, the Unix vanished-confirmation-peer close regression passed in isolation, cargo test -j 2 --manifest-path src-tauri/Cargo.toml --lib confirmation -- --test-threads=2 passed 35/35, cargo check -j 2 --manifest-path src-tauri/Cargo.toml and git show --check passed. The test now expects pane close to retain recovery while its mock owner PID remains live, and verifies ordinary commands stay blocked. No production behavior changed from 4ff8bac03. Full exact-head CI passed every job, including native Windows Rust and acceptance. Mario then found the agent close-policy classification gap addressed by 26dea6a97. Daemon-side confirmationId validation remains in stacked fix(browser): authenticate sidecar stream and daemon #784.
  • On published head 4ff8bac03, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, three agent_close tests (including a real fake-CLI rejected close and pre-dispatch Deny), the pane-close live-owner recovery test, five existing close_ tests, and git show --check passed. Independent read-only review found no blocker. Its exact-head CI passed changes, Iroh/WASM, and Ubuntu web; other jobs were cancelled when the new head started. Native Windows execution and review of that earlier head do not gate the current head. Daemon-side confirmationId validation remains in stacked fix(browser): authenticate sidecar stream and daemon #784.
  • On published head d3b793583, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, the two new agent_close_ regressions, five existing agent_browser::tests::close_ tests, and git show --check passed. Independent read-only review found no blocker. The Windows pinned stale-port regression compiled in native Windows CI but that job was cancelled when the newer head started. Its exact-head CI passed changes, Iroh/WASM, and both web jobs; Ubuntu Rust failed one unchanged managed_native_boundary::managed_native_cancelled_initialization_stops_owned_child integration fixture after 6,344 library tests and 372 other integration tests passed. Mario found pane-close and agent-close dispatch gaps, fixed on the current head. The run is historical after the new push.
  • On published head 0e0e21756, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, focused live-control/missing-listener, departed-daemon recovery, deny-only screenshot follow-up, ambiguous preset reallocation, pending stream open, and uncertain confirmation Rust tests each passed. git show --check passed. Independent read-only review found no blocker. Its exact-head CI is historical after the new push; native Windows verification and review of that earlier head do not gate the current head. The frontend/UI verification and mock screenshots from fa9583c23 remain part of this head.
  • On published head fa9583c23, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, focused --lib confirmation tests (32/32), focused --lib agent_browser::tests::screenshot_ tests (7/7), and focused prompt-poll race, slow public expiry, canceled caller, unpinned close, and late-approval regressions passed. npm run check, npm run test -- src/components/browser/BrowserPane.test.tsx --no-cache --pool=threads (38/38), and git show --check passed. Mock before/after screenshots are embedded above. Independent source review found no blocker. The Windows retained-record regression awaited native CI on this head. Its exact-head CI passed changes, Iroh/WASM, and both web jobs; Windows Rust was cancelled when the newer head started, while Ubuntu Rust was still running. Mario found the listener-loss state retirement and immediate deny-only follow-up expiry gaps, fixed on the current head.
  • On published head 41e6f6f1f, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, focused --lib screenshot tests (15/15), focused --lib confirmation tests (32/32), the empty-snapshot DOM fallback test (1/1), and git show --check passed. Regressions cover host prompt expiry before caller timeout, same-invocation command blocking, late and repeated approval rejection, in-flight follow-up recovery, and a Unix peer delay before the first decision byte. The Windows delayed-relay fixture was source reviewed locally and the native Windows Rust CI job passed. Independent source review found no blocker. Its exact-head CI passed changes, Iroh/WASM, both web jobs, and Windows Rust; Ubuntu Rust failed in unchanged agent_provider::antigravity::tests::full_access_answers_once_and_leaves_questions_to_the_user (6336 other library tests passed). Mario found the concurrent prompt-expiry admission gap and unpinned Windows recovery gap, fixed on the current head.
  • On published head 776ab01ea, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, focused --lib screenshot tests (11/11), focused --lib confirmation tests (31/31), the empty-snapshot DOM fallback test (1/1), and git show --check passed. Its exact-head CI passed changes, Iroh/WASM, both web jobs, and Ubuntu Rust; Windows Rust was cancelled when the new run started. Mario found host-expiry and late-approval gaps, corrected on the current head.
  • On published head 8c7c281f4, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, focused --lib confirmation tests (27/27), focused --lib screenshot tests (4/4), and git show --check passed. Its exact-head CI passed all jobs. Mario found the empty-snapshot DOM prompt and screenshot replay gaps, corrected on the current head.
  • On published head dfade3533, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, cargo test -j 2 --manifest-path src-tauri/Cargo.toml --lib confirmation -- --test-threads=2 (24/24), and git show --check passed. The new Unix tests cover confirm and deny over a verified peer, a vanished socket before dispatch without replacement, wrong-peer zero-byte rejection, a lost reply retaining the sender guard, and a valid replay response over 64 KiB. Independent source review found no blocker. Its exact-head CI passed both web jobs, change detection, and Iroh/WASM. Ubuntu Rust failed one unchanged remote MCP loopback call; Windows Rust failed a preexisting PowerShell peer fixture whose child did not connect within five seconds. Both failures occurred in the full suite and are historical for this new head. Mario found screenshot and snapshot prompt gaps fixed on the current head.
  • On published head 00a7e9039, the final-tree --lib confirmation tests passed (20/20), including close recovery, and the new unpinned lost-reply regression passed (1/1). git show --check passed. Independent source review found no blocker. Its exact-head CI was still running when superseded. Mario found that Unix CLI dispatch could start a replacement after sender verification; the current head binds the decision to the verified peer.
  • On published head 53d4fa7b3, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, 20 focused confirmation tests, two uncertain-preset tests, one unbound lost-reply test, and git show --check passed. The new regressions cover reconnect attachment, capability and direct-input blocking, verified close recovery, and the case where no daemon PID was pinned. Independent source review found no blocker. Its full exact-head CI passed every job. Mario found an unpinned-sender recovery gap, fixed on the current head.
  • On published head dbcb2ed81, the uncertain-approval token invalidation regression and five related approval/preset tests passed (6/6). The new test rejects the old host token immediately and after a follow-up reuses the upstream ID. cargo check -j 2 --manifest-path src-tauri/Cargo.toml, git diff --check, and git show --check passed. Its full exact-head CI passed every job, but Mario found a follow-up recovery gap; the run is historical.
  • On published head e595b8598, the uncertain-approval expiry/reallocation no-replay regression and the before-send retry/known-resolution regression passed (2/2); three related preset tests passed (3/3). cargo check -j 2 --manifest-path src-tauri/Cargo.toml, git diff --check, and git show --check passed. Its CI run is historical because a follow-up head is now published.
  • On published head 7b938547d, the focused reallocation regression, existing unbound lost-reply and failed-stream retry tests, cargo check -j 2 --manifest-path src-tauri/Cargo.toml, and git show --check passed. The first cold build hit a local /tmp quota before Rust compilation; rerunning with a worktree-local temporary directory completed. Its CI run is historical because a follow-up head is now published.
  • On published head e438b67f2, npm run check, npm run test -- src/components/browser/BrowserPane.test.tsx (37/37), cargo check -j 2 --manifest-path src-tauri/Cargo.toml, cargo test -j 2 --manifest-path src-tauri/Cargo.toml --lib preset_ -- --test-threads=2 (37/37), and git diff --check passed. New cases cover Unix pending and lost-reply replacement without automatic open, a paired pane whose approval settles before its first status read, recovery from a failed status read, and host action errors that must remain visible over a cached preset.
  • On parent 3ff0c598d, npm run test -- src/components/browser/stream-protocol.test.ts (45/45) and cargo test -j 2 --manifest-path src-tauri/Cargo.toml web_remote::proxy::tests -- --test-threads=2 (37/37) passed. Those files are unchanged by the later follow-ups.
  • Full exact-head CI ran three attempts on e438b67f2. Every attempt passed change detection, Iroh/WASM, both web jobs, and Windows Rust. Ubuntu Rust failed in a different unchanged path each time: an immediate HTTP listener rebind in agent_control (the focused local rerun passed), a cold OpenCode v1.18.35 list_models timeout tracked in fix(mcp): ask before starting MCP servers a project's own files define #754, then the known git read-tree docs/intro race. The CI gate consequently failed; no further reruns are planned.
  • Mario’s review of e438b67f2 found that port reallocation dropped the ambiguous Unix preset guard; 7b938547d fixed that path. His review of 7b938547d found a second loss when an approval may have been applied but its reply was lost; e595b8598 distinguishes before-send from maybe-applied failures and preserves the guard through expiry and replacement. His review of e595b8598 found that the old host token remained actionable; dbcb2ed81 invalidated it. His review of dbcb2ed81 found that reconnect could restore stream access before recovery; 53d4fa7b3 adds a durable recovery gate and serializes direct input with confirmation. Mario’s review of 53d4fa7b3 found that an initially unpinned prompt could lose the verified sender after a maybe-applied confirmation; 00a7e9039 retains it for recovery. Mario’s review of 00a7e9039 found the Unix CLI replacement race; dfade3533 sends confirm and deny through the verified connected peer. Mario’s review of dfade3533 found screenshot and snapshot prompt gaps; 8c7c281f4 gates host capture and input and preserves prompt IDs. His review of 8c7c281f4 found that the DOM fallback lost an actionable prompt and screenshot replay lost its captured path; 776ab01ea preserves both on the original request. His review of 776ab01ea found that host-token expiry could release a daemon-held action and a late approval could miss the original caller; 41e6f6f1f pins recovery and checks replay time before dispatch. Mario's review of 41e6f6f1f found the concurrent prompt-expiry admission gap and unpinned Windows retained-record recovery gap; fa9583c23 fixes both and aligns the public screenshot approval deadline with its replay window. Mario's review of fa9583c23 found that a missing stream listener could retire a parked approval and that a deny-only follow-up returned a stale public expiry; 0e0e21756 fixes both. His review of 0e0e21756 found that Windows pinned recovery could be blocked by an unrelated listener on the stale port and that agent-facing failed close cleared a pending prompt; d3b793583 addressed both. His review of d3b793583 found that pane close could retire a pending prompt without pinning recovery and that agent-facing close did not reach the CLI; 4ff8bac03 guards pane teardown and wires the close dispatcher. Mario's review of 91c54cb86 found that agent close could not distinguish a definite policy denial or parked approval from an ambiguous failure; 26dea6a97 handles those outcomes and verifies approved-close teardown. Mario's review of 26dea6a97 found that a policy denial during parked-close replay was guarded as ambiguous; 90287500c preserves the exact pre-dispatch denial while keeping other failures guarded. Daemon-side confirmationId validation remains in stacked fix(browser): authenticate sidecar stream and daemon #784. New-head review is pending.
  • The prior 14cd1cf5d run passed both web jobs and Iroh/WASM, then its Rust jobs were cancelled when this new head was dispatched. An earlier 425a38bf6 run passed the app tests but its unchanged real OpenCode v1.18.35 smoke timed out on its first cold list_models request at src-tauri/tests/opencode_native_protocol.rs:91; fix(browser): require owned stream capabilities #758 changes no OpenCode code or smoke fixture. The separately tracked fix(mcp): ask before starting MCP servers a project's own files define #754 fix addresses that deadline. The mock browser pane was inspected at http://127.0.0.1:1420/ on the preceding confirmation head; the development server was stopped afterward.

This PR is a partial boundary. It protects the desktop bridge and paired remote proxy, while direct sidecar WebSocket, HTTP, and daemon command connections still need the authentication in stacked #784. The Unix CLI path cannot yet prove which daemon received an open across a replacement; this PR retains ambiguous results across stream-port reallocation and blocks automatic replay until explicit Retry or session close. Managed Chromium's direct CDP listener remains until stacked #785. Other local processes that can reach those listeners remain outside this protection. The pinned sidecar does not yet validate confirmationId; the host gates its own command paths, and direct same-user sidecar clients remain part of that boundary until stacked sidecar changes.

Implemented by GPT-6 via Codex.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning (blocking) — src-tauri/src/agent_browser.rs:1070–1091 — Resolve the installed Unix sidecar by its bundled name

What's wrong: The Unix branches look for agent-browser-<target>, but Tauri strips the target suffix when copying external binaries; packaged Linux and macOS builds have agent-browser next to the app, and release builds disable the only remaining fallback.

Fix: Resolve agent-browser beside the app on Unix and agent-browser.exe on Windows. Keep the version check and debug-only development path. Add a test for a release-style executable directory with only the bundled filename present; the current resolver test also passes when no binary is found.

Warning (blocking) — src-tauri/src/agent_browser.rs:1835–1846 — Refresh the tracked PID when automation restarts the stream

What's wrong: tracked_pid.or_else(|| read_agent_browser_daemon_pid(&session)) never reads the current PID if a previous launch populated tracked_pid; after that daemon exits and a browser automation command restarts it on the same port, the bridge keeps rejecting the healthy replacement while BrowserPane retries only browserStreamBridgeEndpoints.

Fix: Under the session lifecycle lock, verify the current daemon PID and listener, update the tracked identity and generation, and issue a new capability. Make the reconnect regression exercise a stale tracked PID and a verified replacement, not just a mocked endpoint that returns a new URL.

CI: No check runs or commit statuses were reported for this head. Static review only; repository code was not built or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 36c3c2b598ccc3a3962e0a431c6f2b97a0ce65f7.

  1. Warning (blocking) — src-tauri/src/agent_browser.rs:1954–1955: Windows builds no longer type-check. browser_control_port now returns Option<u16> at line 713, but SocketAddr::from(([127, 0, 0, 1], port)) still requires a plain u16. Fix: Convert None to an I/O error for the missing or invalid .port file before constructing the address. Do not restore the guessed-port fallback.
  2. Warning (blocking) — src-tauri/src/web_remote/proxy.rs:132–135 and :287–297: Verify the connected stream peer, not just the listening port. Both connect_async(&url) and TcpStream::connect(("127.0.0.1", port)) take only a port after authorization, so a daemon that exits between verification and connection can leave the desktop or web-remote bridge talking to a different local service. Fix: Carry the verified daemon identity into both transports and authenticate the established peer before sending the HTTP request or WebSocket handshake. Fail closed when the peer cannot be verified.

Prior findings: The release resolver now uses the installed sidecar filename. Stream verification now reads the current daemon PID and rotates the capability when the verified identity changes. Both fixes have regression coverage in the diff.

CI: GitHub reported no check runs or commit statuses for this head. Static review only; no repository code was built or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning (blocking) — src-tauri/src/agent_browser.rs:6320–6325: Keep the stream blocked when the approval outcome is unknown

What's wrong: entry.confirmation_pending = false clears the readiness gate even though the daemon may still have the original prompt or a follow-up, and reconcile_existing_stream_attachment can set browser_ready = true on reconnect based on attachment alone, reopening stream access before the host has resolved the approval.

Fix: Invalidate the old token but keep a separate recovery-required state that blocks bridge publication and ordinary commands. Clear it only after fresh, verified confirmation state or explicit session recovery. Extend the lost-reply regression to verify that reconnecting to an attached browser does not publish a capability while approval is unresolved.

Prior findings: The spent token is now invalidated, and the preset no-replay guard still survives reallocation. The failed-launch marker retention suggestion remains nonblocking and is present on the base.

CI: In the exact-head workflow-dispatch run, changes and iroh-wasm passed. Ubuntu and Windows Rust and web checks were still running. Static review only; repository code was not built or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 53d4fa7b3a0ac11b11d6ab6a7b45e71002f27b52.

Warning (blocking) — src-tauri/src/agent_browser.rs:6419–6425: Keep the verified daemon identity for recovery

What's wrong: The lost-reply path saves daemon: pending.daemon.clone(), which can be None even though the decision sender verified current before dispatch. On Windows, close intentionally retains the ownership record, so the unpinned recovery check rejects the namespace even after that daemon exits. The pane close still returns success, but the session stays blocked.

Fix: Carry the pre-dispatch verified record in MaybeApplied and use it for recovery. Keep unverified failures fail-closed, and return a retryable error if close cannot clear recovery. Test an initially unpinned prompt, a lost reply, and Windows teardown with the normal ownership record still present. The new unpinned test manually removes a daemon marker; it does not cover this record.

Prior findings: The recovery guard now prevents a lost approval reply from reopening the stream or enabling ordinary commands. The failed-launch marker retention suggestion remains nonblocking and is also present on the base.

CI: In the exact-head workflow-dispatch run, changes and iroh-wasm passed. Ubuntu and Windows Rust and web checks were still running. Static review only; no repository code was built, installed, or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 00a7e9039658c2963fb710d985eab49014f3e280.

Warning (blocking) — src-tauri/src/agent_browser.rs:5784–5796: Bind Unix approval dispatch to the verified daemon

What's wrong: The Unix branch runs confirm or deny by session name but records Some(current.clone()) on failure; if the verified daemon exits before dispatch, the sidecar CLI can start a replacement that returns “No pending confirmation,” leaving recovery pinned to the dead daemon. Close only targets the pinned process and cannot clear recovery while the replacement's control socket is reachable, so retrying close cannot recover the pane while that replacement lives.

Fix: Send Unix decisions over a control connection verified against the expected daemon, without automatic respawn. Return BeforeSend if that peer disappears before any decision bytes are written. Test daemon exit between verification and dispatch; no replacement should be started by the decision, and close should permit a later clean startup.

Prior findings: The Windows relay now carries the verified daemon into recovery, including when the prompt was initially unpinned and close retains the ownership record. Close now reports unresolved recovery instead of returning success. The nonblocking failed-launch marker retention issue remains on the base.

CI: In the exact-head workflow run, changes and iroh-wasm passed. Both Rust and both web jobs were still running when checked. Static review only; repository code was not built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed dfade3533894127ce7df24d5c4c955a91a6da1fb.

Warning (blocking) — src-tauri/src/agent_browser.rs:7265–7268: Preserve the pending prompt across screenshot requests

What's wrong: get_screenshot_locked checks require_confirmation_recovered but not whether an approval is already pending, so under a screenshot confirmation policy the daemon can replace its pending action while the host still shows the old prompt. Verifying the daemon PID does not verify the prompt: the pinned sidecar's decision handlers consume the current pending action without checking confirmationId.

Fix: Route screenshot capture through the same pending-confirmation gate and outcome handling as ordinary automation. Add a regression that checks a screenshot request cannot replace an existing prompt. Require daemon-side prompt ID validation before treating the decision as bound to a specific action.

Warning (blocking) — src-tauri/src/agent_browser.rs:6104–6105: Preserve snapshot confirmation metadata

What's wrong: serde_json::json!({ "tree": stdout }) puts a plain-text snapshot approval prompt in tree, but confirmation reconciliation only reads result, raw, and the JSON envelope, so the host receives a pending prompt without an ID and cannot approve or deny it.

Fix: Extract confirmation metadata from the sidecar response before wrapping snapshot output as page content. Pass it separately to session reconciliation. Test that a policy-gated snapshot produces an actionable host prompt.

Prior findings: Unix decisions now go over a control connection verified against the expected daemon, without CLI respawn. The prior recovery fixes remain in place. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head CI run, changes and iroh-wasm passed; Ubuntu and Windows Rust and web checks were still in progress. Static review only; repository code was not built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 8c7c281f4bf6d62c1b3efa765f67caf885cbad6d.

Warning (blocking) — src-tauri/src/agent_browser.rs:6099–6113: Surface confirmation from the snapshot’s DOM fallback

What's wrong: The fallback puts extract_eval_result(&dom_stdout) into the tree but classifies the response using the original snapshot’s stdout; when an empty interactive snapshot falls back to a policy-gated evaluate, the daemon parks the evaluation, but CodeMux reports a successful snapshot and leaves the bridge ready with no actionable prompt.

Fix: Classify the fallback response before treating it as tree text. Propagate ConfirmationPending and the fallback’s prompt details through session reconciliation. Test an empty snapshot followed by a pending evaluation through the action dispatcher; the new test only supplies an already-classified result.

Warning (blocking) — src-tauri/src/agent_browser.rs:7288–7301: Return the screenshot captured after approval

What's wrong: The initial capture returns a pending error, but the confirmation handler reduces the successful replay to Resolved, discarding the captured file’s path; retrying capture starts a new action that requires approval again.

Fix: Associate the pending capture with a request ID and deliver the replayed image to that request without submitting a second capture. Test the whole capture–approval–image flow, not just prompt registration.

Prior findings: A tracked prompt now blocks screenshot, direct input, and spawn. A direct plain-text snapshot prompt now retains its ID. The sidecar still does not check the supplied confirmation ID against the parked action; daemon-side validation remains unaddressed. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head run, changes and iroh-wasm passed; Ubuntu and Windows Rust and web checks were still in progress when checked. Static review only; no repository code was built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 776ab01ea73d1b0b15174732730c111bfce589ab.

Warning (blocking) — src-tauri/src/agent_browser.rs:6696–6704: Keep the session blocked when the host prompt expires first

What's wrong: fail_pending_screenshot(...) removes the capture before clearing confirmation_pending, so when prompt polling reaches the host's 60-second expiry before the caller's deadline, the waiter finds nothing left to guard and the pane can reopen a stream while the daemon still holds the request. The pinned sidecar's pending record has no expiry.

Fix: Expire the host token without treating that as a daemon decision. Preserve the guard until the verified daemon acknowledges a denial or the session is safely torn down. Use the same expiry logic in the decision handler and recheck the guard before proceeding with a command. Add a regression where prompt polling expires the prompt before the screenshot caller times out.

Warning (blocking) — src-tauri/src/agent_browser.rs:6838–6854: Check the screenshot deadline before sending approval

What's wrong: pending.begin_decision(id)? checks the token but not the screenshot caller's remaining budget, so a click after a slow initial capture can start a replay that succeeds after the caller has timed out; at that point the code discards the image and a retry needs another approval.

Fix: Check the remaining budget at dispatch, not just at registration and after a follow-up. If the caller no longer has enough time, don't replay the capture; keep denial or verified recovery available. Add a regression for an approval clicked before prompt expiry but too late to deliver the image.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5812–5817: Bind approval to the parked action, not just the daemon

What's wrong: CodeMux sends confirmationId, but the pinned sidecar's confirm and deny handlers ignore it and consume whichever action is pending; a verified daemon and a matching host token do not prove that the daemon is still holding the action shown to the user.

Fix: Require the sidecar to atomically validate the pending request ID before consuming it. Test that a mismatched ID leaves the parked action untouched for both approval and denial.

Prior findings: The DOM fallback now surfaces its confirmation details. An approved screenshot can now return the image to the original request without a second capture; the deadline cases above are still unresolved. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head run, changes and iroh-wasm passed. Ubuntu and Windows Rust and web checks were still in progress. Static review only; no repository code was built, installed, or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 41e6f6f1f1bc63a8bc95bd3f2151f97a829b1110.

Warning (blocking) — src-tauri/src/agent_browser.rs:7854–7856: Check pending approval and recovery state together

What's wrong: The screenshot path calls require_confirmation_recovered before awaiting require_no_pending_confirmation; prompt polling can expire the prompt between those checks, so the command sees neither the new recovery guard nor the old prompt and dispatches while the daemon still holds the action.

Fix: Expire the prompt and check both states under the same session lock. Use the same check for ordinary commands, direct input, and spawn. Test a poll that expires the prompt while a command is waiting to check whether it can dispatch.

Warning (blocking) — src-tauri/src/agent_browser.rs:6805–6811: Recover expired prompts that had no daemon record yet

What's wrong: or_insert_with can now save a recovery guard with daemon: None when an initially unpinned prompt expires; even if close later finds and stops the verified daemon, Windows deliberately retains the ownership record, so the unpinned recovery check still rejects the session after a successful shutdown.

Fix: Carry the daemon identity verified by close into the departure check when it can be tied to this session, and keep the guard if that check is inconclusive. Add a Windows regression that expires an unpinned prompt, stops the verified daemon, leaves its ownership record in place, and permits a clean startup.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5892–5897: Bind decisions to the parked action

What's wrong: CodeMux sends confirmationId, but the pinned sidecar's decision handlers still consume the current pending action without checking that ID, so a matching host token and verified daemon do not establish that the decision applies to the action shown in the pane.

Fix: Require the sidecar to compare the pending ID before consuming the action. Test that a mismatched ID leaves the action untouched for both approval and denial.

Prior findings: The new expiry path retains a recovery guard when polling expires a screenshot prompt, and the late-approval checks reject a click with insufficient replay time. The concurrency gap above remains. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head workflow run, changes and iroh-wasm passed. Rust and web checks on Ubuntu and Windows were still running when checked. Static review only; repository code was not built, installed, or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed fa9583c234a04ee8c74f18666f700b86ff230973.

Warning (blocking) — src-tauri/src/agent_browser.rs:8261–8263: Preserve approval state when the stream listener goes away

What's wrong: clear_stale_running_stream_allocation removes the whole session when stream listener ownership is false, even if the daemon's separate control endpoint is still alive and holding a confirmation. The next command then sees neither a pending token nor a recovery guard, and the new check at the restart boundary is too late to preserve the prompt.

Fix: Check confirmation state before retiring or resetting the allocation. If only the stream listener is gone, keep the prompt actionable against the verified control daemon or retain a recovery guard until teardown is verified. Test reconnect with a pending confirmation, a missing stream listener, and a still-live control peer; ordinary commands should remain blocked.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5928–5933: Bind decisions to the action the user saw

What's wrong: CodeMux sends confirmationId, but the pinned sidecar's decision handlers ignore it and consume the current pending action. Verifying the daemon and host token does not verify that the action still matches the prompt shown to the user.

Fix: Require the daemon to compare the pending ID before consuming the action. Test that a mismatched ID leaves the pending action unchanged for both approval and denial.

Suggestion — src-tauri/src/agent_browser.rs:7160–7165: Return the updated expiry with a deny-only follow-up

What's wrong: public_screenshot_expiry_at updates the stored prompt after response has cloned it, so the pane briefly enables Approve on a follow-up whose screenshot caller has already run out of time, until the next poll corrects it. The backend rejects that approval.

Fix: Rebuild the returned prompt from the updated state, and assert that the immediate decision response already has the shortened expiry in the existing follow-up timeout test.

Prior findings: Commands, direct input, spawn, and screenshots now check pending and recovery state under one lock. Windows recovery now accepts a departed current-owner record when the control namespace is clean. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head run, changes and iroh-wasm passed. Ubuntu and Windows Rust and web checks were still running when checked. Static review only; no repository code was built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 0e0e21756ffe37601e1125538d2352c25b3b9eff.

Warning (blocking) — src-tauri/src/agent_browser.rs:8334–8362: Let Windows close recover after verified daemon departure

What's wrong: guard_unresolved_confirmation now pins recovery before retiring a departed daemon's stream, but the close path requires the old control port to be unreachable. On Windows, reconciliation already accepts a verified unrelated listener on a stale .port entry as proof that the old control endpoint is gone. If the daemon exited with a prompt pending and that port was reused, reconnect retires the allocation, but every close still reports unverified recovery until the unrelated listener exits.

Fix: Apply the same identity-aware Windows endpoint check during pinned recovery, or safely retire the verified stale metadata before checking again. Cover a departed daemon with a pending prompt and a live unrelated listener; close should clear recovery without touching that listener.

Warning (blocking) — src-tauri/src/agent_browser.rs:7540–7547: Don't discard a pending prompt when agent-facing close fails

What's wrong: self.note_close_finished(browser_id).await clears the host prompt and screenshot waiter without checking the close outcome. An agent-facing close is allowed while approval is pending, and the sidecar can deny close by policy. The daemon can therefore keep its pending action while CodeMux loses the prompt and admits ordinary commands again.

Fix: Keep the prompt when close is rejected and the same daemon still holds it. For an uncertain close, retain a recovery guard until teardown is verified. Add a regression that a rejected close cannot clear an existing approval or unblock the session.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5928–5933: Bind decisions to the action shown to the user

What's wrong: CodeMux sends confirmationId, but the bundled agent-browser v0.44.0 confirm and deny handlers ignore it and consume the current pending action. Verifying the daemon and the host token does not verify that action.

Fix: Require the daemon to compare the supplied ID with the parked action's ID before consuming it. Test that a mismatch leaves the parked action untouched for both approval and denial.

Prior findings: Losing only the stream listener now preserves the prompt and blocks ordinary commands. The immediate deny-only follow-up response now includes the shortened approval expiry. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head run, changes and iroh-wasm passed. Ubuntu and Windows Rust and web jobs were in progress when checked. Static review only; repository code was not built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed d3b7935832251c08401a9fa336cce837f3e3ebe9.

Warning (blocking) — src-tauri/src/agent_browser.rs:8031–8036: Keep a pending approval guarded during pane close

What's wrong: sessions.remove(browser_id) drops the only pending prompt, but close_locked verifies daemon departure only when a recovery guard already exists, so an unsuccessful best-effort teardown can return Ok(()) and let the next command reach the still-live daemon with its approval unresolved.

Fix: Before removing a session with a pending prompt or capture, preserve a recovery guard tied to the verified daemon. Return a retryable error until teardown is verified. Test pane close with a pending prompt and an owned daemon that survives the teardown attempt; ordinary commands should remain blocked.

Warning (blocking) — src-tauri/src/agent_browser.rs:4809–4811: Exercise the real agent-facing close path

What's wrong: build_agent_browser_argv_groups has no close case, so an agent-facing close without an existing recovery guard returns Unknown action: close before dispatch; the new failed-close test injects a result after the point where the real call stops.

Fix: Wire close through the normal dispatcher and classify a structured reply as completed, rejected, pending, or uncertain. Test through run_command with a rejected close and verify that the original prompt remains actionable. The missing dispatch case is also on the base; it corrects the previous review's assumption that this call already reached the sidecar.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5950–5956: Bind decisions to the action shown to the user

What's wrong: CodeMux sends confirmationId, but agent-browser v0.44.0's confirm and deny handlers ignore it and consume the current pending action, so checking the host token and daemon identity does not ensure the decision applies to the displayed prompt.

Fix: Require the sidecar to compare the supplied ID with the parked action's ID before consuming it. Test that a mismatch leaves the action untouched for both approval and denial.

Prior findings: Windows pinned recovery now recognizes an unrelated listener on the departed daemon's recorded port without stopping that listener. The new close reconciliation preserves state on an explicit rejection and keeps a recovery guard on an uncertain reply, but its normal agent-facing dispatch is missing as noted above. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head run, changes and iroh-wasm passed. Rust and web checks on Ubuntu and Windows were still running when checked. Static review only; repository code was not built, installed, or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 4ff8bac03ac1f79bdf1b52c2352dcffb9dac6638.

Warning (blocking) — src-tauri/src/agent_browser.rs:7564–7576: Keep close policy outcomes separate from uncertain teardown

What's wrong: else if result.is_ok() sends both a policy-denied close and a close awaiting approval into the recovery branch, which discards the prompt; a later agent-facing close then uses forced pane teardown instead of honoring the sidecar's denial or waiting for approval. The pinned sidecar rejects policy-denied actions before dispatch and explicitly supports parking close for confirmation.

Fix: Preserve the existing prompt on a verified pre-dispatch rejection. Register a policy-gated close as an actionable prompt, and don’t submit it over an already parked action. Reserve recovery for genuinely uncertain outcomes and keep forced teardown separate from agent-facing close. Test both policy outcomes through run_command; the new fake launcher only returns a generic failure.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5953–5958: Bind approval and denial to the displayed action

What's wrong: CodeMux sends "confirmationId": id, but the bundled agent-browser v0.44.0 confirm and deny handlers ignore it and consume whichever action is parked, so a valid host token and verified daemon identity still don’t establish that the decision applies to the displayed action.

Fix: Require the sidecar to atomically compare the supplied ID with the parked action before consuming it. Test that a mismatched ID leaves the parked action untouched for both approval and denial.

Prior findings: Pane close now retains a recovery guard before removing a session with an unresolved prompt, and agent-facing close now reaches the dispatcher. Failed-launch marker retention remains nonblocking and is present on the base.

CI: In the exact-head run, changes and iroh-wasm passed. Rust and web checks on Ubuntu and Windows were still running when checked. Static review only; repository code was not built, installed, or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 91c54cb86b1b1d225a5a242eef12331102a9160a. The only new commit extends the Unix regression test to check that a failed pane close keeps recovery pinned and blocks a subsequent open. It does not change production code. Both prior blockers remain.

Warning (blocking) — src-tauri/src/agent_browser.rs:7564–7576: Honor the sidecar’s close policy

What’s wrong: else if result.is_ok() treats a policy rejection or a close awaiting approval as uncertain teardown, discards the prompt, and sends the next agent-facing close through forced pane teardown instead of honoring the denial or waiting for approval.

Fix: Keep the existing prompt on a verified pre-dispatch rejection. Surface a policy-gated close as its own prompt, but don’t dispatch it over an action already awaiting approval. Reserve forced teardown for the explicit host recovery path. Add dispatcher tests for both policy denial and pending confirmation.

Warning (blocking) — src-tauri/src/agent_browser.rs:5953–5958: Bind decisions to the displayed action

What’s wrong: CodeMux sends "confirmationId": id, but the bundled agent-browser v0.44.0 confirm and deny handlers ignore that field and consume the current pending action, so verifying the daemon and host token does not bind the decision to the action shown to the user.

Fix: Require the sidecar to atomically compare the supplied ID with the parked action’s ID before consuming it. Test that a mismatch leaves the parked action untouched for both approval and denial.

CI: In the exact-head run, changes and iroh-wasm passed. Both Rust and both web jobs were in progress when checked. Static review only; no repository code was built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 26dea6a97f2751822c39ca0c352bafeb2e00ef25.

Warning (blocking) — src-tauri/src/agent_browser.rs:7184–7187: Preserve an explicit policy denial during close replay

What’s wrong: The Ok((record, _)) arm converts a ConsumedFailure into MaybeApplied, so if the sidecar’s hot-reloaded policy denies close after the prompt was shown, CodeMux discards the denial message and locks the still-running session until the user closes it from the pane. The sidecar consumes the prompt and replays under the current policy; a policy denial returns before dispatch.

Fix: Pass a verified pre-dispatch policy denial through as a consumed failure, clear the spent prompt, and report the denial without installing a recovery guard. Keep the guard for failures that could have partially closed the browser. Add a regression for a close that is parked, then denied by policy on replay.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5960–5965: Bind decisions to the displayed action

What’s wrong: CodeMux supplies "confirmationId": id, but agent-browser v0.44.0’s confirm and deny handlers ignore that field, so checking the host token and daemon identity still does not bind the decision to the action shown to the user.

Fix: Require the sidecar to compare the supplied ID with the parked action’s ID atomically before consuming it. Test that a mismatched ID leaves the action untouched for both approval and denial.

Prior finding: Agent-facing close no longer dispatches over an existing prompt or escalates to forced teardown. A direct policy denial now leaves the session available, and a policy-gated close publishes a host prompt. The denial-on-replay case above remains.

CI: In the exact-head CI run, changes and iroh-wasm passed. Both Rust and both web jobs were still running when checked. Static review only; repository code was not built, installed, or run locally.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

@mario-reviewer mario-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 90287500c825fd3e06a8f312d3eff246fcf7dbf9. The prior close-replay finding is fixed: a verified policy denial clears the spent prompt and preserves the live session. Other replay failures still require recovery. The new tests cover both branches.

Warning (blocking, unresolved) — src-tauri/src/agent_browser.rs:5960–5965: Bind the decision to the displayed action

What's wrong: CodeMux sends "confirmationId": id, but the bundled agent-browser v0.44.0 confirm and deny handlers ignore it and take whichever action is pending, so a matching host token and verified daemon do not guarantee that the decision applies to the displayed action.

Fix: Ship a sidecar that atomically compares the supplied ID with the parked action's ID before consuming it. Test that a mismatched ID leaves the action pending for both approval and denial. This head still pins v0.44.0; the follow-up in #784 does not resolve the finding on this head.

The prior failed-launch marker retention suggestion is unchanged and nonblocking; it is also present on the base branch.

CI: In the exact-head run, changes and iroh-wasm passed; the Ubuntu and Windows Rust and web jobs were in progress when checked. Static review only; repository code was not built, installed, or run.

Verdict: REQUEST_CHANGES

🤖 Automated review by Mario (AI). Findings may be wrong; a human makes the final call.

Zeus-Deus added a commit that referenced this pull request Nov 29, 2026
Bring in #784's commits 8897feb and c2f9249 (daemon-owned confirmation
IDs, legacy daemon close, read-only viewport) and every #758 follow-up the
pipe branch lacked. The CDP pipe patch is regenerated over the new auth
patch, and its approved-navigation test now sends the parked confirmation
ID that the auth patch requires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Zeus-Deus
Zeus-Deus changed the base branch from security/browser-owned-runtime to main November 29, 2026 22:09

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants