fixup: refresh auth info when not in GitLab CI#191
Conversation
|
Warning Review limit reached
More reviews will be available in 1 hour, 12 minutes, and 34 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesToken Refresh Worker Condition
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
magic-nix-cache/src/flakehub.rs (1)
99-110:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
refresh_github_actions_jwt_workerwill fail repeatedly in non-GitHub Actions environments.With the guard changed to
!environment.is_gitlab_ci(), theNetrcpath now spawnsrefresh_github_actions_jwt_workerin Buildkite and "Other" environments. However, this worker relies on GitHub Actions-specific environment variables (ACTIONS_ID_TOKEN_REQUEST_TOKEN,ACTIONS_ID_TOKEN_REQUEST_URL) that won't exist outside GitHub Actions. The worker will sleep 2 minutes, fail to read the env vars, log an error, sleep 10 seconds, and repeat indefinitely—spamming logs and wasting cycles.Consider either:
- Keep the GitHub Actions check specifically for the
Netrcpath (preserving the original behavior for this case), or- Have the worker detect missing env vars at startup and exit gracefully.
Option 1: Add inner guard for Netrc path
if !environment.is_gitlab_ci() { match auth_method { super::FlakeHubAuthSource::Netrc(path) => { + // Only refresh GitHub Actions JWTs when actually running in GitHub Actions + if environment.is_github_actions() { let netrc_path_clone = path.to_path_buf(); let initial_github_jwt_clone = flakehub_password.clone(); let api_clone = api.clone(); tokio::task::spawn(refresh_github_actions_jwt_worker( netrc_path_clone, initial_github_jwt_clone, api_clone, )); + } } crate::FlakeHubAuthSource::DeterminateNixd => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@magic-nix-cache/src/flakehub.rs` around lines 99 - 110, The `refresh_github_actions_jwt_worker` is being spawned whenever `!environment.is_gitlab_ci()` is true, but this worker requires GitHub Actions-specific environment variables that only exist in GitHub Actions CI. Add an additional check to verify that the code is running in a GitHub Actions environment before spawning the worker in the `Netrc` path case. This ensures the worker only runs when the required environment variables (`ACTIONS_ID_TOKEN_REQUEST_TOKEN`, `ACTIONS_ID_TOKEN_REQUEST_URL`) are actually present, preventing repeated failures and log spam in non-GitHub Actions environments like Buildkite.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@magic-nix-cache/src/flakehub.rs`:
- Around line 99-110: The `refresh_github_actions_jwt_worker` is being spawned
whenever `!environment.is_gitlab_ci()` is true, but this worker requires GitHub
Actions-specific environment variables that only exist in GitHub Actions CI. Add
an additional check to verify that the code is running in a GitHub Actions
environment before spawning the worker in the `Netrc` path case. This ensures
the worker only runs when the required environment variables
(`ACTIONS_ID_TOKEN_REQUEST_TOKEN`, `ACTIONS_ID_TOKEN_REQUEST_URL`) are actually
present, preventing repeated failures and log spam in non-GitHub Actions
environments like Buildkite.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b2543b50-4320-4637-99e3-9b19f24d2853
📒 Files selected for processing (1)
magic-nix-cache/src/flakehub.rs
Flake lock file updates:
• Updated input 'nixpkgs':
'https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.992384%2Brev-549bd84d6279f9852cae6225e372cc67fb91a4c1/019df915-70b5-73a2-a5a4-63c620b45d9f/source.tar.gz' (2026-05-05)
→ 'https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.1014179%2Brev-9ae611a455b90cf061d8f332b977e387bda8e1ca/019eb959-af28-7e70-8140-2447573a6acd/source.tar.gz' (2026-06-10)
e921fb3 to
fe0fc91
Compare
Summary by CodeRabbit