Skip to content

fix(custom): normalize responses api mode alias - #33604

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix-33600-custom-responses-alias
Open

fix(custom): normalize responses api mode alias#33604
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix-33600-custom-responses-alias

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • normalize the user-facing responses api_mode alias to codex_responses for custom runtime resolution
  • accept AIAgent(api_mode="responses") and route request dumps / live requests to /responses instead of silently falling back to /chat/completions
  • add regressions for runtime-provider normalization and request-dump URL selection

Testing

  • uv run --frozen pytest -o addopts= tests/hermes_cli/test_runtime_provider_resolution.py -k 'model_config_api_mode or responses_alias_normalized'
  • uv run --frozen pytest -o addopts= tests/run_agent/test_run_agent_codex_responses.py -k 'dump_api_request_debug_uses_responses_url or dump_api_request_debug_normalizes_responses_alias'
  • uv run --frozen ruff check agent/agent_init.py hermes_cli/runtime_provider.py tests/hermes_cli/test_runtime_provider_resolution.py tests/run_agent/test_run_agent_codex_responses.py
  • git diff --check

Fixes #33600

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels May 28, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the focused alias and regression work. Current main has a newer plain-custom routing guard that this patch needs to account for.

Problems

  • Mapping responses to codex_responses in hermes_cli/runtime_provider.py is later cleared for non-direct-OpenAI/xAI plain custom URLs by _resolve_plain_custom_api_mode() (hermes_cli/runtime_provider.py:151-161). The provider=custom return path uses that helper at hermes_cli/runtime_provider.py:1178-1184, so the reported config flow would still resolve to chat_completions.
  • Current coverage deliberately asserts this behavior for a localhost custom relay at tests/hermes_cli/test_runtime_provider_resolution.py:1346-1365, following commit 0e4c879a3.

Suggested changes

  • Please reconcile an explicit Responses opt-in with the newer relay-safety behavior, then add a config-to-runtime regression for the approved behavior. The direct constructor/debug-dump test does not cover that resolver path.

Automated hermes-sweeper review.

normalized = raw.strip().lower()
if normalized == "responses":
normalized = "codex_responses"
if normalized in _VALID_API_MODES:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On current main, this resulting codex_responses value is cleared for non-direct-OpenAI/xAI plain custom URLs by _resolve_plain_custom_api_mode() (hermes_cli/runtime_provider.py:154-161). Please reconcile that newer safety behavior and cover the plain-custom config path; this alias alone will not change its resolved request mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

provider: custom always appends /chat/completions to base_url, ignoring api_mode

3 participants