Skip to content

capture: let a deployment decide thinking for Responses requests - #1784

Merged
burtenshaw merged 2 commits into
openenv:mainfrom
younesbelkada:capture/responses-thinking
Dec 1, 2026
Merged

burtenshaw merged 2 commits into
openenv:mainfrom
younesbelkada:capture/responses-thinking

Conversation

@younesbelkada

@younesbelkada younesbelkada commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Responses dialect sets enable_thinking: True for any request that carries a reasoning object, overriding the engine's default. Some agents (Hermes) send one whatever they are configured with, so there was no way to run them in non-thinking mode. Even reasoning: {"enabled": false} turned thinking on. This PR:

  • treats enabled: false like effort: "none";
  • adds OPENENV_CAPTURE_RESPONSES_THINKING=on|off, which decides for every Responses request.

Type of Change

  • Bug fix
  • New feature

What happened without it

Hermes with a hybrid-thinking model served in non-thinking mode (vLLM --default-chat-template-kwargs '{"enable_thinking": false}'): every call came back with thinking, which doubled tokens and wall time per rollout.

Changes

  • openai_responses.py: _reasoning_config_enables_thinking returns False for enabled: false.
  • _thinking_override() reads OPENENV_CAPTURE_RESPONSES_THINKING: on or off set enable_thinking on every Responses request, with or without reasoning. Unset or empty, the request decides, as now.
  • Docs: one paragraph under "Four wire dialects" in docs/source/environments/harbor.md and envs/harbor_env/README.md.

Test Plan

tests/envs/test_capture_responses_thinking.py (11 cases): the request-driven mapping including enabled: false, and the override both ways, with and without reasoning.

PYTHONPATH=src:envs uv run pytest tests/envs/test_capture_responses_thinking.py tests/envs/test_harbor_tasks_and_dialects.py tests/envs/test_harbor_tito_training.py tests/envs/test_harbor_rollout_contract.py tests/envs/test_harbor_upstream_compat.py tests/envs/test_harbor_capture_request_validation.py

177 passed. ruff format --check, ruff check and usort check are clean. This PR and the turn-merge PR (Responses dialect) apply together without conflicts.

Used in production as a runtime patch for Hermes evals and GRPO training.

RFC Status

  • Not required (bug fix, docs, minor refactoring)

🤖 Generated with Claude Code


Note

Medium Risk
Changes how model thinking is enabled for Codex/Responses agents and can alter token counts and sampling behavior in training rollouts if misconfigured.

Overview
Fixes Responses dialect mapping so reasoning with enabled: false (and existing effort: "none") no longer forces enable_thinking on the upstream chat request—agents that always send a reasoning object could previously turn thinking on even when the engine was configured for non-thinking rollouts.

Adds OPENENV_CAPTURE_RESPONSES_THINKING (on / off on the capture proxy) to set chat_template_kwargs.enable_thinking for every Responses request, overriding per-request reasoning when unset behavior is insufficient. Harbor docs note the env var under the wire-dialects section. New tests in test_capture_responses_thinking.py cover default request-driven mapping and the deployment override.

Reviewed by Cursor Bugbot for commit a10fb02. Bugbot is set up for automated code reviews on this repo. Configure here.

The Responses dialect turns enable_thinking on for any request with a
reasoning object. Hermes sends one whatever it is configured with, so a model
run in non-thinking mode thought anyway, doubling tokens and time per rollout.
Even reasoning: {"enabled": false} turned thinking on.

enabled: false now leaves thinking off, like effort: "none".
OPENENV_CAPTURE_RESPONSES_THINKING=on|off sets it for every Responses request;
unset, the request decides as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

The docs for this pull request are available at https://openenv.github.io/OpenEnv/pr-preview/pr-1784/ (commit a10fb02). The preview may take a minute to update and is removed when the pull request closes.

@burtenshaw
burtenshaw merged commit bfc64f2 into openenv:main Dec 1, 2026
18 checks passed
@younesbelkada
younesbelkada deleted the capture/responses-thinking branch December 1, 2026 12:24
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.

2 participants