Skip to content

Fix activation snapshots for symlinked agent configuration - #80390

Merged
pelikhan merged 6 commits into
mainfrom
copilot/fix-agent-folder-symlinks
Nov 24, 2026
Merged

pelikhan merged 6 commits into
mainfrom
copilot/fix-agent-folder-symlinks

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Activation can fail when an agent configuration symlink points to a repository path omitted by the sparse checkout.

  • Checkout: Use a full, shallow checkout when saving a trusted base snapshot; retain sparse checkout otherwise.
  • Trust boundary: Preserve base-ref selection, credential handling, and symlink confinement during snapshot and restore.
  • Coverage: Add regression coverage for linked skills and both checkout modes.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan pelikhan changed the title [WIP] Fix activation failure due to agent folder symlinks Fix activation snapshots for symlinked agent configuration Nov 23, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 23, 2026 14:07
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 14:07
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

❌ Test Quality Sentinel failed during test quality analysis.

Incomplete work

Test Quality Sentinel could not review tests because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.4K · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #80390 · copilot · gpt56 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.8K · history

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 23, 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 · copilot · routed: haiku55 xhigh · ~12 AIC · ⌖ ~2 AIC · ⊞ 6.8K · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Lean already. Ship.

Generated by Ponytail Reviewer for #80390 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 176 · history

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

The [aw] No-Op Runs tracker omits agent messages. The category uses structured run status, not interpretation of agent prose.

No-op message

Completed PR #80390 code review: submitted one unified no-findings review, recorded the review-history outcome, and posted no inline comments.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K · history

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines in business-logic directories) but does not have a linked Architecture Decision Record (ADR). It Fixes #80360, where activation fails when an agent folder symlinks to a path outside the sparse checkout.

📄 Draft ADR committed: docs/adr/80390-full-shallow-activation-checkout-for-symlink-snapshots.md. Review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.

  2. Complete the missing sections. Add context the AI could not infer, refine the decision rationale, and list the real alternatives you considered.

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-80390: Use a Full Shallow Activation Checkout for the Base Snapshot (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify that the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide? Why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files named by PR number (for example, 80390-use-postgresql.md for PR #80390).

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.6K · history
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.

Reviewed PR head 26406eca609f998fea96fc441b7f2808e1077695 against Checkout Behavior Specification v1.3.4, requirements §3.3 and §5.3, and compliance coverage T-CHK-017. The implementation and tests intentionally change trusted base snapshot activation to a full shallow checkout while preserving base-ref selection, credential isolation, and symlink confinement.

Synchronized docs/src/content/docs/specs/checkout-behavior-specification.md to v1.3.5: clarified full snapshot versus sparse non-snapshot behavior, preserved repository-root confinement, and added T-CHK-022 for mode-dependent checkout and linked-skill materialization. The specification commit was queued to the same-repository PR branch. No blocking contract violations found.

Generated by PR Specification Reviewer for #80390 · copilot · gpt50 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.8K
Comment /review-specs to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-0c2e76bb-44a5-4e39-b42a-9add9934ee82","parents":[],"payload":{"id":"ldg-f8464d7f-00b9-4eb7-9b8e-1249d35bc353","operation":"append","value":{"finding_count":0,"head_sha":"26406eca609f998fea96fc441b7f2808e1077695","outcome":"updated"}},"sha":"sha256:a8d58de8129a4e62012341d6a37daf34788e68ec673964167231d3767bac594f","timestamp":"2026-11-23T14:15:48.180Z","type":"ledger_append","version":1}
History

@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.

No actionable correctness or maintainability findings on the changed lines. The full-checkout behavior is consistent with the stated requirement to snapshot trusted base configuration with symlink targets available; the specialist suggestions do not establish a merge-blocking defect in this diff.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-fa38521a-9f69-4e35-ba73-8736f69b925d","parents":[],"payload":{"id":"ldg-e435f155-5a0b-42e5-859c-40739288ac79","operation":"append","value":{"finding_count":0,"head_sha":"26406eca609f998fea96fc441b7f2808e1077695","outcome":"no_findings"}},"sha":"sha256:5b0d1d122119fe489f5e1487b01a70cbb2e5b92bfa98607fcb729c0b89116270","timestamp":"2026-11-23T14:16:51.994Z","type":"ledger_append","version":1}
History

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.

🟡 Changes recommended

The activation checkout name collides with agent-checkout detection, causing test failures, while snapshot gating still forces unnecessary full checkouts for workflows that never restore a snapshot.

2 open issues
What changed in this PR

Updates the workflow compiler’s activation checkout so trusted configuration snapshots can resolve symlink targets outside the sparse checkout, addressing #80360.

Changes:

  • Use full, shallow checkouts for base snapshots while retaining sparse checkout otherwise.
  • Add linked-skill snapshot/restore and checkout-mode regression coverage.
  • Update checkout documentation and compiler golden fixtures.
File Description
pkg/​workflow/​testdata/​TestWasmGolden_CompileFixtures/​with-imports.golden Updates snapshot checkout expectations for imports.
pkg/​workflow/​testdata/​TestWasmGolden_CompileFixtures/​smoke-copilot.golden Updates full checkout while retaining PR base pinning.
pkg/​workflow/​testdata/​TestWasmGolden_CompileFixtures/​playwright-cli-mode.golden Updates snapshot checkout expectations for Playwright mode.
pkg/​workflow/​testdata/​TestWasmGolden_CompileFixtures/​custom-safe-output-max-length.golden Refreshes snapshot checkout output.
pkg/​workflow/​testdata/​TestWasmGolden_CompileFixtures/​basic-copilot.golden Updates basic Copilot snapshot checkout.
pkg/​workflow/​testdata/​TestWasmGolden_AllEngines/​pi.golden Updates Pi snapshot checkout.
pkg/​workflow/​testdata/​TestWasmGolden_AllEngines/​gemini.golden Updates Gemini snapshot checkout.
pkg/​workflow/​testdata/​TestWasmGolden_AllEngines/​copilot.golden Updates Copilot snapshot checkout.
pkg/​workflow/​testdata/​TestWasmGolden_AllEngines/​codex.golden Updates Codex snapshot checkout.
pkg/​workflow/​testdata/​TestWasmGolden_AllEngines/​claude.golden Updates Claude snapshot checkout.
pkg/​workflow/​runtime_import_checkout_test.go Checks full snapshot checkout for runtime imports.
pkg/​workflow/​compiler_jobs_steps_test.go Updates activation checkout ordering expectations.
pkg/​workflow/​compiler_builtin_presteps_test.go Updates pre-step ordering for the renamed checkout.
pkg/​workflow/​compiler_activation_steps.go Selects checkout mode from snapshot eligibility.
pkg/​workflow/​compiler_activation_steps_test.go Updates snapshot-step assertions.
pkg/​workflow/​compiler_activation_job.go Passes checkout mode through existing ref/token handling.
pkg/​workflow/​compiler_activation_job_test.go Adds checkout-mode cases and updates helper calls.
pkg/​workflow/​compiler_activation_checkout_test.go Verifies full snapshots without persisted credentials.
pkg/​workflow/​checkout_step_generator.go Supports full and sparse activation checkouts.
docs/​src/​content/​docs/​specs/​checkout-behavior-specification.md Specifies snapshot-dependent activation checkout behavior.
docs/​src/​content/​docs/​reference/​checkout.md Explains full versus sparse activation checkout.
actions/​setup/​sh/​base_github_folders_test.cjs Tests restoration of linked skills from trusted snapshots.

Review effort: Max (adaptive)

Comment thread pkg/workflow/checkout_step_generator.go Outdated

sb.WriteString(" - name: Checkout .github and .agents folders\n")
if fullCheckout {
sb.WriteString(" - name: Checkout repository for base branch snapshot\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.

Fixed in e618556: the activation checkout has a distinct name. The pre-step and checkout optimization tests pass.

ctx.steps = append(ctx.steps, checkoutSteps...)
stageCopilotSDKAgents := data.EngineConfig != nil && data.EngineConfig.CopilotSDK
if len(checkoutSteps) > 0 && (!isPRCheckoutDisabled(data) || dynamicWorkflowsEnabled(ctx.engine, data.EngineConfig) || stageCopilotSDKAgents) {
saveBase := !isPRCheckoutDisabled(data) || dynamicWorkflowsEnabled(ctx.engine, data.EngineConfig) || stageCopilotSDKAgents

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.

Fixed in e618556: snapshot saving and full checkout now share the restore predicate, with SDK staging included.

@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 and /tdd (pr-triage classified this as a bug fix). Requesting changes because the compiler output change leaves every committed activation lock stale.

📋 Key Themes & Highlights

Key Themes

  • Stale generated locks: compiling this head rewrites 370 .lock.yml files, and the PR regenerates none. The PR-triggered CI does not run the drift check, but a push to main that touches pkg/** does run it, so it would fail after merge.
  • Symlink coverage gap: the sparse path still only scans three fixed directories, so symlink targets outside them are still missed.
  • Weak test: the new .cjs regression test exercises unchanged shell scripts and does not guard the Go change.
  • Fragile assertions: some tests slice YAML text on indentation.

Verified

  • TestActivationSnapshotCheckoutIncludesSymlinkTargets passes.
  • All 15 tests in base_github_folders_test.cjs pass.
  • The 3 workflows that fail to compile (deep-report, go-pattern-detector, mcp-inspector) fail on npm registry certificate errors in this sandbox, not because of the PR.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~12 AIC · ⌖ ~2 AIC · ⊞ 6.8K
Comment /matt to run again

assert.NotContains(t, activationJobSection, "name: Checkout repository", "Should not have a full repository checkout step")
// The trusted snapshot needs the complete base tree to resolve symlink targets.
require.Contains(t, activationJobSection, "name: Checkout repository for base branch snapshot")
checkout := strings.SplitN(strings.SplitN(activationJobSection, "name: Checkout repository for base branch snapshot", 2)[1], "\n - name:", 2)[0]

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.

[/tdd] Splitting the job text on the step-name marker and the next - name: depends on exact YAML indentation and step order. A reformat or an extra step breaks this assertion even without a real regression.

Parse the activation job YAML and select the step by its name instead.

@copilot please address this.

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.

Fixed in e618556: the test parses the workflow YAML and selects the activation step by name.

assert.equal(execution.stdout.trim(), "ok");
});

test("save: materializes skills linked outside agent folders before PR checkout", t => {

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.

[/tdd] This test drives only save_base_github_folders.sh, and this PR does not change that script. It would also pass against the base commit, so it does not guard the Go checkout change. The Go test TestActivationSnapshotCheckoutIncludesSymlinkTargets is the real regression test.

💡 Suggested fix

Remove this test, or rename it so it reads as a save-script behavior spec and does not claim to cover checkout ordering.

@copilot please address this.

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.

Fixed in e618556: the shell test is named as a save-and-restore behavior test; checkout regression coverage remains in the Go test.

compilerActivationJobLog.Print("Adding .github, .agents, and engine-specific dirs to sparse checkout for activation job")
return cm.GenerateGitHubFolderCheckoutStep("", activationCheckoutRef(data, "github.sha"), activationToken, c.getActionPin, extraPaths...)
compilerActivationJobLog.Printf("Adding activation checkout: full=%t", fullCheckout)
return cm.generateActivationCheckoutStep("", activationCheckoutRef(data, "github.sha"), activationToken, c.getActionPin, fullCheckout, extraPaths...)

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.

[/codebase-design] resolveSymlinkExtraPaths still scans only .github/agents, .github/skills, and .github/prompts. The sparse path (saveBase == false) therefore still misses symlink targets outside those folders, such as per-skill links inside a real .agents/skills/ tree. The new comment says symlink targets must be fetched, but this branch does not do that.

💡 Suggested fix

Either route symlink-bearing configs through the full checkout, or extend the scan to every symlink under the sparse-checked folders. If activation never reads those targets on this path, document that in the comment.

@copilot please address this.

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.

Fixed in e618556: sparse checkout scans nested symlinks in configuration and extra paths, with repository confinement and regression coverage.

Comment thread pkg/workflow/checkout_step_generator.go Outdated

sb.WriteString(" - name: Checkout .github and .agents folders\n")
if fullCheckout {
sb.WriteString(" - name: Checkout repository for base branch snapshot\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] This PR changes compiler output for every activation job, but none of the 370 committed .lock.yml files are regenerated. Compiling ab-testing-advisor.md on this head rewrites its lock: the step name changes and the sparse-checkout block is removed. CI check-workflow-drift will fail on push to main until make recompile is run and the locks are committed.

💡 Verification

I compiled all workflows on this head and 370 tracked lock files changed. The PR touches no lock files, so the stored output is stale.

@copilot please address this.

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.

Regenerated in e618556 and verified again after merging main in c1e1ce84. Full package validation is currently blocked by npm registry DNS; compilation without that external validation succeeded.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/checkout_step_generator.go:262): address unresolved feedback - Review comment
  3. Review (pkg/workflow/compiler_activation_steps.go:175): address unresolved feedback - Review comment
  4. Review (pkg/workflow/compiler_activation_checkout_test.go:119): address unresolved feedback - Review comment
  5. Review (actions/setup/sh/base_github_folders_test.cjs:156): address unresolved feedback - Review comment
  6. Review (pkg/workflow/compiler_activation_job.go:451): address unresolved feedback - Review comment
  7. Review (pkg/workflow/checkout_step_generator.go:262): address unresolved feedback - Review comment
  8. Fix failing check Fast unit tests (N-R) (FAILURE): Check run.
  9. Fix failing check impacted-go-tests (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "053eefbeb9eac87307ae71d14525a9fc8557f5e5",
  "kind": "requested",
  "schema_version": "1",
  "state": "48f7d3f9532f7525b447509389da09e70600de60319d25a28fe265066c9adb1e",
  "work": [
    "00c67337de75cbb14e7e442f3cd0c94ae2f69d353cccd0b2cd3b3a7b77eb9ebc",
    "27425e0e4db5588b43dad3f80bdec3198af1ba8c43811054ce7c5ae0adf369e0",
    "36e076c28e0e06d5330da117de3948e76bcdebf7d93004eb02987b761024a0ea",
    "3c1b3fdf88de0357818b2f24752d6e38d0ca576ae0e3ccd34f16be5284a50c64",
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac",
    "9450faf1e4ff9b3315e8e1e8d65e2367a6d9d2999b52f1d9f957dc88d380bc28",
    "b77d07d26e864a24aacc064374c789ed2c3ec9eea8238314683244d46525a736",
    "e36728481b4ae4ee1503f6cd0ad01254eda77ffba7c3fc3573848a1188950f24"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 7K · history
Comment /souschef to run again

…der-symlinks

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator Author

@copilot merge main and recompile

…der-symlinks

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

@copilot merge main and recompile

Merged main in c1e1ce8. All 371 workflows compiled; full validation was blocked by npm registry DNS.

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged main in c1e1ce8; review fixes are in e618556. Targeted tests pass. Compilation succeeded without external package validation; the full gate reports npm DNS and custom-linter failures.

@pelikhan
pelikhan merged commit fdcb952 into main Nov 24, 2026
93 checks passed
@pelikhan
pelikhan deleted the copilot/fix-agent-folder-symlinks branch November 24, 2026 06:13
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.

Activation fails when an agent folder symlinks to a path outside the sparse checkout

4 participants