Skip to content

Add generic OpenAI-compatible DeepSeek V4 routing - #106

Merged
erinepshovel-code merged 48 commits into
mainfrom
repair/openai-compatible-deepseek
Sep 10, 2026
Merged

erinepshovel-code merged 48 commits into
mainfrom
repair/openai-compatible-deepseek

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Collaborator

Summary

  • replace the standalone empty OpenAI stub and production OpenAI-only transport with a registry-driven openai-compatible adapter
  • configure DeepSeek V4 Flash and Pro as data: base_url, api_key_env, model alias, Responses/Chat family, reasoning map, tool profile, and pricing
  • route the documented Termux a0/ runtime and FastAPI provider dispatcher through the shared registry; explicit A0_PROVIDER choices fail closed
  • migrate provider metadata from env_key to api_key_env, fix primary-model attribution before preset lookup, and make optional DB memory lookup genuinely non-blocking
  • wire Cloud Run's DEEPSEEK_API_KEY secret and add a provider-contract CI gate
  • remove the obsolete empty a0/adapters/openai_adapter.py; no DeepSeek-specific adapter or retired model identifier is introduced

DeepSeek transport/model facts were checked against the current official docs:

File plan

Path Change Purpose Risk Required tests
python/services/providers/*, python/services/inference.py modified/created generic async Responses + Chat transport and dispatch provider routing/tool loop provider contracts + regression suite
a0/provider_registry.py, a0/adapters/*, a0/router.py modified/created/deleted generic standalone/Termux provider selection startup selection and fail-closed config standalone adapter + package tests
python/config/providers.json, python/config/pricing.json modified DeepSeek V4 registry entries and credential schema migration catalog/pricing attribution registry, resolver, pricing tests
.github/workflows/deploy.yml, cloudbuild.yaml, DEPLOYMENT.md modified CI gate and Secret Manager injection deploy requires a0p-deepseek-api-key YAML parse + provider CI command
tests/*openai_compatible*, python/tests/test_openai_compatible_contracts.py created executable regression and msdmd evidence test harness pytest + contract witness
README.md, CLAUDE.md, docs/ARCHITECTURE.md, suggest.md modified operator and architecture documentation documentation drift command/config review
a0_msdmd.ts, ratio seals, package sources, .gitignore regenerated/modified repository metadata and local usage-state hygiene generated drift generator + diff check

Verification

  • 77 passed — focused provider, standalone, package, and msdmd witness suite
  • 181 passed — all non-database tests (live-server and real-Postgres artifact tests excluded)
  • npm run check
  • production build passed via node --import tsx script/build.ts; the npm run build wrapper was blocked before project execution by the runner's local IPC policy
  • JSON/YAML parsing, Python compileall, ratio regeneration, msdmd regeneration, diff check, and credential-shape scan passed
  • contract witness check_openai_compatible_registry_wiring passed; the repository-wide contract runner still has pre-existing environment/fixture errors outside this change

hmmm

  • The actual VM skill-lib/ai-launcher is not present in this repository or canonical skill-lib; after merge, its deployment environment still needs this branch/release plus DEEPSEEK_API_KEY.
  • The unreferenced duplicate a0python/ package was not given a third registry copy. The documented active Termux path is root run.sh -> a0/; decide separately whether to retire or independently package a0python/.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T01:20:45.015919Z c64ce3d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread python/services/providers/openai_provider.py Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5fa2102af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/providers/open_comp_prov_v0.0.0alpha.py
Comment thread python/services/inference.py Outdated
Comment thread python/services/providers/openai_compatible_provider.py Outdated
Comment thread python/config/providers.json

Copy link
Copy Markdown
Collaborator Author

@codex address that feedback

Repair only the live exact-head findings on f5fa210: (1) P1 first tool call falsely detected as repeat; preserve repeat detection and add regression coverage. (2) Honor registry model environment overrides on the generic openai-compatible dispatcher path. (3) Redact the configured credential before any provider-error truncation so partial opaque keys cannot leak. (4) Do not surface DeepSeek Pro through the unrestricted DeepSeek catalog/presets; retain the separate ws-gated deepseek-pro provider. (5) Remove the unused _call_responses import. Keep DeepSeek as configuration over the generic adapter and do not reintroduce a provider-specific adapter. Run the focused provider contracts and broader non-database gate, then request exact-head review. Do not merge.

Copy link
Copy Markdown
Collaborator Author

@codex review

Full exact-head review of 9a3a8b7. Recheck all prior P1/P2 findings after the local repairs: first-tool repeat safety, registry model env override, credential redaction-before-truncation, resolved-model tier gating, and obsolete transport import removal. Preserve the generic openai-compatible architecture; do not reintroduce a DeepSeek-specific adapter. Both exact-head workflows are green. Do not merge.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a3a8b71db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/providers/openai_compatible_provider.py Outdated

Copy link
Copy Markdown
Collaborator Author

@codex address that feedback

Repair only the current exact-head P1: make _canonical_tool_calls() return a stable name+arguments fingerprint for Responses/Chat tool calls, excluding volatile transport IDs (id/call_id). Add a regression proving identical function+arguments with different IDs fingerprint identically, while changed arguments differ. Remove the whole-payload fallback if the restored canonical helper makes it unnecessary. Re-run the focused provider contracts; no scope expansion.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

Comment thread python/services/inference.py Fixed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5491892ae8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/inference.py Outdated
Comment thread python/services/providers/openai_compatible_provider.py Outdated

Copy link
Copy Markdown
Collaborator Author

Exact-head repair update (d0d732994ccfdee76d8a1c312a0e9ff5c451d183): semantic repeat fingerprints exclude transport IDs, classified roles reach the compatible transport, and Responses tool continuations preserve the complete output sequence including reasoning state. Exact provider CI command: 83 tests passed. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0d732994c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/providers/open_comp_prov_v0.0.0alpha.py
Comment thread a0/adapters/openai_compatible_adapter.py Outdated
Comment thread python/config/providers.json

Copy link
Copy Markdown
Collaborator Author

Exact-head follow-up (0c6978d6025db89368909c71d427eb549b6f7472): stateless reasoning now requests encrypted continuation state, standalone exceptions suppress credential-bearing causes, and instance fan-out propagates the provider ID resolved from each model. Verification: 85 focused tests passed and TypeScript completed with no errors. @codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c6978d602

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/providers/openai_compatible_provider.py Outdated
Comment thread client/src/components/chat-input.tsx

Copy link
Copy Markdown
Collaborator Author

Exact-head repairs are now at 2ab72d0e266b271ece21b3181d6fa72fc8109daf (tree 535220772a071902cd86bfb10c3bdd8b63b7edd6). Local verification passes 94 targeted provider/routing tests, compileall, and diff checks. Please review this exact head for remaining merge blockers.\n\n@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ab72d0e26

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/inference.py

Copy link
Copy Markdown
Collaborator Author

Final repair candidate is exact head 2a981aef656cee336d8839addcdddb49820be4a5 (tree fc17e82a3d1dd422e111172bb5d3ada6cdf3c27a). All 95 targeted provider/routing tests, compileall, and diff checks pass. Please review this exact head for any remaining merge blocker.\n\n@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a981aef65

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/providers/openai_compatible_provider.py Outdated
Comment thread a0/adapters/open_comp_adap_v0.0.0alpha.py
Comment thread python/tests/chec_open_comp_cont_v0.0.0alpha.py
Comment thread a0/adapters/openai_compatible_adapter.py Outdated

Copy link
Copy Markdown
Collaborator Author

@codex review

Exact-head review requested for d9e8139c66b5f563ac520c5bba11d3e83f549df9. This head closes the explicit-model tier bypass, defaults standalone Responses storage off, binds every repair contract to executable witnesses, and migrates all new files to PCEA naming. Focused provider/routing gates: 86 passed; contract graph: 87 contracts, 75 checks, 0 gaps; wheel includes the versioned runtime provider.

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head 450706574bcdae17a11e25485fa7d82b68bb1708 (tree 3ab723ed806f34e9864f482965c114ca2e9897ac). This head closes all five findings from the preceding review:

  • mutating tool approval is enforced at each registered-tool dispatch boundary, with a scoped post-gate grant and fail-closed live-registry coverage;
  • multimodal approval text is normalized safely;
  • legacy OpenAI routing uses the effective concrete owner/model and credentials;
  • the new approval service/test use mandatory PCEA filenames; and
  • approval replay pins the exact auto-routed model.

Verification: all 11 repaired remote blobs exactly match the locally tested tree; 101 focused provider/package tests pass; the executable contract runner passes 26 pytest nodes, 97 contracts, and 75 checks; 27 registry/context/approval tests pass; compileall and whitespace checks pass; wheel build and source-isolated wheel imports pass. The executable review check includes the new dispatch-approval contract and the live registered github_write_file denial before handler invocation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 450706574b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/services/tool_executor.py Outdated
Comment thread python/services/inference.py Outdated
Comment thread python/services/appr_gate_serv_v0.0.0alpha.py Outdated
Comment thread a0/adapters/open_comp_adap_v0.0.0alpha.py

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head c64ce3d60dff9f7c6b8900371213cd2bbe420c47. This head closes all four findings from the preceding exact-head review:

  • per-gate replay uses exact approved scope sets, never a Boolean bypass;
  • every tool-capable provider runs current-turn text preflight, and OpenAI-compatible, Claude, Gemini, and Grok propagate actual scoped dispatch denials into a concrete pending gate;
  • approval classification reads only the latest user turn while pending replay retains the original request; and
  • standalone and service-compatible effort normalization enforce configured minimums.

All 14 repaired remote files exactly match the locally tested bytes. Verification: 103 provider/package tests pass; the executable repair check passes 28 selected nodes and audits 101 contracts / 75 checks; 29 registry/context/approval tests pass; compileall, whitespace, annotation idempotence, and msdmd regeneration idempotence pass; source-isolated wheel imports pass. The modified service/provider/test modules remain within the 400-code-line doctrine; the preexisting oversized chat route is three code lines smaller than the preceding head.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: c64ce3d60d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@erinepshovel-code
erinepshovel-code merged commit 60a6b87 into main Sep 10, 2026
13 checks passed
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