Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions stagehand/llm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ async def create_response(
if "gpt-5" in completion_model:
filtered_params["temperature"] = 1

# GPT-5.1 and GPT-5.2 don't support "minimal" reasoning_effort.
# Set "low" for these models to avoid OpenAI API errors.
if "gpt-5.1" in completion_model or "gpt-5.2" in completion_model:
filtered_params["reasoning_effort"] = "low"
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 9, 2026

Choose a reason for hiding this comment

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

P1: This unconditionally overrides reasoning_effort for GPT-5.1/5.2, even when the user explicitly passes a valid value (e.g., "high", "medium"). Since the bug is specifically about "minimal" being rejected, only that value should be replaced.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At stagehand/llm/client.py, line 120:

<comment>This unconditionally overrides `reasoning_effort` for GPT-5.1/5.2, even when the user explicitly passes a valid value (e.g., `"high"`, `"medium"`). Since the bug is specifically about `"minimal"` being rejected, only that value should be replaced.</comment>

<file context>
@@ -114,6 +114,11 @@ async def create_response(
+            # GPT-5.1 and GPT-5.2 don't support "minimal" reasoning_effort.
+            # Set "low" for these models to avoid OpenAI API errors.
+            if "gpt-5.1" in completion_model or "gpt-5.2" in completion_model:
+                filtered_params["reasoning_effort"] = "low"
+
         self.logger.debug(
</file context>
Suggested change
filtered_params["reasoning_effort"] = "low"
if filtered_params.get("reasoning_effort") == "minimal":
filtered_params["reasoning_effort"] = "low"
Fix with Cubic

Copy link
Collaborator

Choose a reason for hiding this comment

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

@shrey150 can users pass specific reasoning effort?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, not possible on v3 nor in v2


self.logger.debug(
f"Calling litellm.acompletion with model={completion_model} and params: {filtered_params}",
category="llm",
Expand Down