Skip to content

feat(proxy): add OpenAI Codex OAuth pool upstream - #62297

Open
darkyy92 wants to merge 3 commits into
NousResearch:mainfrom
darkyy92:feat/openai-codex-proxy
Open

darkyy92 wants to merge 3 commits into
NousResearch:mainfrom
darkyy92:feat/openai-codex-proxy

Conversation

@darkyy92

@darkyy92 darkyy92 commented Jul 10, 2026

Copy link
Copy Markdown

Summary

  • add an openai-codex upstream to hermes proxy
  • centralize Codex OAuth refresh and credential-pool selection for isolated local clients
  • rotate safely on 401/429 and fail closed when all credentials are exhausted
  • require owner-only per-client key configuration for the Codex proxy
  • preserve native Responses API/SSE semantics without logging request content

Why

Multi-user Hermes hosts need Linux-user isolation for mail, memory, 1Password, and other per-person secrets. Copying rotating Codex OAuth tokens into every user home is unsafe and operationally fragile. A single ops-owned proxy lets isolated Hermes clients share company-owned subscription accounts while keeping refresh tokens centralized.

Safety

  • client key file must be mode 0600
  • constant-time client token comparison
  • finite retries, exact failed-credential refresh under concurrency
  • arbitrary upstream error messages are not persisted
  • no metered fallback
  • existing Nous/xAI proxy behavior remains backward-compatible

Verification

  • 150 proxy + credential-pool tests passed locally
  • independent review found no remaining blockers
  • real local systemd proxy E2E returned response.completed and exact expected output through OpenAI Codex OAuth
  • two isolated temporary Hermes homes completed named-custom-provider codex_responses calls through the same proxy

@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools provider/openai OpenAI / Codex Responses API P3 Low — cosmetic, nice to have labels Jul 10, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for building this on the existing proxy-adapter and credential-pool surfaces.

Problems

  • hermes_cli/proxy/server.py:354-361 records every request's configured client label, a stable derived fingerprint, model, and status. This is per-client usage attribution, but AGENTS.md:118-121 requires a generic user-facing opt-in before adding attribution logging.
  • The public proxy guide remains inaccurate: website/docs/user-guide/features/subscription-proxy.md:75-77 says only nous and xai are shipped. It also needs the Codex-only key-file requirement and supported-path behavior.

Suggested changes

  • Remove the attribution log. A generic opt-in mechanism would need to exist before this data can be recorded.
  • Update the subscription-proxy documentation for openai-codex, /responses//models, and --client-keys-file mode 0600.

This is an automated hermes-sweeper review.

Comment thread hermes_cli/proxy/server.py Outdated

await resp.write_eof()
fingerprint = hashlib.sha256(client_label.encode()).hexdigest()[:12]
logger.info(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please remove this per-request client-label/fingerprint/model log. AGENTS.md:118-121 prohibits new usage attribution without the generic user-facing opt-in gate; this proxy does not provide that prerequisite.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 11, 2026
- keep authentication failures generic and avoid client/model usage records
- document the OpenAI Codex proxy paths and required owner-only key file
- cover the no-attribution behavior in proxy tests
@darkyy92

Copy link
Copy Markdown
Author

Addressed in ea35e78:

  • Removed the per-request client label/fingerprint/model/status attribution log and the now-unused request-model parsing. Invalid client-key attempts retain only a generic operational warning.
  • Updated the proxy guide to list openai-codex, document /v1/responses and /v1/models, require --client-keys-file, and explain the owner-only 0600 check. Also corrected the LAN and architecture notes for provider-specific auth/path behavior.
  • Updated the proxy behavior test to assert client labels, fingerprints, model names, tokens, and request content are absent from logs.

Verification: 49 passed across tests/hermes_cli/test_proxy.py and tests/hermes_cli/test_proxy_openai_codex.py; Ruff check/format and git diff --check pass.

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

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/openai OpenAI / Codex Responses API 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 sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants