Skip to content

feat(integration): codex reviewer on DeepSeek-v4-pro via Moon Bridge#811

Merged
Yiminnn merged 1 commit into
mainfrom
fix/integration-codex-deepseek-moonbridge
Jun 19, 2026
Merged

feat(integration): codex reviewer on DeepSeek-v4-pro via Moon Bridge#811
Yiminnn merged 1 commit into
mainfrom
fix/integration-codex-deepseek-moonbridge

Conversation

@Yiminnn

@Yiminnn Yiminnn commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Per your doc (deepseek-ai/awesome-deepseek-agent codex.md), route the L3 codex equivalence reviewer to DeepSeek-v4-pro through Moon Bridge — a local proxy that exposes an OpenAI-Responses endpoint and forwards to DeepSeek's /anthropic surface. This sidesteps the OpenAI quota (gpt-5.5 + xhigh hit Quota exceeded).

Validated end-to-end LOCALLY

Installed Go + Moon Bridge, started the bridge with the DeepSeek key, generated codex's config, and ran codex exec --model moonbridge:

  • codex exit 0, output Verdict: mergeable
  • bridge log: 流式请求完成 ... actual_model=deepseek-v4-pro provider=deepseek input_total=12555 output_tokens=26 — confirmed the upstream DeepSeek call.
    (First attempt failed only because CODEX_HOME was under /tmp, which made codex refuse to create helper binaries — a local artifact; CI uses ~/.codex.)

Changes

  • setup_codex_deepseek_bridge.sh — install Go, build + background-start Moon Bridge with $DEEPSEEK_API_KEY, generate codex config.toml (wire_api=responses, model=moonbridge) into ~/.codex, drop the unused deepwiki MCP.
  • moonbridge-config.yml — bridge config template (key placeholder substituted at runtime).
  • L3 + L2 review-pack: a bridge-setup step (continue-on-error) before the codex step; CODEX_MODEL=moonbridge, CODEX_REASONING_EFFORT=xhigh.

Notes

  • New external surface: the trusted-main review-pack job clones + builds Moon Bridge (a third-party Go tool). Follow-up: pin the clone to a commit (currently default HEAD).
  • The rest of the pipeline is already green (plan → 10/10 rollouts → grader → parity + R-OUTCOME demotes = mergeable-with-quarantines deterministically).

Test plan

  • Validated locally: codex → Moon Bridge → deepseek-v4-pro emits a parseable verdict
  • bash + YAML valid; no key committed
  • Re-dispatch L3 on Preserve pi-acp model metadata through LiteLLM proxy #803 → codex produces a real verdict on DeepSeek-v4-pro (no quota) → mergeable / mergeable-with-quarantines

… Bridge

codex (OpenAI CLI) speaks ONLY the OpenAI Responses API, and the OpenAI account
quota for gpt-5.5 is exhausted. Per deepseek-ai/awesome-deepseek-agent docs/codex.md,
route codex to DeepSeek-v4-pro through Moon Bridge — a local proxy that exposes a
Responses-compatible endpoint and forwards to DeepSeek's /anthropic surface.

VALIDATED END-TO-END LOCALLY: codex exec on model `moonbridge` -> deepseek-v4-pro
returns a parseable verdict (the bridge log confirms the upstream deepseek-v4-pro
call; codex exit 0, "Verdict: mergeable").

- setup_codex_deepseek_bridge.sh: install Go, build + background-start Moon Bridge
  with the DeepSeek key, generate codex's config.toml (wire_api=responses,
  model=moonbridge) into ~/.codex, strip the unused deepwiki MCP server.
- moonbridge-config.yml: the bridge config template (DEEPSEEK_API_KEY_PLACEHOLDER
  substituted at runtime; no key committed).
- L3 + L2 review-pack: a "Set up codex DeepSeek bridge" step before the codex
  step (continue-on-error so a bridge failure still reaches codex's fail-closed
  verdict); CODEX_MODEL=moonbridge, CODEX_REASONING_EFFORT=xhigh.

Follow-up: pin the moon-bridge clone to a commit (currently --depth 1 default HEAD).
@Yiminnn Yiminnn temporarily deployed to pypi-internal-preview June 19, 2026 02:13 — with GitHub Actions Inactive
@Yiminnn Yiminnn merged commit 3daf698 into main Jun 19, 2026
8 checks passed
@Yiminnn Yiminnn deleted the fix/integration-codex-deepseek-moonbridge branch June 19, 2026 02:16
@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR routes the L3/L2 codex equivalence reviewer from OpenAI (quota exhausted) to DeepSeek-v4-pro by introducing Moon Bridge — a locally-built reverse proxy that translates codex's OpenAI Responses API calls to DeepSeek's Anthropic surface. The core mechanism is a new shell script that installs Go, clones and builds the bridge from a third-party GitHub repo, starts it in the background, and writes a ~/.codex/config.toml pointing at it.

  • New setup_codex_deepseek_bridge.sh: downloads Go if needed, clones and compiles ZhiYi-R/moon-bridge at unspecified HEAD, starts the bridge as a background process with the live DEEPSEEK_API_KEY, and generates the codex provider config; the clone is explicitly acknowledged as unpinned in the PR notes.
  • New moonbridge-config.yml: template config wiring the moonbridge route to deepseek-v4-pro via api.deepseek.com/anthropic; the API key placeholder is substituted at runtime via sed.
  • Workflow changes (integration-final-review.yml, integration-scope.yml): insert a continue-on-error bridge-setup step before the codex step and change CODEX_MODEL from gpt-5.5 to moonbridge in both the fail-closed L3 gate and the advisory L2 gate.

Confidence Score: 1/5

Not safe to merge as-is: the bridge script clones and executes an unreviewed, unpinned third-party binary that holds a live API key.

The core of this change is a CI script that downloads, compiles, and runs code from a third-party GitHub repository at an unspecified HEAD commit, while that process holds the DEEPSEEK_API_KEY in a config file it reads. The repository owner (or anyone who compromises that account) can push arbitrary code that will be executed silently on the next workflow run. The PR explicitly flags this as a known gap but does not address it before merge.

.github/scripts/setup_codex_deepseek_bridge.sh needs the most attention — specifically the unpinned git clone on line 29 and the sed-based key substitution on lines 33–34. .github/workflows/integration-final-review.yml is worth a second look for how a silent bridge-setup failure interacts with the fail-closed codex gate.

Security Review

  • Supply chain / RCE (.github/scripts/setup_codex_deepseek_bridge.sh lines 29–30): ZhiYi-R/moon-bridge is cloned at default HEAD with no commit pin, compiled from source, and executed as a background process that holds DEEPSEEK_API_KEY in its config. A malicious or compromised commit to that repo would be picked up automatically on the next CI run and could exfiltrate the key or run arbitrary code in the runner environment. The PR acknowledges this but does not mitigate it before merge.
  • API key written to plaintext temp file (lines 33–34): DEEPSEEK_API_KEY is substituted via sed into /tmp/mb_config.yml and passed to the unreviewed binary. If the sed delimiter (|) appears in the key, the substitution silently corrupts the config.

Important Files Changed

Filename Overview
.github/scripts/setup_codex_deepseek_bridge.sh New script that installs Go, clones and builds an unpinned third-party binary (moon-bridge), starts it as a background reverse proxy, and writes a codex config pointing at it — the unpinned clone is a supply chain risk and the sed-based key substitution can break for keys containing the delimiter character
.github/integration/moonbridge-config.yml New Moon Bridge config template routing the moonbridge alias to deepseek-v4-pro via DeepSeek's Anthropic surface; key is a placeholder substituted at runtime and never committed
.github/workflows/integration-final-review.yml Adds a continue-on-error bridge-setup step before the fail-closed L3 codex gate and switches CODEX_MODEL from gpt-5.5 to moonbridge; a silent bridge failure leaves the codex step in an ambiguous broken state with no clear diagnostic
.github/workflows/integration-scope.yml Mirrors the same bridge-setup + model-switch pattern for the advisory L2 codex reviewer; lower risk because codex is not fail-closed here

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant GHA as GitHub Actions Runner
    participant GH as github.com/ZhiYi-R/moon-bridge
    participant MB as Moon Bridge (localhost:38440)
    participant Codex as codex CLI
    participant DS as api.deepseek.com/anthropic

    GHA->>GH: git clone --depth 1 HEAD (unpinned)
    GHA->>GHA: go build -o /tmp/moonbridge
    GHA->>GHA: sed DEEPSEEK_API_KEY into /tmp/mb_config.yml
    GHA->>MB: nohup /tmp/moonbridge -config /tmp/mb_config.yml
    GHA->>MB: poll /console/ until healthy
    GHA->>GHA: moonbridge -print-codex-config → ~/.codex/config.toml
    GHA->>Codex: "codex exec (CODEX_MODEL=moonbridge)"
    Codex->>MB: OpenAI Responses API request
    MB->>DS: Translated Anthropic API request + DEEPSEEK_API_KEY
    DS-->>MB: DeepSeek-v4-pro response
    MB-->>Codex: OpenAI Responses API response
    Codex-->>GHA: Verdict (mergeable / not mergeable)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant GHA as GitHub Actions Runner
    participant GH as github.com/ZhiYi-R/moon-bridge
    participant MB as Moon Bridge (localhost:38440)
    participant Codex as codex CLI
    participant DS as api.deepseek.com/anthropic

    GHA->>GH: git clone --depth 1 HEAD (unpinned)
    GHA->>GHA: go build -o /tmp/moonbridge
    GHA->>GHA: sed DEEPSEEK_API_KEY into /tmp/mb_config.yml
    GHA->>MB: nohup /tmp/moonbridge -config /tmp/mb_config.yml
    GHA->>MB: poll /console/ until healthy
    GHA->>GHA: moonbridge -print-codex-config → ~/.codex/config.toml
    GHA->>Codex: "codex exec (CODEX_MODEL=moonbridge)"
    Codex->>MB: OpenAI Responses API request
    MB->>DS: Translated Anthropic API request + DEEPSEEK_API_KEY
    DS-->>MB: DeepSeek-v4-pro response
    MB-->>Codex: OpenAI Responses API response
    Codex-->>GHA: Verdict (mergeable / not mergeable)
Loading

Reviews (1): Last reviewed commit: "feat(integration): run the codex reviewe..." | Re-trigger Greptile

Comment thread .github/scripts/setup_codex_deepseek_bridge.sh
Comment thread .github/scripts/setup_codex_deepseek_bridge.sh
Comment thread .github/workflows/integration-final-review.yml
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