Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
f817903
Add browser automation fixture suite + reliability regression UITests…
lawrencecchen Jun 10, 2026
24d529f
Fix browser CLI reliability: worker-lane JS methods, CSP eval fallbac…
lawrencecchen Jun 10, 2026
3c7a8d8
Address autoreview: restore discarded tabs instead of blanking; updat…
lawrencecchen Jun 10, 2026
6c8b8be
UITests: treat foreground as best-effort on hosted runners; gate on s…
lawrencecchen Jun 10, 2026
b20ef81
UITests: never activate() in socket-driven browser tests; track new f…
lawrencecchen Jun 10, 2026
de24e6c
UITests: wrap launch in non-strict XCTExpectFailure for headless-runn…
lawrencecchen Jun 10, 2026
07db958
Address autoreview: invalidate the blank-page kick KVO observation on…
lawrencecchen Jun 10, 2026
7b5b4eb
Address autoreview: run --snapshot-after off main; preserve about:bla…
lawrencecchen Jun 10, 2026
871a315
Address Greptile P1: flag isolated-world eval results instead of retu…
lawrencecchen Jun 10, 2026
26dbae0
Address autoreview: in-process browser dispatch, wait routing, gate C…
lawrencecchen Jun 10, 2026
3e65735
Address Codex P2: preserve cmux-diff-viewer:// URLs in open_split
lawrencecchen Jun 10, 2026
1a9d6fa
Address autoreview: external schemes in open_split, sidebar order, fi…
lawrencecchen Jun 11, 2026
e1e96b7
Merge remote-tracking branch 'origin/main' into feat-browser-reliability
lawrencecchen Jun 11, 2026
498ab45
Fix Swift warning budget after main merge: nonisolated JS constants, …
lawrencecchen Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions CLI/cmux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11451,6 +11451,11 @@ struct CMUXCLI {
let (workspaceOpt, argsAfterWorkspace) = parseOption(subArgs, name: "--workspace")
let (windowOpt, argsAfterWindow) = parseOption(argsAfterWorkspace, name: "--window")
let (focusOpt, urlArgs) = parseOption(argsAfterWindow, name: "--focus")
// Reject unrecognized flags instead of folding them into the URL, where they
// would silently produce an unparseable URL (blank page) or a search query.
if let strayFlag = urlArgs.first(where: { $0.hasPrefix("--") }) {
throw CLIError(message: "browser \(subcommand) does not support \(strayFlag)")
}
let url = urlArgs.joined(separator: " ").trimmingCharacters(in: .whitespacesAndNewlines)
let respectExternalOpenRules: Bool = {
guard let raw = ProcessInfo.processInfo.environment["CMUX_RESPECT_EXTERNAL_OPEN_RULES"] else {
Expand Down Expand Up @@ -11507,10 +11512,12 @@ struct CMUXCLI {

if subcommand == "goto" || subcommand == "navigate" {
let sid = try requireSurface()
var urlArgs = subArgs
let snapshotAfter = urlArgs.last == "--snapshot-after"
if snapshotAfter {
urlArgs.removeLast()
// Accept --snapshot-after at any position, then reject any other flag instead
// of folding it into the URL, where it would silently turn into a search query.
let urlArgs = subArgs.filter { $0 != "--snapshot-after" }
let snapshotAfter = urlArgs.count != subArgs.count
if let strayFlag = urlArgs.first(where: { $0.hasPrefix("--") }) {
throw CLIError(message: "browser \(subcommand) does not support \(strayFlag)")
}
let url = urlArgs.joined(separator: " ").trimmingCharacters(in: .whitespacesAndNewlines)
guard !url.isEmpty else {
Expand Down Expand Up @@ -11662,7 +11669,11 @@ struct CMUXCLI {
params["timeout_ms"] = max(1, Int(seconds * 1000.0))
}

let payload = try client.sendV2(method: "browser.wait", params: params)
// Give the socket response timeout headroom beyond the wait deadline so long
// waits are reported by the app handler instead of dying at the socket layer.
let waitMs = (params["timeout_ms"] as? Int) ?? 5_000
let responseTimeout = max(10.0, Double(waitMs) / 1000.0 + 5.0)
let payload = try client.sendV2(method: "browser.wait", params: params, responseTimeout: responseTimeout)
output(payload, fallback: "OK")
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,55 @@ public enum ControlCommandExecutionPolicy: Sendable, Equatable {
// v2MainSync). Running on .mainActor would deadlock the UI for the
// entire simulation, defeating the profiling workload.
"debug.sidebar.simulate_drag",
// Browser methods that evaluate page JavaScript (or wait on it) run on
// the socket worker: on the main actor they block SwiftUI updates for
// their full duration, and on a not-yet-mounted webview that is a
// starvation deadlock (the JS can't run until SwiftUI mounts the
// webview, which can't happen while the handler holds the main
// thread). UI/model access inside the handlers stays on main via
// v2MainSync.
"browser.navigate",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Preserve in-process browser cmux actions

Putting browser.navigate and the other browser automation methods in the socket-worker policy makes TerminalController.runV2CommandLine(_:) reject them with invalid_dispatch, because processV2Command only accepts .mainActor methods; CmuxSidebarActionDispatch invokes custom-sidebar cmux(...) actions through that in-process entrypoint on the main actor. Any sidebar button/action that navigates, clicks, waits, or evals in a browser now silently gets an error instead of performing the action, so this path needs a worker-capable in-process dispatch rather than only changing the socket policy.

Useful? React with 👍 / 👎.

"browser.back",
"browser.forward",
"browser.reload",
"browser.snapshot",
"browser.eval",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Update policy tests for browser worker methods

This new worker classification makes ControlCommandExecutionPolicy(forMethod: "browser.eval") return .socketWorker, but the existing ControlCommandExecutionPolicyTests.everythingElseRunsOnTheMainActor still lists browser.eval and asserts .mainActor. Any macOS/CI run of the package tests will fail until the test expectations are updated to match the intended browser JS worker lane.

Useful? React with 👍 / 👎.

"browser.wait",
"browser.click",
"browser.dblclick",
"browser.hover",
"browser.focus",
"browser.type",
"browser.fill",
"browser.press",
"browser.keydown",
"browser.keyup",
"browser.check",
"browser.uncheck",
"browser.select",
"browser.scroll",
"browser.scroll_into_view",
"browser.get.text",
"browser.get.html",
"browser.get.value",
"browser.get.attr",
"browser.get.count",
"browser.get.box",
"browser.get.styles",
"browser.is.visible",
"browser.is.enabled",
"browser.is.checked",
"browser.find.role",
"browser.find.text",
"browser.find.label",
"browser.find.placeholder",
"browser.find.alt",
"browser.find.title",
"browser.find.testid",
"browser.find.first",
"browser.find.last",
"browser.find.nth",
"browser.highlight",
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
]

/// Socket-worker methods that are also safe to invoke from the main
Expand Down
Loading
Loading