openwork icon indicating copy to clipboard operation
openwork copied to clipboard

[Bug]: Thinking Level UI completely ignored for Codex models

Open iljaiass opened this issue 9 months ago • 5 comments

Summary

Test Setup

  • OpenWork v0.11.123 on Windows
  • HTTP intercept proxy capturing raw request bodies
  • Model: gpt-5.3-codex

Test Case

  1. Selected Thinking Level = HIGH in OpenWork UI
  2. Sent a prompt

Intercepted HTTP Request

POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium      ← Should be "high"!

Analysis of Multiple Requests

Request # Model reasoning_effort sent
1 gpt-5.3-codex medium
2 gpt-5.3-codex medium
3 gpt-5.3-codex medium
4 gpt-5.3-codex medium (UI was HIGH)

All requests use hardcoded reasoning_effort: "medium" regardless of UI selection.

Root Cause

The OpenCode engine's agent orchestrator generates all substantive requests. It does not propagate the user's variant selection through the agent loop - instead it hardcodes reasoning_effort: "medium".

Request flow:

UI (variant: "high") → OpenCode SDK → Agent Orchestrator → HTTP (reasoning_effort: "medium")
                                              ↑
                                        Bug: hardcoded

Server-side Log Statistics

From upstream API logs:

  • level=medium: 7734 requests (99.7%)
  • level=high: 8 requests
  • level=low: 16 requests

Expected Fix

The agent orchestrator needs to:

  1. Read variant from session context
  2. Map to reasoning_effort for Codex models
  3. Pass through to ALL requests in the agent loop
// Current:
request.ReasoningEffort = "medium"  // hardcoded

// Should be:
request.ReasoningEffort = session.UserVariant

Environment

  • OpenWork: 0.11.123
  • Platform: Windows 10
  • Provider: OpenAI-compatible

Steps to reproduce

Test Setup

  • OpenWork v0.11.123 on Windows
  • HTTP intercept proxy capturing raw request bodies
  • Model: gpt-5.3-codex

Test Case

  1. Selected Thinking Level = HIGH in OpenWork UI
  2. Sent a prompt

Intercepted HTTP Request

POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium      ← Should be "high"!

Analysis of Multiple Requests

Request # Model reasoning_effort sent
1 gpt-5.3-codex medium
2 gpt-5.3-codex medium
3 gpt-5.3-codex medium
4 gpt-5.3-codex medium (UI was HIGH)

All requests use hardcoded reasoning_effort: "medium" regardless of UI selection.

Root Cause

The OpenCode engine's agent orchestrator generates all substantive requests. It does not propagate the user's variant selection through the agent loop - instead it hardcodes reasoning_effort: "medium".

Request flow:

UI (variant: "high") → OpenCode SDK → Agent Orchestrator → HTTP (reasoning_effort: "medium")
                                              ↑
                                        Bug: hardcoded

Server-side Log Statistics

From upstream API logs:

  • level=medium: 7734 requests (99.7%)
  • level=high: 8 requests
  • level=low: 16 requests

Expected Fix

The agent orchestrator needs to:

  1. Read variant from session context
  2. Map to reasoning_effort for Codex models
  3. Pass through to ALL requests in the agent loop
// Current:
request.ReasoningEffort = "medium"  // hardcoded

// Should be:
request.ReasoningEffort = session.UserVariant

Environment

  • OpenWork: 0.11.123
  • Platform: Windows 10
  • Provider: OpenAI-compatible

Expected behavior

Test Setup

  • OpenWork v0.11.123 on Windows
  • HTTP intercept proxy capturing raw request bodies
  • Model: gpt-5.3-codex

Test Case

  1. Selected Thinking Level = HIGH in OpenWork UI
  2. Sent a prompt

Intercepted HTTP Request

POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium      ← Should be "high"!

Analysis of Multiple Requests

Request # Model reasoning_effort sent
1 gpt-5.3-codex medium
2 gpt-5.3-codex medium
3 gpt-5.3-codex medium
4 gpt-5.3-codex medium (UI was HIGH)

All requests use hardcoded reasoning_effort: "medium" regardless of UI selection.

Root Cause

The OpenCode engine's agent orchestrator generates all substantive requests. It does not propagate the user's variant selection through the agent loop - instead it hardcodes reasoning_effort: "medium".

Request flow:

UI (variant: "high") → OpenCode SDK → Agent Orchestrator → HTTP (reasoning_effort: "medium")
                                              ↑
                                        Bug: hardcoded

Server-side Log Statistics

From upstream API logs:

  • level=medium: 7734 requests (99.7%)
  • level=high: 8 requests
  • level=low: 16 requests

Expected Fix

The agent orchestrator needs to:

  1. Read variant from session context
  2. Map to reasoning_effort for Codex models
  3. Pass through to ALL requests in the agent loop
// Current:
request.ReasoningEffort = "medium"  // hardcoded

// Should be:
request.ReasoningEffort = session.UserVariant

Environment

  • OpenWork: 0.11.123
  • Platform: Windows 10
  • Provider: OpenAI-compatible

Actual behavior

Test Setup

  • OpenWork v0.11.123 on Windows
  • HTTP intercept proxy capturing raw request bodies
  • Model: gpt-5.3-codex

Test Case

  1. Selected Thinking Level = HIGH in OpenWork UI
  2. Sent a prompt

Intercepted HTTP Request

POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium      ← Should be "high"!

Analysis of Multiple Requests

Request # Model reasoning_effort sent
1 gpt-5.3-codex medium
2 gpt-5.3-codex medium
3 gpt-5.3-codex medium
4 gpt-5.3-codex medium (UI was HIGH)

All requests use hardcoded reasoning_effort: "medium" regardless of UI selection.

Root Cause

The OpenCode engine's agent orchestrator generates all substantive requests. It does not propagate the user's variant selection through the agent loop - instead it hardcodes reasoning_effort: "medium".

Request flow:

UI (variant: "high") → OpenCode SDK → Agent Orchestrator → HTTP (reasoning_effort: "medium")
                                              ↑
                                        Bug: hardcoded

Server-side Log Statistics

From upstream API logs:

  • level=medium: 7734 requests (99.7%)
  • level=high: 8 requests
  • level=low: 16 requests

Expected Fix

The agent orchestrator needs to:

  1. Read variant from session context
  2. Map to reasoning_effort for Codex models
  3. Pass through to ALL requests in the agent loop
// Current:
request.ReasoningEffort = "medium"  // hardcoded

// Should be:
request.ReasoningEffort = session.UserVariant

Environment

  • OpenWork: 0.11.123
  • Platform: Windows 10
  • Provider: OpenAI-compatible

iljaiass avatar Feb 27 '26 09:02 iljaiass

@iljaiass thx for reporting i tried to fix that yesterday, i'll try to make sure this is solved today!

benjaminshafii avatar Feb 27 '26 15:02 benjaminshafii

couldn't reproduce on 0.11.126.

just a few sanity checks could you verify you're in this state (it's in the debug pannel):

Image

benjaminshafii avatar Feb 27 '26 16:02 benjaminshafii

windows Image

ubuntu Image

iljaiass avatar Feb 27 '26 20:02 iljaiass

Bug Report: OpenWork ignores UI Thinking Level selection for codex models

Date: 2026-02-25 OpenWork version: 0.11.121 OpenCode version: 1.1.60-openwork.1 CliProxyAPI++ version: v6.8.27-0-plus Tested on: Ubuntu Desktop 24.04.4 LTS (amd64) Model tested: gpt-5.3-codex (OAuth through CliProxyAPI++)


Summary

When using codex models (gpt-5.3-codex) through CliProxyAPI++, OpenWork always sends reasoning_effort: "medium" regardless of the Thinking Level selected in the UI (Low, Medium, High, X-High). The UI selection is ignored.

Additionally, there is a split behavior: the first request in a new session uses variant field (legacy path), while all subsequent requests use reasoning_effort field but always hardcoded to "medium".


Raw HTTP evidence (intercepted requests)

An HTTP intercept proxy was placed between OpenWork and CliProxyAPI++ on port 8318 to capture raw request bodies. The user changed Thinking Level in the UI between each request.

Request 1 — First prompt in fresh session (variant path)

[2026-02-25 21:18:49] POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           high
  reasoning_effort:  <NOT SET>
  reasoning:         <NOT SET>
  ALL top-level keys: [model, variant, messages, stream]

Note: Uses variant field (not reasoning_effort). No max_tokens, no tools, no reasoningSummary. This appears to be the initial/lightweight request path.

Request 2 — Small model request (gpt-5.2, non-codex)

[2026-02-25 21:21:43] POST /v1/chat/completions
  model:             gpt-5.2
  variant:           <NOT SET>
  reasoning_effort:  <NOT SET>
  ALL top-level keys: [model, max_tokens, messages, stream, stream_options]

Note: Non-codex model, no variant/reasoning at all. Expected behavior.

Request 3 — UI set to Low, but sent medium

[2026-02-25 21:21:45] POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium
  ALL top-level keys: [model, max_tokens, reasoningSummary, reasoning_effort, messages, tools, tool_choice, stream, stream_options]

Request 4 — UI set to High, but sent medium

[2026-02-25 21:21:59] POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium
  ALL top-level keys: [model, max_tokens, reasoningSummary, reasoning_effort, messages, tools, tool_choice, stream, stream_options]

Request 5 — UI set to X-High, but sent medium

[2026-02-25 21:22:13] POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium
  ALL top-level keys: [model, max_tokens, reasoningSummary, reasoning_effort, messages, tools, tool_choice, stream, stream_options]

Request 6 — UI set to Medium, sent medium (coincidence)

[2026-02-25 21:22:26] POST /v1/chat/completions
  model:             gpt-5.3-codex
  variant:           <NOT SET>
  reasoning_effort:  medium
  ALL top-level keys: [model, max_tokens, reasoningSummary, reasoning_effort, messages, tools, tool_choice, stream, stream_options]

Two distinct bugs identified

Bug 1: reasoning_effort is always "medium"

For codex models in established sessions, OpenWork sends reasoning_effort (correct field name for OpenAI/Codex API), but the value is always "medium" regardless of the UI selection. The user-selected Thinking Level (Low/High/X-High) is never reflected in the actual HTTP request.

Evidence: Requests 3-6 above. User explicitly changed UI to Low, High, X-High, Medium between requests. All sent reasoning_effort: "medium".

Bug 2: First request uses variant instead of reasoning_effort

The very first request in a new session (Request 1) sends variant: "high" instead of reasoning_effort: "high". This is the legacy Claude-style field name. Subsequent requests switch to the correct reasoning_effort field but with the hardcoded "medium" value.

This suggests two different code paths:

  • Initial prompt path (via SDK promptAsync): sends variant from UI signal correctly
  • Subsequent/agent prompt path (via internal orchestration): sends reasoning_effort but hardcoded to "medium"

Source code analysis

Where the UI value is stored

  • File: packages/app/src/app/app.tsx, line 2194
    const [modelVariant, setModelVariant] = createSignal<string | null>(null);
    
  • Persisted to localStorage under key "openwork.modelVariant"
  • File: packages/app/src/app/constants.ts, line 6

Where variant is sent (first request)

  • File: packages/app/src/app/app.tsx, line 1450
    variant: modelVariant() ?? undefined,
    
  • This correctly reads the UI value and sends it as variant

Where reasoning_effort is sent (subsequent requests)

  • This is the bug location. The OpenCode engine (Go server) translates variant to reasoning_effort for OpenAI-compatible providers, but appears to:
    1. Only use the variant for the initial request
    2. Default to "medium" for all subsequent requests generated by the agent orchestrator
    3. Not propagate the user variant selection through the agent loop

Key observation: different request shapes

Aspect First request Subsequent requests
Field variant reasoning_effort
Value Reflects UI selection Always "medium"
max_tokens absent present
tools absent present
tool_choice absent present
reasoningSummary absent present
stream_options absent present

The first request is a "bare" SDK call from the UI. Subsequent requests are agent-generated (by the OpenWork agent orchestrator), which adds tools, max_tokens, reasoningSummary etc. The agent orchestrator does not carry forward the user variant selection.


CliProxyAPI++ behavior (correct)

CliProxyAPI++ v6.8.27-0-plus correctly processes both variant and reasoning_effort:

thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
thinking: processed config to apply    | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium

When tested with curl manually:

  • reasoning_effort: "high" -> correctly applied as level=high
  • reasoning_effort: "low" -> correctly applied as level=low
  • variant: "high" -> correctly applied as level=high

The proxy is not the issue. It faithfully passes through whatever it receives.


Confirmed on both systems

System OpenWork OpenCode CliProxy Same bug?
Windows 10 + VPS (46.17.99.22) 0.11.121 1.1.60-openwork.1 v6.8.27-0-plus YES - always medium
Ubuntu 24.04 Desktop 0.11.121 1.1.60-openwork.1 v6.8.27-0-plus (Docker) YES - always medium

Expected behavior

When user selects Thinking Level = "High" in the UI and model is gpt-5.3-codex:

{
  "model": "gpt-5.3-codex",
  "reasoning_effort": "high",
  ...
}

Actual behavior

Regardless of UI selection:

{
  "model": "gpt-5.3-codex",
  "reasoning_effort": "medium",
  ...
}

Suggested fix location

The bug is in the OpenCode engine agent orchestrator (Go server-side code). When the agent loop constructs subsequent LLM calls after the initial user prompt, it needs to:

  1. Read the variant value from the session/prompt context
  2. Map it to reasoning_effort for OpenAI-compatible providers (codex models)
  3. Pass it through to every request in the agent loop, not just the first one

The mapping should be:

  • "none" -> omit field or "none"
  • "low" -> "low"
  • "medium" -> "medium"
  • "high" -> "high"
  • "xhigh" -> "high" (or upstream-specific max value)

Appendix: Windows PC evidence (indirect)

Direct HTTP interception on Windows was not performed to avoid losing active OpenWork sessions (OpenWork does not persist sessions on restart). However, CliProxy logs on the VPS (46.17.99.22) serving the Windows PC show the same behavior:

[2026-02-25 21:11:59] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:12:13] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:12:26] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:13:05] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:17:49] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:18:12] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:18:29] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:18:55] thinking: original config from request | provider=codex model=gpt-5.3-codex mode=level budget=0 level=medium
[2026-02-25 21:20:53] thinking: original config from request | provider=codex model=gpt-5.2 mode=level budget=0 level=medium

All 9 requests from the Windows PC also show level=medium, confirming the same bug across both systems.

Systems confirmed:

  • Windows 10 + OpenWork 0.11.121 + CliProxy v6.8.27-0-plus on VPS
  • Ubuntu 24.04 + OpenWork 0.11.121 + CliProxy v6.8.27-0-plus in Docker

iljaiass avatar Feb 27 '26 20:02 iljaiass

And something has to be done about it, it's impossible to work, windows freezes all the time, but for some reason ubuntu doesn't have that. https://github.com/different-ai/openwork/issues/644

iljaiass avatar Feb 27 '26 20:02 iljaiass