feat(openai): support Responses text verbosity - #29574
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused config-to-transport implementation; current main still rejects top-level text, so the feature request remains valid.
Problems
agent/transports/codex.py:152sets configuredtext.verbositybeforerequest_overridesis merged. The existingkwargs.update(request_overrides)immediately afterward replaces the entiretextobject, dropping verbosity when an override suppliestext.formator anothertextfield. Merge the dictionaries after applying overrides instead.agent/transports/codex.py:147excludes only GitHub and xAI. Current named custom-provider resolution can selectcodex_responses(hermes_cli/runtime_provider.py:695-697), so this does not establish that the route accepts OpenAI'stextfield. The issue specifically asks not to send it to unsupported providers.
Suggested changes
- Merge configured verbosity into an existing
request_overrides.textdict and test preservation oftext.format. - Gate injection on an explicit supported OpenAI GPT/Responses capability, with a custom non-OpenAI Responses regression test.
Automated hermes-sweeper review.
|
|
||
| verbosity = parse_text_verbosity(text_verbosity) | ||
| if verbosity: | ||
| kwargs["text"] = {"verbosity": verbosity} |
There was a problem hiding this comment.
request_overrides is merged immediately after this block, so an override containing text replaces this entire dict and silently drops configured verbosity. Apply overrides first, then copy/merge the existing text dict so fields such as text.format survive alongside text.verbosity.
| @@ -142,6 +143,14 @@ def build_kwargs( | |||
| elif not is_github_responses and not is_xai_responses: | |||
| kwargs["include"] = [] | |||
|
|
|||
| text_verbosity = params.get("text_verbosity") | |||
| if text_verbosity and not is_github_responses and not is_xai_responses: | |||
There was a problem hiding this comment.
This is an exclusion check rather than a capability check. Named custom providers can opt into codex_responses on current main (hermes_cli/runtime_provider.py:695-697), so non-xAI/non-GitHub routes can still receive this OpenAI-only field. Please gate on a known supported OpenAI GPT/Responses route or capability.
5d92a18 to
44d3b1b
Compare
|
Updated the PR on current
The regression coverage includes the nested merge, explicit override precedence, the endpoint/model matrix, and an |
44d3b1b to
f0be1ca
Compare
f0be1ca to
6ef18da
Compare
6ef18da to
0dda89f
Compare
0dda89f to
72113bf
Compare
Expose agent.text_verbosity for GPT-5 Responses targets while preserving provider defaults elsewhere. Resolve support at the request boundary so Codex OAuth and the exact api.openai.com host opt in, while custom, xAI, and GitHub targets fail closed. Merge configured verbosity into request_overrides.text without replacing text.format or an explicit verbosity override. Validate the adapter payload and invalidate gateway cached agents when the config changes. Context: - Addresses the nested-merge and provider-capability review on PR NousResearch#29574. - Keeps provider support narrow instead of adding a generic capability framework or proxy opt-in. - The local runtime patch remains necessary until an upstream target includes the eventual merge.
72113bf to
60920fc
Compare
Temporary local compatibility patch for OpenAI Responses text.verbosity. Upstream tracking: - Issue: NousResearch#20203 - Preferred candidate: NousResearch#63543 - Competing candidate: NousResearch#29574 Remove this commit after upstream merges a first-class agent output/text verbosity setting, then replace HERMES_OPENAI_VERBOSITY=low with the merged YAML config key.
Expose agent.text_verbosity for GPT-5 Responses targets while preserving provider defaults elsewhere. Resolve support at the request boundary so Codex OAuth and the exact api.openai.com host opt in, while custom, xAI, and GitHub targets fail closed. Merge configured verbosity into request_overrides.text without replacing text.format or an explicit verbosity override. Validate the adapter payload and invalidate gateway cached agents when the config changes. Context: - Addresses the nested-merge and provider-capability review on PR NousResearch#29574. - Keeps provider support narrow instead of adding a generic capability framework or proxy opt-in. - The local runtime patch remains necessary until an upstream target includes the eventual merge.
Expose agent.text_verbosity for GPT-5 Responses targets while preserving provider defaults elsewhere. Resolve support at the request boundary so Codex OAuth and the exact api.openai.com host opt in, while custom, xAI, and GitHub targets fail closed. Merge configured verbosity into request_overrides.text without replacing text.format or an explicit verbosity override. Validate the adapter payload and invalidate gateway cached agents when the config changes. Context: - Addresses the nested-merge and provider-capability review on PR NousResearch#29574. - Keeps provider support narrow instead of adding a generic capability framework or proxy opt-in. - The local runtime patch remains necessary until an upstream target includes the eventual merge.
…th control Closes NousResearch#20203. Based on NousResearch#29574's init_agent() loading approach, with added GPT-5+ model guard (vendor prefix handling) and safe dict merge (preserves text.format from request_overrides). Add agent.text_verbosity config key that injects text.verbosity into OpenAI Responses API payloads for GPT-5+ models. Valid values: low, medium, high, or empty string (default, no injection). - Config loaded inside init_agent() from _agent_section - Gateway hot-reload via cache-bust tuple - GPT-5+ model guard with vendor prefix stripping - Safe merge into existing text dict (preserves text.format) - Preflight whitelist + pass-through in codex_responses_adapter - 22 tests (19 transport + 3 preflight adapter)
Summary
agent.text_verbosityconfig parsing for OpenAI Responses output verbositytext.verbosityonly for GPT-5 models on Codex OAuth or the exactapi.openai.comhost; xAI, GitHub Models, and arbitrary custom endpoints fail closedrequest_overrides.textwithout droppingtext.formator replacing an explicit verbosity overridetextin the Responses preflight, document the option, and invalidate cached gateway agents when it changesContext
Closes #20203.
#20258 also proposes this feature. This PR keeps the implementation at the existing agent-to-Responses transport boundary and does not add a generic capability framework or custom-proxy opt-in.
Tests
scripts/run_tests.sh tests/agent/transports/test_codex_transport.py tests/run_agent/test_run_agent.py tests/gateway/test_agent_cache.py(581 passed)ruff checkon all changed Python filespython -m compileallon all changed Python filesgit diff --check