Repository navigation
feat(cache): warm the compile cache's base lane from every default-branch head - #241
Merged
Merged
Conversation
…anch head Every push to contextful's default branch starts contextful-cache-warm, independent of the two-tier gate's gate.lightLabels opt-in. One container checks out the head, builds the gate's prebuilt contextful-ci and runs the gate's workspace.compile part (cargo test --workspace --no-run) under the compile-cache wrapper with a base-lane token. The command, checkout path and environment equal a gate part's, since sccache keys entries on arguments, working directory and CARGO_* variables. Only a default-branch head writes base: the run reads the branch head before checkout and skips unless it equals the run's head, or when the head is unreadable. A newer head supersedes the older warm, ranked by the head commit's timestamp; the idempotency key is the head. The warm skips when the deploy injects no cache access and when the heavy tier already compiles workspace.compile on the push. A failed compile concludes green with its exit code. Pull-request gates keep reading pr-<n> then base and writing pr-<n>. Spec: specs/adr/0007-cost-efficient-execution.md
debuggingfuture
marked this pull request as ready for review
October 23, 2026 13:07
There was a problem hiding this comment.
AI code review — 💬 Comment
Risk tier: full · 0 critical · 1 warnings · 0 suggestions
Reviewers: security
1. ⚠️ Warning — Timestamp ranking can allow duplicate long-running warms
📍 runs/contextful-cache-warm.ts:87
The supersession order relies only on 'head_commit.timestamp', which is not guaranteed to increase across pushes and can be equal for multiple commits. A newer default-branch head can therefore fail to supersede an older warm, leaving multiple potentially 5400-second containers compiling and uploading the same base lane. Use a monotonic push/event sequence or otherwise enforce latest-head ordering so stale warms are cancelled before consuming the compile budget.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every default-branch push of contextful now fills the compile cache's
baselane, so a pull request's first gate reads compiled crates instead of compiling cold.Problem & Insight
baseis written only by default-branch executions, and the only one was the heavy tier, which runs only whengate.lightLabels:<repo>is set. With it unset,basestays empty and each PR warms only its ownpr-<n>lane from its second push on.CARGO_*environment. A warm that runs its owncargoinvocation, or launches the gate tool throughcargo run, writes entries no part reads. The warm has to run the gate part's exact command.Take
contextful-cache-warm(runs/contextful-cache-warm.ts), triggered on default-branch pushes with no opt-in key. It uses one container: checkout with install, the gate's prebuiltcontextful-ci, thenworkspace.compile(cargo test --workspace --no-run) throughstageCommandandcompileCacheCommand, with abasetoken. It spawns no child and posts no part check-run.workspace.compileon that push.Follow-ups
features.*and other parts compile under other features or target directories, so the warm doesn't cover them. Warming them needs a compile-only mode per part in the consumer'scontextful-ci.