Title: Overlay-base cache restore misses on cache backends that only prefix-match restoreKeys · Issue #4202 · github/codeql-action · GitHub
Open Graph Title: Overlay-base cache restore misses on cache backends that only prefix-match restoreKeys · Issue #4202 · github/codeql-action
X Title: Overlay-base cache restore misses on cache backends that only prefix-match restoreKeys · Issue #4202 · github/codeql-action
Description: Summary downloadOverlayBaseDatabaseFromCache restores the overlay-base database by passing the key prefix as the primary key, with no restoreKeys: codeql-action/src/overlay/caching.ts Lines 290 to 302 in d208ec7 actionsCache.restoreCache...
Open Graph Description: Summary downloadOverlayBaseDatabaseFromCache restores the overlay-base database by passing the key prefix as the primary key, with no restoreKeys: codeql-action/src/overlay/caching.ts Lines 290 to ...
X Description: Summary downloadOverlayBaseDatabaseFromCache restores the overlay-base database by passing the key prefix as the primary key, with no restoreKeys: codeql-action/src/overlay/caching.ts Lines 290 to ...
Opengraph URL: https://github.com/github/codeql-action/issues/4202
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Overlay-base cache restore misses on cache backends that only prefix-match restoreKeys","articleBody":"### Summary\n\n`downloadOverlayBaseDatabaseFromCache` restores the overlay-base database by passing the key **prefix** as the primary key, with no `restoreKeys`:\n\nhttps://github.com/github/codeql-action/blob/d208ec71e39ae46397cbf6569bef8439b9aab974/src/overlay/caching.ts#L290-L302\n\n```ts\nactionsCache.restoreCache(\n [dbLocation],\n cacheRestoreKeyPrefix,\n undefined,\n { segmentTimeoutInMs: 3000 },\n)\n```\n\nThis depends on the primary key matching by prefix. GitHub's cache service does that, but some Actions-cache-compatible backends only prefix-match `restoreKeys`. One example is the transparent cache on Blacksmith runners. On those backends, PR runs can never restore the overlay-base database, even though default-branch runs upload it successfully. Every PR run then falls back to a full analysis.\n\n### What we see\n\nDefault-branch run, on the same runner type:\n\n```\nSetting overlay database mode to overlay-base with caching because we are analyzing the default branch.\nUploading overlay-base database to Actions cache with key codeql-overlay-base-database-1-\u003chash>-python-2.27.1-\u003csha>-\u003crun_id>-1\nSuccessfully uploaded overlay-base database from /home/runner/_work/_temp/codeql_databases\n```\n\nPull request run:\n\n```\nSetting overlay database mode to overlay with caching because we are analyzing a pull request.\nLooking in Actions cache for overlay-base database with restore key codeql-overlay-base-database-1-\u003chash>-python-2.27.1-\nNo overlay-base database found in Actions cache\nNo overlay-base database found in cache, reverting overlay database mode to none.\n```\n\n### Minimal reproduction of the backend difference\n\nA cache entry saved as `probe-\u003crun_id>-full`, then restored in a later job on the same branch with `actions/cache/restore@v4`:\n\n| Restore | GitHub-hosted runner | Blacksmith runner |\n|---|---|---|\n| `key: probe-\u003crun_id>-` (prefix as the primary key, like this action) | hit | **miss** |\n| `key: probe-\u003crun_id>-nomatch`, `restore-keys: probe-\u003crun_id>-` | hit | hit |\n\n### Suggested fix\n\nAlso pass the prefix as a restore key:\n\n```ts\nactionsCache.restoreCache(\n [dbLocation],\n cacheRestoreKeyPrefix,\n [cacheRestoreKeyPrefix],\n { segmentTimeoutInMs: 3000 },\n)\n```\n\nOn GitHub's cache this matches exactly the same entries as today, since the prefix is tried first either way. On backends that only prefix-match restore keys, overlay analysis starts working.\n\n### Environment\n\n- `github/codeql-action/init` and `analyze` `@v4`, CodeQL bundle 2.27.1\n- `build-mode: none`, languages `python` and `javascript-typescript`\n- Third-party hosted runners (Blacksmith) whose `actions/cache` calls go to their own cache backend\n","author":{"url":"https://github.com/Yuppyboy","@type":"Person","name":"Yuppyboy"},"datePublished":"2026-10-07T05:43:31Z","url":"https://github.com/github/codeql-action/issues/4202"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a8798e03-0438-a322-285c-65d250e2db43 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E618:3FCC52:553ACE:73CB76:6AED1FA4 |
| html-safe-nonce | 22002745c0f5dcca1a765c4d435fc729fee7469635749102887a021de7858f50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjE4OjNGQ0M1Mjo1NTNBQ0U6NzNDQjc2OjZBRUQxRkE0IiwidmlzaXRvcl9pZCI6IjcxMTYwMTMwNzg5MzQ1Mjc5MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 067a51bfabba40f353cb79da20b195be4cc9ec3f0de7a96f38432135ca6f2230 |
| hovercard-subject-tag | issue:5740032997 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/codeql-action/4202/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d82e85215b6da0690ae5f86130901584b334ba0477e2c087287f0ec5836651b1/github/codeql-action/issues/4202 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d82e85215b6da0690ae5f86130901584b334ba0477e2c087287f0ec5836651b1/github/codeql-action/issues/4202 |
| og:image:alt | Summary downloadOverlayBaseDatabaseFromCache restores the overlay-base database by passing the key prefix as the primary key, with no restoreKeys: codeql-action/src/overlay/caching.ts Lines 290 to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Yuppyboy |
| hostname | github.com |
| expected-hostname | github.com |
| None | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/github/codeql-action git https://github.com/github/codeql-action.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 259445878 |
| octolytics-dimension-repository_nwo | github/codeql-action |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 259445878 |
| octolytics-dimension-repository_network_root_nwo | github/codeql-action |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width