Skip to content

fix(agent): raw_codex client uses runtime-resolved base_url#5988

Open
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:review/codex-raw-client-ready
Open

fix(agent): raw_codex client uses runtime-resolved base_url#5988
Tranquil-Flow wants to merge 1 commit into
NousResearch:mainfrom
Tranquil-Flow:review/codex-raw-client-ready

Conversation

@Tranquil-Flow

@Tranquil-Flow Tranquil-Flow commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

resolve_provider_client() was hardcoding _CODEX_AUX_BASE_URL for the raw_codex=True path, ignoring any custom base URL set via HERMES_CODEX_BASE_URL or a Codex-compatible proxy. This change calls resolve_codex_runtime_credentials() (the same resolver used by the non-raw path) so custom proxies and load balancers work correctly.

Related Issue

Fixes #5875

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • agent/auxiliary_client.py — targeted fix in resolve_provider_client() so the raw_codex=True path uses resolve_codex_runtime_credentials() instead of the hardcoded base URL constant
  • tests/agent/test_auxiliary_client.py — regression test covering runtime-resolved base_url for the raw Codex client

How to Test

  1. pytest tests/agent/test_auxiliary_client.py — passes
  2. With HERMES_CODEX_BASE_URL set to a proxy URL, confirm raw_codex=True sessions hit the custom endpoint correctly

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15 (Darwin 24.6.0)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

$ pytest tests/agent/test_auxiliary_client.py

@blasai1739217-cmyk

Copy link
Copy Markdown

Friendly bump on this PR in case it fell through the cracks \u2014 would love a review when someone has a minute. Thanks!

Zijie-Tian added a commit to Zijie-Tian/hermes-agent that referenced this pull request Apr 18, 2026
The main OpenAI client path was injecting a custom httpx transport that
bypassed proxy-aware defaults, while the raw Codex path ignored
runtime-resolved base URLs and openai-codex callers could still pin
chat_completions. This packages the minimal local fixes and regression
tests needed to make Hermes reliably use Codex gpt-5.4 behind the
user's configured proxy.

Constraint: Must preserve unrelated local edits in the repo
Constraint: Must keep Hermes on the Codex Responses path for openai-codex
Rejected: Commit workspace-level ~/.hermes/.env changes | outside repo scope
Rejected: Wait for upstream PR merges | user needs a working fork branch now
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: If upstream merges NousResearch#11733/NousResearch#10044/NousResearch#5988, rebase this branch against their final versions before reusing it
Tested: pytest tests/run_agent/test_create_openai_client_reuse.py -q
Tested: pytest tests/run_agent/test_run_agent_codex_responses.py -q
Tested: pytest tests/agent/test_auxiliary_client.py -q
Tested: hermes chat --provider openai-codex -m gpt-5.4 -Q --max-turns 1 -q "Reply with exactly OK."
Tested: hermes chat -Q --max-turns 1 -q "Reply with exactly OK."
Not-tested: gateway / IM platform flows
Related: NousResearch#11609
Related: NousResearch#11733
Related: NousResearch#10044
Related: NousResearch#5988
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels Apr 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #15855 — both fix #5875 (raw_codex base_url resolution). Same root cause in resolve_provider_client().

@Tranquil-Flow Tranquil-Flow force-pushed the review/codex-raw-client-ready branch 2 times, most recently from 6074d57 to 907d96a Compare May 25, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: openai-codex main agent path ignores resolved custom base_url when raw_codex=true

3 participants