Skip to content

Trust repo-memory ledgers in the daily AIC guardrail - #65879

Merged
pelikhan merged 10 commits into
mainfrom
copilot/aw-top-10-resolve-untrusted-aic-ledger
Oct 5, 2026
Merged

pelikhan merged 10 commits into
mainfrom
copilot/aw-top-10-resolve-untrusted-aic-ledger

Conversation

Copilot AI commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Daily AIC guardrails blocked both affected scheduled workflows because they treated repo-memory ledgers as untrusted, despite the ledger being cloned before activation.

  • Trust provenance: The compiler marks repo-memory trusted only for the guardrail step that follows the required clone.
  • Preserve opt-in: Ledgers without that signal remain blocked unless the explicit insecure override is enabled; its default remains false.
  • Regression coverage: Verify normal ledger-writer output is accepted and the clone precedes guardrail evaluation.
const trustedLedger = process.env.GH_AW_DAILY_AIC_REPO_MEMORY_TRUSTED === "true";
const allowInsecureLedger = process.env.GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC === "true";

if (!trustedLedger && !allowInsecureLedger) {
  // Fail closed
}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix untrusted AIC ledger issue blocking daily workflows Trust repo-memory ledgers in the daily AIC guardrail Oct 5, 2026
Copilot AI requested a review from pelikhan October 5, 2026 15:18
@pelikhan
pelikhan marked this pull request as ready for review October 5, 2026 15:24
Copilot AI balanced review requested due to automatic review settings October 5, 2026 15:24

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

Clone failures can produce an empty directory that is incorrectly marked trusted, allowing the guardrail to fail open.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Allows daily AIC guardrails to trust repo-memory ledgers cloned during activation while retaining the insecure opt-in fallback.

Changes:

  • Adds compiler-generated ledger trust provenance.
  • Updates guardrail trust handling.
  • Adds regression and workflow-generation coverage.
File Description
pkg/​workflow/​compiler_activation_daily_aic.go Emits the trust signal.
pkg/​workflow/​daily_aic_workflow_guardrail_test.go Verifies trust signal and step ordering.
actions/​setup/​js/​check_daily_aic_workflow_guardrail.cjs Accepts trusted ledgers.
actions/​setup/​js/​check_daily_aic_workflow_guardrail.test.cjs Tests writer-produced trusted ledgers.
.github/​workflows/​daily-community-attribution.lock.yml Regenerates workflow with trust signal.
.github/​workflows/​daily-code-metrics.lock.yml Regenerates workflow with trust signal.
.github/​workflows/​daily-cli-performance.lock.yml Regenerates workflow with trust signal.

}
if data.MaxDailyAICBackend == maxDailyAICBackendRepoMemory {
steps = append(steps, " GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC: ${{ vars.GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC || 'false' }}\n")
steps = append(steps, " GH_AW_DAILY_AIC_REPO_MEMORY_TRUSTED: \"true\"\n GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC: ${{ vars.GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC || 'false' }}\n")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f48f8b3: the clone step verifies branch existence with authenticated git ls-remote; only a confirmed missing branch falls back to an orphan, while transport, authentication, and clone failures exit nonzero. The guardrail trusts only a reported successful clone.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #65879

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Design Decision Gate 🏗️ is checking for design decision records on this pull request...

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-05T15:41:22Z
review_event: REQUEST_CHANGES
top_themes:
  - repo-memory trust is not tied to successful authenticated clone provenance
files_reviewed:
  - .github/workflows/daily-cli-performance.lock.yml
  - .github/workflows/daily-code-metrics.lock.yml
  - .github/workflows/daily-community-attribution.lock.yml
  - actions/setup/js/check_daily_aic_workflow_guardrail.cjs
  - actions/setup/js/check_daily_aic_workflow_guardrail.test.cjs
  - pkg/workflow/compiler_activation_daily_aic.go
  - pkg/workflow/daily_aic_workflow_guardrail_test.go
comment_count: 0

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 40.7 AIC · ⌖ 5.28 AIC · ⊞ 19.6K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Request changes

The repo-memory trust bit is still disconnected from actual clone success, so a token/network/server failure can leave an empty or orphan ledger while the guardrail accepts it as trusted and undercounts prior runs.

Why this is still blocking

buildActivationDailyAICGuardrailStep sets GH_AW_DAILY_AIC_REPO_MEMORY_TRUSTED: "true" for every repo-memory workflow up front, but clone_repo_memory_branch.sh intentionally treats any git clone failure as recoverable and falls back to creating an orphan repo or empty directory. That means check_daily_aic_workflow_guardrail.cjs cannot distinguish verified branch clone success from local empty-state fallback, so the workflow can proceed under budget even when the historical ledger was never authenticated.

I am not adding another inline comment because there is already an open thread on the exact changed line, but that issue remains merge-blocking until trust is derived from a positive clone-success signal instead of compile-time configuration.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 40.7 AIC · ⌖ 5.28 AIC · ⊞ 19.6K
Comment /review to run again

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /diagnosing-bugs — requesting changes on an unguarded trust signal.

📋 Key Themes & Highlights

Key Themes

  • Root cause only partially addressed: the PR's goal is "trust the ledger only after a verified clone," but the generated GH_AW_DAILY_AIC_REPO_MEMORY_TRUSTED: "true" is unconditional — it does not actually check that the clone step succeeded with real data vs. silently falling back to an orphan branch on any clone failure (network, token, server errors). This is the same concern already raised by the existing automated review comment on pkg/workflow/compiler_activation_daily_aic.go:144; my inline comment extends it with a concrete implementation path (step output + if: gate, following the existing pattern in cache_memory.go:274).
  • Regression test asymmetry: the new JS test (check_daily_aic_workflow_guardrail.test.cjs) and Go test (daily_aic_workflow_guardrail_test.go) both verify the happy path (trusted ledger accepted, clone precedes guardrail) but neither exercises the failure path (clone fails → ledger should remain untrusted). Given this PR's entire purpose is correcting trust semantics, a negative test is the most valuable missing coverage.

Positive Highlights

  • ✅ Compile-time coupling is solid: maxDailyAICBackendRepoMemory always requires tools.repo-memory (daily_aic_workflow.go:284), so the clone step and the trust env var can never be emitted independently of each other.
  • ✅ Step ordering is correctly verified by the new Go test (clone step index precedes guardrail check index in the generated lock file).
  • ✅ The opt-in GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC fallback is preserved for operators who need it, keeping the fail-closed default intact for untrusted paths.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 86.6 AIC · ⌖ 13.6 AIC · ⊞ 10.1K
Comment /matt to run again

}
if data.MaxDailyAICBackend == maxDailyAICBackendRepoMemory {
steps = append(steps, " GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC: ${{ vars.GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC || 'false' }}\n")
steps = append(steps, " GH_AW_DAILY_AIC_REPO_MEMORY_TRUSTED: \"true\"\n GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC: ${{ vars.GH_AW_ALLOW_INSECURE_REPO_MEMORY_AIC || 'false' }}\n")

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.

[/diagnosing-bugs] Building on the existing review comment: the real root cause is that the clone step has no id: and no output distinguishing "real clone succeeded" from "clone failed, orphan created." Trust is set unconditionally here with no gate on the clone's result.

💡 Suggested fix

In clone_repo_memory_branch.sh, emit a step output (e.g. echo "cloned=true" >> "$GITHUB_OUTPUT" on the success branch, cloned=false otherwise), give the clone step an id: in buildDailyAICRepoMemoryCloneStep, and gate this line with if: steps.<clone-id>.outputs.cloned == 'true' (mirroring the steps.<id>.outcome == 'success' pattern already used in cache_memory.go:274). Also add a regression test asserting the guardrail stays untrusted/fails-closed when the clone step fails or falls back to orphan creation — today's new test only covers the already-trusted happy path.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implemented in f48f8b3: the clone step now has an ID and emits a cloned output, and guardrail trust is conditioned on that output. Regression tests cover verified missing branches, successful clones, clone failures, and remote verification failures.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/compiler_activation_daily_aic.go:144): This marks the ledger trusted even when no authenticated clone was obtained. clone_repo_memory_branch.sh converts every git clone failure—including token, network, or server failures—into an empty directory/orphan branch and exits successfully (lines 124–149), so the following guardrail now reads zero entries and permits the agent to run. Please derive this signal from a clone path that distinguishes a verified missing branch from transport/authentication errors, and fail closed for unclassified clone failures. - Trust repo-memory ledgers in the daily AIC guardrail #65879 (comment)
  3. Review (pkg/workflow/compiler_activation_daily_aic.go:144): [/diagnosing-bugs] Building on the existing review comment: the real root cause is that the clone step has no id: and no output distinguishing "real clone succeeded" from "clone failed, orphan created." Trust is set unconditionally here with no gate on the clone's result. - Trust repo-memory ledgers in the daily AIC guardrail #65879 (comment)
  4. Fix failing check agent (FAILURE): https://github.com/github/gh-aw/actions/runs/37332633997/job/111846694073.
  5. Fix failing check conclusion (FAILURE): https://github.com/github/gh-aw/actions/runs/37332633997/job/111855005124.
  6. Fix failing check conclusion (FAILURE): https://github.com/github/gh-aw/actions/runs/37332633936/job/111849464546.
  7. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/37332634327/job/111845847951.
  8. Fix failing check impacted-go-tests (FAILURE): https://github.com/github/gh-aw/actions/runs/37330957941/job/111840277261.

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: 261f0d1
Sous-chef work: 1234fa2c492e295ec4c48e6b5ab23b6398d4da1cf190fbb4b52a7302b402972f 34f38971738f6a752a646bd7797a6c8d47fb096e4eb6f91e946a91255433c8c4 42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac 51e2287c3d1ee41b7e13769862add61dcd292a623cf943abc5968c984e246bcf d99bbf93feb6a5b8ddeeef577a59fd75356582a6cc93e99e9300569d26f35a76
Sous-chef state: 2b499ba3b899f6b857e0697bb8eae7a8703f0b5a8a485f0124b3360fd081ea59

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 3.79 AIC · ⌖ 6.87 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 5, 2026 16:37
…olve-untrusted-aic-ledger

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 5, 2026 17:00
@pelikhan

pelikhan commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Copilot AI and others added 2 commits October 5, 2026 17:27
…olve-untrusted-aic-ledger

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes....

Merged the latest main with make merge-main and pushed 0e601b2. The clone step verifies the branch with authenticated git ls-remote, emits trust only after a successful clone, and fails closed on unclassified errors; clone regression coverage passes. I also fixed the impacted-Go test failure by narrowing its Node check to executable invocations. make lint and make agent-report-progress pass. The earlier agent-review failure was an agentic_engine_timeout, not locally reproducible; CI on this pushed head still needs a human-triggered rerun.

@copilot fix https://github.com/github/gh-aw/actions/runs/37344606213/job/111888804605?pr=65879

Fixed in 0e601b2: the failing Go assertion now distinguishes an actual Node executable invocation from the script's command -v node availability check. The targeted test and final impacted-test gate pass locally. CI on the pushed head is stale and needs a maintainer-triggered rerun.

@pelikhan

pelikhan commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/github/gh-aw/actions/runs/37351678152/job/111903970402?pr=65879

Fixed in 533adf8: the failing test now correctly rejects a conditional expression for concurrency.queue, which only accepts single or max. make agent-report-progress passes locally.

@pelikhan

pelikhan commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

@pelikhan

pelikhan commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

1 similar comment
@pelikhan

pelikhan commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

…olve-untrusted-aic-ledger

# Conflicts:
#	pkg/workflow/notify_comment_test.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflict with latest main and pushed merge commit e1d3cea.

@pelikhan
pelikhan merged commit 52ae271 into main Oct 5, 2026
43 checks passed
@pelikhan
pelikhan deleted the copilot/aw-top-10-resolve-untrusted-aic-ledger branch October 5, 2026 19:04
Copilot stopped work on behalf of pelikhan due to an error October 5, 2026 19:04
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AW Top 10] 10 Resolve untrusted AIC ledger blocking daily workflows

4 participants