[codex] Structure preview automation failures#3333
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing recording response tag
- Added a
responseTaggetter returning"PreviewAutomationExecutionError"toPreviewAutomationRecordingNotActiveError, aligning its wire serialization with the pre-existing contract and the pattern used by all other automation error classes.
- Added a
Or push these changes by commenting:
@cursor push e7298b881e
Preview (e7298b881e)
diff --git a/apps/web/src/components/preview/PreviewAutomationOwner.tsx b/apps/web/src/components/preview/PreviewAutomationOwner.tsx
--- a/apps/web/src/components/preview/PreviewAutomationOwner.tsx
+++ b/apps/web/src/components/preview/PreviewAutomationOwner.tsx
@@ -121,6 +121,10 @@
tabId: PreviewTabId,
},
) {
+ get responseTag() {
+ return "PreviewAutomationExecutionError";
+ }
+
override get message(): string {
return `Preview automation request ${this.requestId} found no active recording for tab ${this.tabId} on environment ${this.environmentId} thread ${this.threadId}.`;
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit f74d823. Configure here.
ApprovabilityVerdict: Approved This PR refactors error handling by replacing generic Error objects with structured, typed error classes. The changes are mechanical - same error semantics with richer context metadata - and include appropriate test coverage. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>


Summary
Verification
vp test apps/web/src/components/preview/PreviewAutomationOwner.test.ts apps/web/src/components/preview/previewAutomationRequestConsumer.test.ts(6 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Changes the shape of automation error responses (structured detail) and all failure paths in the preview owner; wire tags are preserved via responseTag but clients parsing errors may need to handle new detail fields.
Overview
Replaces ad-hoc
Errorobjects (with mutatednamefields) in preview automation handling with EffectSchema.TaggedErrorClasstypes that carry request/environment/thread/tab context and map to existing broker_tagvalues viaresponseTag.PreviewAutomationOwnernow throws dedicated errors for overlay timeouts, navigation readiness timeouts, stale thread owners, missing bridge/tab targets, and inactive recordings. Wait helpers takerequestId(and thread context for navigation timeouts); navigation readiness defaults toloadwhen omitted.serializePreviewAutomationErrorprefersresponseTagovererror.name, buildsdetailfrom structuredPreviewAutomation*error fields (excludingcause, stack, etc.), and adds a test asserting causes are not leaked on the wire.Clients still see the same high-level response tags in most cases, but failures can include richer
detailinstead of generic messages only.Reviewed by Cursor Bugbot for commit 2c617f3. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace generic errors with structured tagged error classes in preview automation
PreviewAutomationOverlayTimeoutError,PreviewAutomationNavigationTimeoutError,PreviewAutomationStaleOwnerError,PreviewAutomationTargetUnavailableError,PreviewAutomationRecordingNotActiveError) in PreviewAutomationOwner.tsx, replacing genericErrorinstances with structured, tagged errors carrying contextual fields (requestId, environmentId, threadId, etc.).responseTagthat controls the serialized_tagemitted to consumers, decoupling the internal error type from the protocol-level error code.serializePreviewAutomationErrorin previewAutomationRequestConsumer.ts is extended to derive adetailobject from enumerable error fields (excludingcause,stack, and other reserved keys) and to override_tagwithresponseTagwhen present.detailobject and a different_tagthan before;causeis explicitly excluded from serialized output.Macroscope summarized 2c617f3.