Skip to content

OpenAI chat completions Bedrock custom provider failing to handle <reasoning> tag #167

@tangalade

Description

@tangalade

Issue Type

Agent Issue

Operating System

macOS

Description of the bug

  1. Create custom provider pointing to an OpenAI chat completions endpoint via Bedrock (e.g. https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1/, modelId: openai.gpt-oss-20b-1:0)
  2. Click Test and see that the output includes a <reasoning> tag with content prior to the actual response
  3. Open up the Agent chat panel, select the custom provider, and make any request. It will take a while and eventually output something like
Error: Error: Planning failed: Planning failed: Failed to parse. Text: "<reasoning>We need to produce output in required format: sections numbered 1,2,3,5,6,7,8 (skip</reasoning><reasoning> 4). Must be plain text, not JSON. Provide headings with **. Let's craft. User just said "Hello". No</reasoning><reasoning> action needed. So taskComplete true, proposedActions empty. We need to include latestBrowserState summary. Let's produce.</reasoning>1{ "userTask": "The user greeted with \"Hello\" and has not requested any specific action.", "executionHistory": "No actions have been taken yet; this is the first interaction.", "currentState": "The browser is on a GitHub \"New Issue\" page (URL: https://github.com/browseros-ai/BrowserOS/issues/new?template=01-bug.yml). Visible elements include the issue title input, description textarea, steps to reproduce textarea, and various formatting buttons. No user input beyond the greeting has been provided.", "challengesIdentified": "None – the user has not asked for any task.", "stepByStepReasoning": "Since the user only said \"Hello\" and did not request any operation, the appropriate response is a friendly acknowledgment and an offer to help with anything they need. No browser actions are required at this point.", "proposedActions": [], "taskComplete": true, "finalAnswer": "Hello! 👋 How can I assist you today?" }". Error: SyntaxError: Unexpected token '<', "<reasoning"... is not valid JSON Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE/

I can replicate the same behavior when doing the same call via curl.

It's apparently a Bedrock-specific thing where they will add this to the start of every response according to their documentation.

Steps to Reproduce

  1. Open BrowserOS and create custom provider pointing to an OpenAI chat completions endpoint (e.g. Bedrock, https://bedrock-runtime.us-east-1.amazonaws.com/openai/v1/, modelId: openai.gpt-oss-20b-1:0)
  2. Click Test and see that the output includes a <reasoning> tag with content prior to the actual response
  3. Open up the Agent chat panel, select the custom provider, and make any request.

Screenshots / Videos

Image

BrowserOS Version

137.0.7218.69

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions