Skip to content

Remove Authorization from ghproxy cache key for cross-pod deduplication#843

Merged
gjkim42 merged 1 commit intomainfrom
ghproxy-drop-auth-cache-key
Mar 29, 2026
Merged

Remove Authorization from ghproxy cache key for cross-pod deduplication#843
gjkim42 merged 1 commit intomainfrom
ghproxy-drop-auth-cache-key

Conversation

@gjkim42
Copy link
Copy Markdown
Collaborator

@gjkim42 gjkim42 commented Mar 29, 2026

/kind cleanup

What this PR does / why we need it:

Removes the Authorization header from the ghproxy cache key so that spawner pods with different GitHub tokens share cached responses for the same repos.

Previously, each token produced a separate cache entry, so N spawner pods watching the same repo caused N upstream requests per TTL window. Since all tokens have equivalent read access to the same repository data, the responses are identical — caching them separately wasted the deduplication benefit of a shared proxy.

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

The cache key now varies by upstream host + path + Accept header only. Authorization is still forwarded to upstream on every request (cache miss or revalidation) — only the cache lookup ignores it.

Does this PR introduce a user-facing change?

NONE

Summary by cubic

Remove the Authorization header from the ghproxy cache key to share GET responses across pods using different GitHub tokens. This reduces upstream GitHub requests and improves cache hit rates.

  • Refactors
    • Cache key now varies by upstream + path/query + Accept; Authorization is excluded to enable cross-pod deduplication.
    • Authorization is still forwarded to GitHub on misses/revalidation; tests updated to reflect the new key shape.

Written for commit 698a7fb. Summary will update on new commits.

Each TaskSpawner uses its own GitHub token, so including the
Authorization header in the cache key prevented cache sharing across
spawner pods watching the same repos. Since all tokens have equivalent
read access to the same repository data, the cached response bodies
are identical regardless of which token fetched them.

Dropping Authorization from the key enables cross-pod deduplication:
when N spawner pods watch the same repo, only one upstream request is
needed per cache TTL window instead of one per pod.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@gjkim42 gjkim42 merged commit a85c6ac into main Mar 29, 2026
32 checks passed
@gjkim42 gjkim42 deleted the ghproxy-drop-auth-cache-key branch March 29, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant