Repository navigation
fix(browser): return every step of an exec batch instead of "Unknown browser error" - #36246
Conversation
|
No actionable comments were generated in the recent review.
|
330162c to
085da92
Compare
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
caee9806-fe03-4d47-984c-45bcdfad0b5f
Files selected for processing: 4-
src/main/browser/agent-browser-batch-command.tssrc/main/browser/agent-browser-bridge-command-transport.test.tssrc/main/browser/agent-browser-bridge-raw-process.tssrc/main/browser/agent-browser-bridge-test-harness.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
085da92 to
54ce9ed
Compare
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
50f4a249-3765-4801-9cd1-dbb34900f00c
Files selected for processing: 6-
src/main/browser/agent-browser-batch-command.tssrc/main/browser/agent-browser-bridge-command-transport.test.tssrc/main/browser/agent-browser-bridge-execution.tssrc/main/browser/agent-browser-bridge-raw-process.tssrc/main/browser/agent-browser-bridge-result.tssrc/main/orcad/external-chromium-browser-session.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
-
54ce9ed to
3447108
Compare
ELI5
Agents can send several browser steps in one call with
orca exec --command 'batch "…" "…"'. That always failed with "Unknown browser error", even when every step worked. A barebatchhung for a minute. Now you get every step's result back, and a barebatchfails straight away with agent-browser's own message.What Changed
parseAgentBrowserJsonOutputnow reads a reply with several entries as one successful result: the list of steps, each withcommand,success,resultanderror, and the daemonlifecyclebookkeeping removed from each result. Before, it handed the array back as if it were a single-command envelope, sotranslateResultread.successoff an array and reported "Unknown browser error". Orca's own one-command batches (sent on stdin) still unwrap to the single result; a batch the caller sent throughexecalways returns its step list, even when--bailstopped it at the first step.runAgentBrowserRawnow resolves a reply that parses as a success even on a non-zero exit, so the failed step comes back in the list instead of as a raw "Command failed: …agent-browser… batch --bail …".runAgentBrowserRawalways ends the helper's stdin. Commands passed as argv used to leave it open, so a barebatch(which reads JSON from stdin) waited until the CLI gave up after 60 s.Before, against a dev build of main:
After:
Why
The parser is the one place both the desktop bridge and the orcad external-Chromium session read agent-browser output, so fixing it there covers both. The external-Chromium session already ended stdin (
run-process.ts), so ending it in the desktop bridge makes the two match. A batch's overall exit code says nothing the per-step results don't already say, so returning the steps beats turning the whole call into an error.Linked Issue
No issue. This came out of the browser-use research re-run on agent-browser 0.39.4 (
batchwas listed as broken throughexec).Visual Proof
N/A: CLI output only, no UI change. Before/after terminal output is shown above.
Testing
Reproduced all three failures on a hidden dev build of main, then re-ran them on this branch (output above). macOS.
Three regression tests in
agent-browser-bridge-command-transport.test.ts, both built from real agent-browser 0.39.4 replies: a two-step batch that exits 1 because one step failed, a--bailbatch stopped at its first step, and a barebatchwhose stdin must be closed. Each fails without the fix.Ran every test file that depends on the changed modules (14 files, 176 tests).
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Codex and a Claude reviewer each did one round; neither found a P0, P1 or P2. I took one P3: the bare-batch test now fakes agent-browser's real empty-stdin reply. CodeRabbit's Major (a
--bailbatch stopped at step one came back as an error) held and is fixed: the parser tells Orca's own batches fromexecones by how the command was sent.Agent skill upstream boundary
Notes
exec batch, which used to fail every time, so no caller depended on the old shape.exec 'batch "get title"'now returns a one-item list too, so everyexec batchreply has the same shape.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)