Skip to content

Serialize MCP OAuth credential refreshes - #32229

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/4d29b879bec646d2ceb922b526dc793b1a1f5423
Jul 10, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/4d29b879bec646d2ceb922b526dc793b1a1f5423

Conversation

@copyberry

@copyberry copyberry Bot commented Jul 10, 2026 •

Copy link
Copy Markdown

Serialize MCP OAuth credential refreshes

Why

Concurrent Codex processes can otherwise refresh the same rotating token, and a
cancelled or partially persisted refresh can leave durable and in-memory MCP
credentials out of sync.

What changed

  • Serialize each credential's read-refresh-write transaction across processes,
    reread the authoritative store after locking, and adopt credentials refreshed
    by another process.
  • Keep refresh persistence running after caller cancellation, bound lock and
    provider waits independently, and preserve omitted refresh tokens and scopes.
  • Fail MCP startup and operations when refresh or persistence fails instead of
    continuing with stale credentials, while requiring reauthorization for
    missing, unusable, or rejected refresh tokens.
  • Exclude OAuth refresh time from the MCP initialization timeout.

Testing

Add coverage for lock contention, concurrent refreshes, rejected and missing
credentials, storage failures, caller cancellation, and provider timeouts.

## Why

Concurrent Codex processes can otherwise refresh the same rotating token, and a
cancelled or partially persisted refresh can leave durable and in-memory MCP
credentials out of sync.

## What changed

- Serialize each credential's read-refresh-write transaction across processes,
  reread the authoritative store after locking, and adopt credentials refreshed
  by another process.
- Keep refresh persistence running after caller cancellation, bound lock and
  provider waits independently, and preserve omitted refresh tokens and scopes.
- Fail MCP startup and operations when refresh or persistence fails instead of
  continuing with stale credentials, while requiring reauthorization for
  missing, unusable, or rejected refresh tokens.
- Exclude OAuth refresh time from the MCP initialization timeout.

## Testing

Add coverage for lock contention, concurrent refreshes, rejected and missing
credentials, storage failures, caller cancellation, and provider timeouts.

GitOrigin-RevId: 4d29b879bec646d2ceb922b526dc793b1a1f5423
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/4d29b879bec646d2ceb922b526dc793b1a1f5423 branch from 61930b8 to 6962a2e Compare July 10, 2026 18:00
@copyberry
copyberry Bot merged commit 6962a2e into main Jul 10, 2026
14 of 32 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/4d29b879bec646d2ceb922b526dc793b1a1f5423 branch July 10, 2026 18:02
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 10, 2026

This branch was previously deployed

1 inactive deployment
issue-triage — 6962a2ec Deployed Jul 10, 2026 by marb129 via Identify potential duplicates (open issues fallback) #30217
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants