feat: bridge web provider to agent-browser#826
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
CI finding: Root cause from the failing job log:
The rest of the core CI checks shown for #826 are green; this is the blocker to address next. Please run |
817d991 to
77377d8
Compare
d064823 to
ed957f3
Compare
|
Review findings from delegated pass: [P1] Parse JSON envelopes from non-zero agent-browser exits before mapping process failure. In src/platforms/web/agent-browser-provider.ts:106, runCmd is called without allowFailure, so a real agent-browser --json failure exits 1 and never reaches the { success: false } parser below. I reproduced this with agent-browser 0.27.1: get box @e999 --json --session codex-review-missing prints a JSON {"success":false,...} envelope and exits 1. With the current code, missing-box errors degrade to "agent-browser exited with code 1" and fetchRefRect cannot recognize/ignore normal no-box/not-found responses. Please allow non-zero command results through to the JSON-envelope parser while still preserving TOOL_MISSING/timeouts, then throw the normalized envelope error. [P1] Populate RawSnapshotNode.type for web roles. In src/platforms/web/agent-browser-snapshot.ts:73 and :85, the adapter stores the browser role in node.role, but the shared selector engine and selector-chain builder match role=... against node.type. A normalized button "Save" node currently fails role=button label=Save through resolveSelectorChain. This breaks role-based click/fill/get/wait targeting and replay-healing selector chains for web snapshots. Please set type, or both type and role, from the agent-browser role/type metadata and add a test that resolves a normalized web snapshot through the selector runtime or resolveSelectorChain. |
ed957f3 to
7754b98
Compare
04a7b54 to
b2da269
Compare
|
Addressed the remaining review comments in b2da269:
|
b2da269 to
2139438
Compare
|
Addressed the pasted architecture review in 2139438:
|
2139438 to
40fb0e9
Compare
|
Summary
Bridge the semantic web provider seam to the local agent-browser CLI with session-scoped command execution, JSON envelope/error handling, and snapshot normalization for refs, labels, textbox values, parents, rects, and selector-compatible roles.
User-visible output is intentionally agent-device output, not raw agent-browser output. Direct agent-browser prints aria-tree lines such as
- textbox "Email" [ref=e3]: ada@example.com; agent-device reprojects the same state asSnapshot: 3 nodesand@e2 [text-field] "ada@example.com" [editable]so refs/selectors fit the existing agent-device command model.Add normal web session close cleanup so agent-device close calls agent-browser close even without a positional target.
Closes #820
Touched files: 12. Scope stayed within the web provider adapter, web close cleanup, and web snapshot text presentation.
Validation
Format passed with pnpm format. Typecheck passed with pnpm typecheck. Focused tests passed for src/platforms/web, session-close-shutdown, and output formatting. Fallow passed with pnpm check:fallow --base origin/main. Build passed.
Manual comparison passed on https://vercel.com/: agent-browser returned native aria-tree refs, while agent-device returned normalized
Page: https://vercel.com/,Snapshot: 15 nodes, and agent-device refs for the same visible controls. Manual comparison passed on https://example.com/ with 2 normalized nodes. Manual form fixture verified textbox value projection: agent-browser showed[ref=e3]: ada@example.com; agent-device showed@e2 [text-field] "ada@example.com" [editable]. Sessionscodex-web-vercel-817andcodex-web-example-817were closed.