Skip to content

fix: pass through server-v3 operation errors#1937

Merged
monadoid merged 3 commits intomainfrom
act_500_fix
Mar 31, 2026
Merged

fix: pass through server-v3 operation errors#1937
monadoid merged 3 commits intomainfrom
act_500_fix

Conversation

@monadoid
Copy link
Copy Markdown
Contributor

@monadoid monadoid commented Mar 31, 2026

Summary

  • return underlying operation error messages from server-v3 streaming handlers
  • return underlying non-AppError messages from the top-level server-v3 error wrapper
  • preserve existing status code behavior while making local act/extract/observe 500s diagnosable

Testing

  • pnpm --filter @browserbasehq/stagehand-server-v3 typecheck

Summary by cubic

Pass through underlying operation errors in @browserbasehq/stagehand-server-v3 so clients see real failure messages during streaming and top-level responses, and force flow logs on for easier debugging. Status codes stay the same, making local act/extract/observe 500s diagnosable.

  • Bug Fixes
    • Streaming + error wrapper: return the thrown error’s message for non-AppError cases; fall back to a default when not an Error, preserving status codes.
    • Observe route: remove unused Variables import/cast to satisfy lint; no behavior change.

Written for commit ba08fd0. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: ba08fd0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@browserbasehq/stagehand-server-v3 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@monadoid monadoid marked this pull request as ready for review March 31, 2026 20:27
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Client
    participant Wrapper as withErrorHandling
    participant Handler as Operation Handler (act/extract/observe)
    participant Stream as createStreamingResponse

    Note over Client,Handler: Standard Request Flow
    Client->>Wrapper: HTTP Request
    Wrapper->>Handler: Execute operation logic
    
    alt Operation Success
        Handler-->>Wrapper: Result data
        Wrapper-->>Client: 200 OK (Data)
    else Operation Throws Non-AppError
        Handler-->>Wrapper: Throw Error("Specific failure")
        Wrapper->>Wrapper: CHANGED: Extract err.message
        Wrapper-->>Client: 500 Internal Server Error (Message: "Specific failure")
    end

    Note over Client,Stream: Streaming Request Flow
    Client->>Wrapper: HTTP Request (Streaming)
    Wrapper->>Stream: Initialize stream
    Stream->>Handler: Run async operation
    
    alt Operation Fails during Stream
        Handler-->>Stream: Throw Error("Connection timeout")
        Stream->>Stream: CHANGED: Set clientMessage = handlerError.message
        Stream-->>Client: Send event: { "type": "error", "error": "Connection timeout" }
    end
Loading

@monadoid monadoid merged commit 249f5ed into main Mar 31, 2026
7 checks passed
@github-actions github-actions bot mentioned this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants