fix(orchestrator): let build-cache threshold flag raise above its fal…#3175
Conversation
…lback startDiskSpaceEviction seeded the eviction threshold with the flag fallback (85) and only ever lowered it, so a build-cache-max-usage-percentage flag value above 85 was silently capped at the fallback. Extract the computation into evictionThreshold: take the minimum across the configured services' flag values (each of which already falls back inside IntFlag on evaluation failure), and use the fallback directly only when no services are configured.
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 9430946. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Code Review
No critical findings or correctness issues were identified in this pull request.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
LGTM — small, well-tested fix that lets the build-cache threshold flag raise above its fallback.
Extended reasoning...
Overview
This PR extracts eviction threshold computation into a helper evictionThreshold in packages/orchestrator/pkg/sandbox/build/cache.go. The previous code seeded the threshold with the flag fallback (85) and only lowered it via min, silently capping any configured value above the fallback. The new helper initializes with math.MaxInt and takes the minimum across configured services (with per-service IntFlag already handling its own fallback on evaluation failure), falling back to the flag default only when no services are configured.
Security risks
None. The change only affects a disk-space eviction threshold percentage inside an internal cache; it does not touch auth, crypto, permissions, or external I/O.
Level of scrutiny
Low. This is a small (~20 line) logic fix in a well-isolated helper with a clear behavioral bug and no cross-cutting implications.
Other factors
Test coverage is thorough — TestEvictionThreshold covers no-services fallback, flag raising above fallback, flag lowering below fallback, and the multi-service lowest-wins case using a proper LaunchDarkly test datastore. The refactor is a pure extraction plus the bug fix, no incidental changes. The bug hunter found no issues.
…lback
startDiskSpaceEviction seeded the eviction threshold with the flag fallback (85) and only ever lowered it, so a
build-cache-max-usage-percentage flag value above 85 was silently capped at the fallback.
Extract the computation into evictionThreshold: take the minimum across the configured services' flag values (each of which already falls back inside IntFlag on evaluation failure), and use the fallback directly only when no services are configured.