Repository navigation
Conversation
Electron's ipcRenderer.invoke keeps only a rejection's message, so desktop waitFor timeouts, invalid selectors, and non-editable targets reached the server as generic "failed on client" errors. The type, scroll, and waitFor IPC methods now resolve those failures as a typed result, and the renderer maps them to the response tags the broker already classifies. Other failures keep today's behavior.
|
Real desktop before/after (macOS dev build, single machine). Same prompt both runs: Before (
After (this PR):
|
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused, backward-compatible fix that preserves existing desktop automation error tags across IPC and improves messages for three already-supported failure cases. Success behavior and unrelated failures remain unchanged, with targeted coverage for the new transport and classification paths. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (2)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughDesktop automation handlers now return typed values for selected failures through IPC. The web layer maps those values to typed host errors for serialization. Other automation errors remain rejected or use the generic error path. ChangesAutomation failure transport
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Low Sequence Diagram(s)sequenceDiagram
participant DesktopIPC
participant PreviewAutomationHosts
participant PreviewAutomationOperationError
participant serializePreviewAutomationError
DesktopIPC->>PreviewAutomationHosts: Return tagged automation failure
PreviewAutomationHosts->>PreviewAutomationOperationError: Throw returned failure
PreviewAutomationOperationError->>serializePreviewAutomationError: Provide classified host error
serializePreviewAutomationError-->>PreviewAutomationHosts: Preserve response tag and details
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable issue was identified in the selected desktop automation failure changes; the PR is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The updated path preserves error categories without adding browser-control privileges. A conditional compatibility risk remains: an older web client could report a returned failure as success when paired with an updated desktop. Supported version combinations have not been established. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation [
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Note Grok responding on behalf of Julius. Thanks for the careful work here, @PixPMusic. I'm closing this as superseded: #15336 was closed as obsolete because, since #15328, preview automation no longer runs in the desktop app. Errors don't cross Electron IPC anymore, and the server host returns the typed errors ( |


Problem
Desktop Browser automation failures with a public tag reach agents as
Preview automation <op> failed on client preview-…. That includeswaitFortimeouts, invalid selectors, and non-editable targets. The desktop main process raises typed errors, butipcMain.handlerejections keep only the message throughipcRenderer.invoke(electron#24427). The renderer then wraps them asPreviewAutomationOperationError, which is reported asPreviewAutomationExecutionError. The broker'sclassifyResponseErroralready handles these three tags, but desktop hosts never sent them.This becomes more visible once #12899 lands. A real desktop's
waitFortimeout will then reach the broker and read "failed on client" instead of "timed out". Today the broker's own deadline hides that.Fixes #15336.
Change
This follows the pattern from #7301 and the direction suggested in #15336's triage. The desktop returns a typed result over IPC instead of rejecting, and the renderer turns it into a host error with the response tag the broker already classifies.
packages/contracts:DesktopPreviewAutomationFailureSchemadefines the three failures, withtimeoutMs,selectorKind, andselectorLength. Thetype,scroll, andwaitForbridge methods now returnDesktopPreviewAutomationFailure | undefined.apps/desktop: those three IPC methods resolve the three Manager error tags as that payload. Success still returnsundefined, and every other failure still rejects.apps/web: the host throws a returned failure, andPreviewAutomationOperationError.fromCausemaps it to a timeout, invalid-selector, or not-editable host error. That mapping replaces the hand-written not-editable shape check, which never matched an Electron rejection. Unknown failures stayPreviewAutomationExecutionError.classifyResponseErroralready reports the caller'stimeoutMs, which is what the desktop waited.Not covered:
I simulated a 3-way merge with #7301's diff. It produces three small conflicts, each resolved by keeping both sides.
Scope and approval
This is a focused bug fix for #15336, which maintainer triage confirmed with this fix shape suggested. It only changes how already-public error tags cross Electron IPC. It adds no new tags, settings, or behavior beyond reporting the error that already occurred.
Verification
mainand pass with the fix:apps/desktop/src/ipc/methods/preview.test.ts, "resolves failures that have a public automation tag instead of rejecting". It also checks that success returnsundefinedand that target-not-found still rejects.previewAutomationRequestConsumer.test.ts, "maps typed failures the desktop resolves over IPC to the public response tags". It covers timeout, invalid selector, and not-editable, and checks that a plain Electron error and a malformed payload stayExecutionError.PreviewAutomationBroker.test.ts, "reports a host waitFor timeout against the caller deadline", pins the agent-visible timeout message. It passes both before and after, because the server is unchanged.vp test runfor the desktop IPC, web preview, broker, and contracts IPC tests: 60 passed. Typecheck passes for contracts, desktop, web, and server. Lint and format are clean for the changed directories.preview_openon a local page, thenpreview_wait_forwith a malformed locator (role=button[name=), thenpreview_typeinto the page'sh1.main@ 8d84666): both calls returnedPreview automation waitFor failed on client preview-…andPreview automation type failed on client preview-….Preview automation waitFor received an invalid locator (17 characters).andPreview automation type requires an editable locator (2 characters).mainthe broker's own deadline still answers first; that's [Bug]: preview_wait_for still evicts a live host when its miss reply lands at the broker deadline #12898 / fix(server): keep preview hosts that report a waitFor miss at the deadline #12899. With a broker reply grace applied, I observed the real desktop's timeout reply arriving as "failed on client" on two Macs (details on fix(server): keep preview hosts that report a waitFor miss at the deadline #12899).Model: Claude Opus 5.5 | Harness: Claude Code in T3 Code