Repository navigation
Fix secure bootstrap for repo-memory daily AIC ledgers - #70358
Conversation
Use authoritative artifact accounting for confirmed-missing branches and while trusted ledger coverage matures. Preserve daily thresholds and fail-closed trust and quota checks. Co-authored-by: Copilot App <[email protected]>
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Verdict: approve
No actionable blocking issues found in the changed lines. The bootstrap path is fail-closed on untrusted clone outcomes, requires artifact access while coverage warms, and preserves mature trusted-ledger behavior. Static review only; repository tests were not executed.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · 3.49 AIC · ⌖ 0.534 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd (pr-triage: bug_fix). This fixes a real production deadlock (missing memory branch + untrusted orphan blocking the ledger writer) with a well-reasoned fix: artifact-backed bootstrap only fires after the clone step confirms the branch is absent, and a repository/workflow-scoped 24h coverage marker prevents a fresh ledger from masking recent spend.
📋 Key Themes & Highlights
Root cause addressed, not just symptom
The original deadlock was: no branch → untrusted ledger → guardrail fails closed → writer never runs → branch never gets created. The fix distinguishes "untrusted because corrupted/stale" from "confirmed absent" via the new GH_AW_DAILY_AIC_REPO_MEMORY_BRANCH_MISSING signal, which is only set true when the clone step's outcome == 'success' and cloned == 'false' — so transport/auth failures in clone_repo_memory_branch.sh still fail closed. That distinction is the crux of the fix and is correctly wired through pkg/workflow/compiler_activation_daily_aic.go into all three lock files.
Regression coverage is strong
daily_aic_spec_conformance.test.cjs adds a parametrized test across missing/legacy/warming/future/wrong_identity/malformed coverage states, plus dedicated tests for: 403/429 fail-closed, no-token-during-bootstrap, daily limit still enforced during bootstrap, and the specific skipped-AI-jobs scenario from the original incident. daily_aic_repo_memory_ledger.test.cjs covers coverage-path identity isolation and unreadable-metadata-surfaces-as-error (rather than silently falling back to ledger-only accounting) — exactly the kind of failure-path instrumentation /diagnosing-bugs asks for.
Fail-closed semantics preserved
The untrusted-orphan case (ledger present but branch unconfirmed) still requires artifact accounting even with mature-looking coverage metadata, since the coverage marker is only trusted when trustedLedger is true, not merely because a coverage file exists on disk.
Minor nit (non-blocking)
Left one inline comment on daily_aic_repo_memory_ledger.cjs about initializeLedgerCoverage doing a full read+parse purely to check existence on every ledger append — harmless today, just flagging so it doesn't get "simplified" into a raw existence check that skips identity validation.
Positive highlights
- ✅ Spec and docs (ai-credits-specification.md, cost-management.md) updated in the same PR to describe the new bootstrap/coverage contract
- ✅ No new permissions, no insecure-override defaults, no workflow settings changes — scope stayed tight
- ✅ Coverage identity hashing (sha256 of repository + workflowId) correctly isolates per-repo/per-workflow state, with a test asserting path separation
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 109.1 AIC · ⌖ 17.1 AIC · ⊞ 10.1K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
Persistence filters can discard coverage metadata or usage shards, preventing reliable transition to ledger accounting.
1 open issue
What changed in this PR
Enables secure bootstrap for repo-memory daily AI Credits accounting without treating a missing ledger as zero usage.
Changes:
- Uses artifact accounting until trusted ledger coverage reaches 24 hours.
- Adds bootstrap, coverage migration, and compiler regression tests.
- Updates documentation, three workflow locks, and release notes.
| File | Description |
|---|---|
pkg/workflow/daily_aic_workflow_guardrail_test.go |
Verifies the missing-branch signal. |
pkg/workflow/compiler_activation_daily_aic.go |
Emits the confirmed-missing-branch signal. |
docs/src/content/docs/specs/ai-credits-specification.md |
Defines bootstrap and coverage requirements. |
docs/src/content/docs/reference/cost-management.md |
Documents bootstrap and recompilation. |
actions/setup/js/daily_aic_spec_conformance.test.cjs |
Covers bootstrap decisions and failures. |
actions/setup/js/daily_aic_scan.test.cjs |
Supplies mature coverage for ledger tests. |
actions/setup/js/daily_aic_repo_memory_ledger.test.cjs |
Tests coverage identity and persistence. |
actions/setup/js/daily_aic_repo_memory_ledger.cjs |
Writes and validates coverage metadata. |
actions/setup/js/check_daily_aic_workflow_guardrail.test.cjs |
Tests mature-ledger acceptance. |
actions/setup/js/check_daily_aic_workflow_guardrail.cjs |
Selects artifact or ledger accounting. |
.github/workflows/daily-community-attribution.lock.yml |
Wires the bootstrap signal. |
.github/workflows/daily-code-metrics.lock.yml |
Wires the bootstrap signal. |
.github/workflows/daily-cli-performance.lock.yml |
Wires the bootstrap signal. |
.changeset/patch-repo-memory-aic-bootstrap.md |
Adds a patch release note. |
Review effort: Max
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 7d4642b
|
…bble Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
Original comment: Accepted as informational; the linked code quality review found no actionable blocking issue and explicitly says it was static-only. No code change is needed for this notice, and it is not being treated as evidence that tests passed. |
|
Original comment: Accepted as informational; the linked skills review approves the change, and its minor inline nit is already addressed and resolved in the separate review thread. This completion notice requires no additional code change. |
|
Original comment: Accepted as a status report only; it contains no actionable recommendation, so no code change follows from it. The |
|
Original comment: Accepted as a status report only; no ADR draft or requested design change is supplied, so no ADR or tooling change is warranted. The completion status alone does not establish that all intended work succeeded. |
|
Original comment: Accepted as informational; no specific test defect or requested coverage change is provided, so this notice requires no additional test change. Its |
Gate the selected ledger memory's filter exemption on successful compiler-owned sanitation. Preserve restrictive filters for ordinary memories and cover trusted persistence and forged-ledger removal. Co-authored-by: Copilot App <[email protected]>
|
Original comment: Merged the latest fetched main (e659ac3) and pushed the review batch in c01a2f6. Both inline findings are answered and resolved; all five informational notices received individual responses. The persistence exception now applies only to the selected trusted daily-AIC writer after successful removal of agent-supplied ledger files. Ordinary memories retain their filters, and existing size/count/patch limits are unchanged. Added restrictive-filter persistence and forged-ledger sanitation regressions. Local validation passed: focused Go regressions, 373 JavaScript tests, formatting/lint/custom analyzers, and the final pre-PR gate with all 344 workflow locks in sync. CI on the new head has not been evaluated. No workflow dispatches or CI reruns were requested, no insecure override or budget relaxation was enabled, and the PR remains open and ready for review. |
|
🎉 This pull request is included in a new release. Release: |

Summary
Fix the activation deadlock seen in Daily Code Metrics run 39304180678, where the memory branch was missing, the local orphan remained untrusted, and activation prevented the downstream writer from creating the branch.
backend: repo-memory. A successful clone step that explicitly confirms branch absence now authorizes artifact-backed accounting, not trust in the orphan or an assumption of zero usage.Existing workflows must be recompiled after upgrading to receive the confirmed-missing-branch signal. Existing mature-ledger completeness limitations are unchanged.
Validation
make agent-report-progresspassed using installed Bash 5, including impacted tests and drift validation across all 344 workflows.No workflow dispatch/rerun or repository settings change was performed. Production recovery remains to be observed after deployment.