Skip to content

Report MCP OAuth Auto store drift#30296

Open
stevenlee-oai wants to merge 7 commits into
dev/stevenlee/mcp-oauth-independent-4-login-logout-lockingfrom
dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics
Open

Report MCP OAuth Auto store drift#30296
stevenlee-oai wants to merge 7 commits into
dev/stevenlee/mcp-oauth-independent-4-login-logout-lockingfrom
dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics

Conversation

@stevenlee-oai

@stevenlee-oai stevenlee-oai commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Codex Thread 019edd6d-6f14-74e2-853c-345d1803d4a6

Stack

Review and merge in order. Every layer is independently correct and documents its safe stopping point.

  1. openai/codex#30292 — aggregate File/Secrets store locking
  2. openai/codex#30293 — resolve and lifecycle-pin the exact OAuth store
  3. openai/codex#30416 — serialized authoritative refresh transaction
  4. openai/codex#30294 — Codex-owned transport refresh and one-shot 401 recovery
  5. openai/codex#30295 — login/logout transaction serialization
  6. openai/codex#30296 — diagnostic-only Auto store drift reporting

This PR is layer 6.

Why

Auto is intentionally resolved once and pinned only for a client lifecycle in this stack. If keyring availability differs in a later process, Auto can resolve to a different store. We do not want to add a durable credential-authority selector or migration policy in this stack, but we do want evidence if this rare assumption fails in practice.

What this PR does

  • Records a token-free, best-effort observation at $CODEX_HOME/.mcp-oauth-store-resolutions.json.
  • Keys observations with the same compute_store_key(server_name, url) identity used by credential locking.
  • Records configured mode, keyring backend, and resolved File/Keyring store.
  • Emits a warning and codex.mcp.oauth.store_resolution_changed counter when repeated Auto resolution under the same backend changes stores.
  • Uses a short independent aggregate lock and atomic writes.

Explicit decisions

  • This sidecar is observational, never credential authority. It cannot choose a store, block OAuth, or trigger migration or reconciliation.
  • Failures to read, lock, parse, or write it are logged and swallowed.
  • Explicit mode or keyring-backend changes reset the comparison baseline.
  • Auto with no credential records nothing; a successful Auto login records the selected store.
  • The observation intentionally survives logout so a later login can reveal drift. It contains no token material.
  • State is scoped to the active CODEX_HOME; different homes are intentionally independent.

Safe stopping point

This PR changes observability only. The five correctness layers below it are independently complete without this diagnostic.

Validation

  • just test -p codex-rmcp-client (116 passed; expected environment skips)
  • Resolution-change, intentional-mode-change, and no-credential diagnostics tests

@stevenlee-oai stevenlee-oai force-pushed the dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics branch from f1a3e95 to ed8c216 Compare June 26, 2026 21:30
@stevenlee-oai stevenlee-oai force-pushed the dev/stevenlee/mcp-oauth-independent-4-login-logout-locking branch from 04aa181 to 96b3707 Compare June 26, 2026 21:30
@stevenlee-oai stevenlee-oai force-pushed the dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics branch from ed8c216 to 2e95aa0 Compare June 26, 2026 21:48
@stevenlee-oai stevenlee-oai force-pushed the dev/stevenlee/mcp-oauth-independent-4-login-logout-locking branch from 96b3707 to 71071e9 Compare June 26, 2026 21:48
@stevenlee-oai stevenlee-oai force-pushed the dev/stevenlee/mcp-oauth-independent-4-login-logout-locking branch from 71071e9 to 857c0dd Compare June 26, 2026 22:25
@stevenlee-oai stevenlee-oai force-pushed the dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics branch from 2e95aa0 to 51f18bc Compare June 26, 2026 22:25
# Conflicts:
#	codex-rs/rmcp-client/src/oauth.rs
#	codex-rs/rmcp-client/src/oauth/resolved_store.rs
…ing' into dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics
…ing' into dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics
…ing' into dev/stevenlee/mcp-oauth-independent-5-auto-diagnostics
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