write usage cache entry even for AIC = 0#39066
Merged
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
June 13, 2026 11:35
View session
pelikhan
approved these changes
Jun 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the daily AI Credits (AIC) usage caching flow so that AIC = 0 (e.g., when a run is blocked by the daily guardrail and produces no usage artifact) is treated as a valid cached value, avoiding repeated artifact-download retries on subsequent activations.
Changes:
- Write cache entries when computed AIC is
0(skip only negative/non-finite). - Load cached entries with
aic >= 0so0becomes a cache hit. - Update the guardrail cache-loading test to assert
aic = 0is loaded.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/write_daily_aic_usage_cache.cjs | Allows writing cache entries for aic = 0 to prevent repeated artifact download attempts for blocked runs. |
| actions/setup/js/check_daily_aic_workflow_guardrail.cjs | Adjusts cache-load filtering to accept aic >= 0 so zero-valued entries become cache hits. |
| actions/setup/js/check_daily_aic_workflow_guardrail.test.cjs | Updates expectations to reflect that aic = 0 entries are now loaded into the cache. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
Comment on lines
122
to
+125
| const entry = JSON.parse(line); | ||
| const runId = Number(entry?.run_id); | ||
| const aic = Number(entry?.aic); | ||
| if (Number.isFinite(runId) && runId > 0 && Number.isFinite(aic) && aic > 0) { | ||
| if (Number.isFinite(runId) && runId > 0 && Number.isFinite(aic) && aic >= 0) { |
Collaborator
|
@copilot run pr-finisher skill |
…coercion Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done. Fixed in commit 1f7b2c3 — |
6 tasks
This was referenced Jul 4, 2026
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.
When the daily AIC guardrail blocks a run, the agent never executes and no usage files are produced — AIC is legitimately 0. The old guard (
aic <= 0 → skip) treated this the same as a computation error, leaving the run uncached. Every subsequent activation then wasted agetRunAICartifact-download round-trip for that run, finding nothing and getting 0 anyway.Changes
write_daily_aic_usage_cache.cjs: relax skip condition fromaic <= 0toaic < 0— zero is a valid, writable AICcheck_daily_aic_workflow_guardrail.cjs(loadAICUsageCache): acceptaic >= 0so aic=0 entries land in the Map as cache hits; the guardrail loop already skipsrunAIC <= 0runs correctlycheck_daily_aic_workflow_guardrail.test.cjs: update assertion — aic=0 entries are now loaded; negative/non-finite still rejected