Skip to content

fix(mcp): wire Claude OAuth prod deploy contract (PR6a) - #9256

Merged
Git-on-my-level merged 3 commits into
mainfrom
fix/mcp-oauth-prod-deploy
Jul 9, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
fix/mcp-oauth-prod-deploy

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Merge order & dependencies

PR Dependencies
9250 None — merge first (unblocks CI)
9252 None — parallel with #9253, #9254
9253 None — parallel with #9252, #9254
9254 None — parallel with #9252, #9253; #9255 should merge after this
9255 Merge after #9254 (registers teardown tests). Merge after #9250 recommended.
9256 Independent code PR; PR6b prod deploy after merge. Related #9255 not blocking.
9257 Draft. Merge after #9255 (workflow contract CI).
9258 Draft. Independent; merge after wave 1.
9260 Draft. Independent; merge after wave 1.
9261 Draft. Merge after wave 1; PR10c proxy routing follow-up optional.

Summary

  • Wire MCP_OAUTH_CLIENTS_JSON / MCP_OAUTH_CLAUDE_* into runtime_env.yaml, Helm secrets, and prod backend-listen values.
  • Extend smoke_mcp_chatgpt_review.py authorize checks, add check_mcp_oauth_deploy_contract.py, and gate pre-deploy-check.sh.
  • Remove stale ("oauth_client_id", "omi") automation fallback in MemoryExportService.swift.

Deploy follow-up (PR6b): run backend-listen prod deploy + smoke_mcp after merge (requires deploy credentials; not done in this PR).

Test plan

cd backend && .venv/bin/python scripts/check_mcp_oauth_deploy_contract.py
cd backend && .venv/bin/python -m pytest tests/unit/test_mcp_oauth.py -v -k claude
# 1 passed

Merge with a regular merge (no squash).

Closes #9149
Closes #8537

Made with Cursor

Review in cubic

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 9 files

Confidence score: 3/5

  • In backend/deploy/runtime_env.yaml, backend-listen now gets both MCP_OAUTH_CLIENTS_JSON and the per-client Claude OAuth vars, which can create conflicting sources of truth for OAuth client config and lead to production auth misconfiguration (for example wrong client metadata or redirect behavior); decide on one canonical config path (or define explicit precedence) and validate backend-listen startup/runtime behavior before merging.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/deploy/runtime_env.yaml">

<violation number="1" location="backend/deploy/runtime_env.yaml:306">
P2: The prod `backend-listen` environment now receives both the aggregate `MCP_OAUTH_CLIENTS_JSON` and the individual `MCP_OAUTH_CLAUDE_CLIENT_ID`, `MCP_OAUTH_CLAUDE_CLIENT_NAME`, and `MCP_OAUTH_CLAUDE_REDIRECT_URIS` secrets. In `database/mcp_oauth.py`, `get_client()` looks up the client first in the JSON and only falls back to the per-client env vars, so diverging values can silently change runtime behavior. The deploy-check script only validates presence, not consistency. Consider cross-validating the JSON against the per-client secrets (or removing the duplication) so drift is caught before deploy.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread backend/deploy/runtime_env.yaml Resolved

@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: 241d179b4e

ℹ️ 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 backend/deploy/runtime_env.yaml Resolved
Git-on-my-level and others added 3 commits July 8, 2026 14:55
Related #9149 #8537 — add MCP_OAUTH_CLAUDE_* and MCP_OAUTH_CLIENTS_JSON to
prod Helm/runtime_env, extend smoke authorize checks, pre-deploy gate, and
remove stale desktop oauth_client_id fallback.

Verification: python3 backend/scripts/check_mcp_oauth_deploy_contract.py
  cd backend && python3 -m pytest tests/unit/test_mcp_oauth.py -k claude -v
  cd backend && python3 -m pytest tests/unit/test_mcp_oauth_deploy_contract.py -v
Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level force-pushed the fix/mcp-oauth-prod-deploy branch from 241d179 to bb5b39f Compare July 8, 2026 08:00
@Git-on-my-level

Copy link
Copy Markdown
Member Author

Monitor follow-up for PR #9256:

  • Added the Claude MCP OAuth secret bindings to the prod Cloud Run backend service so api.omi.me receives the same client config as backend-listen.
  • Extended check_mcp_oauth_deploy_contract.py to verify the Cloud Run backend bindings and to cross-check live MCP_OAUTH_CLIENTS_JSON values against the Claude per-client fallback env vars when those values are available.
  • Added regression coverage for matching/drifted Claude OAuth env values.
  • Added MemoryExportService.swift to the existing settings desktop e2e coverage map so the desktop coverage gate passes for this PR’s touched Swift file.

Verification passed:

  • python3 scripts/check_mcp_oauth_deploy_contract.py
  • python3 scripts/validate-backend-runtime-env.py --env prod --check-workflows --check-rendered-cloud-run
  • python3 -m pytest tests/unit/test_backend_runtime_env_validator.py tests/unit/test_preflight_cloud_run_deploy.py tests/unit/test_deploy_status_report.py tests/unit/test_mcp_oauth_deploy_contract.py -q (27 passed)
  • python3 desktop/macos/scripts/check-e2e-flow-coverage.py --strict --base origin/main
  • python3 .github/scripts/check-desktop-changelog.py --base origin/main --head HEAD
  • xcrun swiftc -parse desktop/macos/Desktop/Sources/MemoryExportService.swift
  • GitHub checks after push: all required/non-skipped checks completed successfully.

@kodjima33 kodjima33 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.

MCP Claude OAuth deploy contract wiring — approve; deploy/secret-config sensitive, leaving merge to a human deploy

@Git-on-my-level
Git-on-my-level merged commit 5cefc36 into main Jul 9, 2026
21 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/mcp-oauth-prod-deploy branch July 9, 2026 06:46
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.

Desktop Claude connector instructions use stale OAuth client ID Add Claude MCP OAuth client support

2 participants