Skip to content

feat: route native Codex sub-agents to Claude with subscription parity - #49

Merged
dean0x merged 6 commits into
mainfrom
feat/bidirectional-parity
Sep 9, 2026
Merged

feat: route native Codex sub-agents to Claude with subscription parity#49
dean0x merged 6 commits into
mainfrom
feat/bidirectional-parity

Conversation

@dean0x

@dean0x dean0x commented Sep 7, 2026

Copy link
Copy Markdown
Owner

What

Native Codex sub-agents can select Claude models while their OpenAI parent continues on OpenAI. The opt-in gateway routes Sonnet, Opus, Fable, and configured Claude aliases through the existing Claude subscription, preserving native agent orchestration, tool execution, and permissions.

  • Adds HTTP/WebSocket routing, streaming and buffered translation, native model discovery, authenticated process-local thinking replay, prompt caching, subscription refresh, and init/doctor/models --client codex|all.
  • Shares typed route decisions and raw HTTP transport across ingress paths. Async decompression keeps streams responsive; snapshots, replay, and adaptation markers share a strict cache budget; upgraded connections retain a capacity slot until they close.
  • Restricts operator Codex credential substitution to exact native endpoints with matching account IDs. Claude requests carry independently tested subscription identity fields. Synthesized JSON/SSE/WebSocket errors share render-time redaction and explicit status classification.
  • Preserves native cancellation history so the same conversation can continue, and reports missing Claude credentials without triggering an unrelated OpenAI login refresh.
  • Uses --client all for all supported clients, retaining both as a compatibility alias. Returns structured setup failures, requires explicit trust for custom upstreams, and reports merged configuration sources. Documents all ingress keys, route labels, and model JSON shapes. Supported Node versions are ^22.15.0 || >=24, with CI coverage configured for the Node 22 floor and Node 24.

Existing Claude Code → Codex routing remains available and default setup still targets Claude Code. Native binaries and feature settings are not patched. Collaboration namespace adaptation applies across reverse-enabled Codex sessions, including their OpenAI turns; existing opaque histories remain untouched. Translation failures do not switch models or billing modes.

Why

The existing bridge supported only Claude Code → Codex. This adds native delegation in the reverse direction while keeping credential boundaries, transport behavior, continuation limits, and configuration provenance explicit. User-level configuration supports normal native Codex launches; project configuration overrides it, and explicit configuration bypasses the merge.

Validation

  • npm run typecheck and all 852 tests pass.
  • npm run build and installed-tarball smoke pass, including both-client setup, reverse model listing, and forward/reverse-enabled health checks.
  • Eight mutation experiments all fail their regression controls when subscription identity, refresh, credential isolation/path scope, upstream failure handling, upload bounds, or WebSocket bounds are removed. All mutations were restored.
  • New local tests cover credential-file permissions and atomic replacement, keychain stdin/injection/read-back behavior, request and stream-idle timeouts, malformed history, cache bounds, configuration provenance, doctor failures, and both WebSocket routing modes.
  • Live acceptance on Node 22.22.3, Codex CLI 0.153.4, and Claude Code 2.1.266 passed Sonnet/Opus/Fable delegation, WebSocket and HTTP follow-ups, native file edits/commands, and mixed Sonnet/GPT-5.5 children while the forward bridge ran concurrently through the same proxy.
  • Native cancellation/recovery, missing-credential and controlled-429 recovery, interactive setup/idempotence/config precedence, and restart-to-fresh-conversation behavior were exercised. One injected 401 triggered exactly one genuine Claude refresh, followed by a successful tool round trip and verified native credential persistence.
  • Detailed results, fixes, and test boundaries: native usability acceptance.

Durable restart/compaction, setup undo, explicit API authentication for translated inference, and broader content/tool support remain outside this parity change.

Related issues

Shared follow-ups: #45, #46, #47, #48. These remain open.

Checklist

  • npm run typecheck passes
  • npm test passes
  • Tests added or updated for behavior changes
  • Native live acceptance and installed-package smoke verified; test scope noted above
  • Docs updated for user-facing behavior

@dean0x

dean0x commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

Code Review — Cycle 1

Full summary withheld (public repository).

Category CRITICAL HIGH MEDIUM LOW Total
Blocking 4 29 27 0 60
Should Fix 0 0 15 1 16
Pre-existing - - 3 1 4

Full report: /Users/dean/Sandbox/croxy/.devflow/docs/reviews/feat-bidirectional-parity/2026-09-08_2113/review-summary.md (not committed; ask the author)
Posted by devflow · cycle 1

@dean0x
dean0x merged commit 1562da3 into main Sep 9, 2026
4 checks passed
@dean0x
dean0x deleted the feat/bidirectional-parity branch September 9, 2026 19:18
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.

1 participant