Skip to content

Bound CIMD cache growth - #4852

Open
jlowin wants to merge 2 commits into
mainfrom
codex/bound-cimd-cache
Open

Bound CIMD cache growth#4852
jlowin wants to merge 2 commits into
mainfrom
codex/bound-cimd-cache

Conversation

@jlowin

@jlowin jlowin commented Aug 17, 2026

Copy link
Copy Markdown
Member

CIMD clients are resolved from URL-shaped client IDs, but each distinct document was retained indefinitely in both the process cache and the persistent DCR registry. The assertion replay cache had the same failure mode: it enforced its capacity after insertion, so overload rejections still increased memory use.

Bound document retention with oldest-entry eviction, keep URL-derived clients out of persistent registration storage (while lazily removing legacy records), and enforce replay-cache capacity before inserting a new JTI.

if len(cache) >= max_size:
    cleanup_expired_entries()
    if len(cache) >= max_size:
        raise ValueError("Server overloaded, please retry")

cache[key] = value

@jlowin
jlowin marked this pull request as ready for review August 17, 2026 22:56
@marvin-context-protocol marvin-context-protocol Bot added auth Related to authentication (Bearer, JWT, OAuth, WorkOS) for client or server. bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. security Security fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses. labels Aug 17, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

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

Copy link
Copy Markdown
Contributor

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: 4a34a5acd1

鈩癸笍 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 on lines 944 to 948
cimd_client = await self._cimd_manager.get_client(client_id)
if cimd_client is not None:
await self._client_store.put(key=client_id, value=cimd_client)
if client is not None:
await self._client_store.delete(key=client_id)
return cimd_client

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Keep CIMD metadata available across proxy instances

When production uses shared client_storage across multiple workers鈥攐r a worker restarts鈥攖his returns a newly resolved CIMD client without persisting it, so the next authorization/consent/token request handled by another process must fetch the remote document again. If that origin is temporarily unavailable or rate-limited, an OAuth flow that already started fails despite the documented persistent client storage and the shared backend; although legacy records now survive failed refresh, newly resolved clients still have no fallback. Preserve a bounded/shared snapshot or otherwise retain the client for the duration of the flow.

AGENTS.md reference: AGENTS.md:L193-L195

Useful? React with 馃憤聽/ 馃憥.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Related to authentication (Bearer, JWT, OAuth, WorkOS) for client or server. bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. security Security fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant