Skip to content

Fix legacy daily AIC accounting gaps - #61313

Merged
dsyme merged 1 commit into
mainfrom
fix/daily-aic-legacy-accounting
Sep 16, 2026
Merged

dsyme merged 1 commit into
mainfrom
fix/daily-aic-legacy-accounting

Conversation

@dsyme

@dsyme dsyme commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Fix daily AI Credits guardrail cascades caused by legacy runs that lack modern execution evidence.

  • Treat failed agent jobs with no accounting file as zero only when there is no contradictory execution or agent-log evidence.
  • Recognize successful deterministic sample replays from the validated same-attempt agent artifact when legacy usage accounting is empty.
  • Preserve fail-closed behavior for malformed execution evidence, harness-started jobs, unreadable accounting, and ordinary successful runs.
  • Add regression coverage and a patch changeset.

Validation:

  • npx vitest run daily_aic_component_coverage.test.cjs (57 tests passed)
  • npm run typecheck
  • make agent-report-progress

Fixes #61312
Fixes #61137

Copilot AI balanced review requested due to automatic review settings September 16, 2026 08:27
@dsyme
dsyme merged commit 0fea86e into main Sep 16, 2026
21 checks passed
@dsyme
dsyme deleted the fix/daily-aic-legacy-accounting branch September 16, 2026 08:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Legacy evidence checks can bypass fail-closed signals and perform unnecessary artifact downloads.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Fixes legacy daily AI Credits accounting gaps that can cascade into blocked workflow runs.

Changes:

  • Handles missing accounting for failed agent jobs.
  • Recognizes legacy deterministic sample replays as zero-cost.
  • Adds regression tests and a patch changeset.
File Description
daily_aic_component_coverage.cjs Adds legacy zero-cost accounting paths.
check_daily_aic_workflow_guardrail.cjs Inspects legacy agent artifacts for execution evidence.
daily_aic_component_coverage.test.cjs Adds regression coverage.
.changeset/​patch-daily-aic-legacy-artifacts.md Documents the patch.

return {
artifactInspected: true,
preHarnessFailure: AWF_STARTUP_FAILURE_MARKER.test(logText) && !ENGINE_HARNESS_MARKER.test(logText),
sampleReplay: /"driver"\s*:\s*"apply_samples"/.test(logText),
logComponentAIC(runId, name, job, 0, "legacy_pre_harness_failure");
continue;
}
if (!selected && name === "agent" && job.conclusion === "success" && candidateStates[0].state === "empty" && legacyAgentEvidence?.sampleReplay) {
Comment on lines +240 to +248
for (const file of ["agent/token_usage.jsonl", "agent_usage.jsonl", "agent_usage.json"]) {
const accountingPath = path.join(downloadRoot, file);
if (!fs.existsSync(accountingPath)) continue;
try {
if (fs.readFileSync(accountingPath, "utf8").trim()) return noEvidence;
} catch {
return noEvidence;
}
}
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.89.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants