Skip to content

feat: Reimplement APM artifact pack/unpack support (#20385)#20564

Merged
pelikhan merged 4 commits intomainfrom
copilot/reimplement-apm-artifact-support
Mar 11, 2026
Merged

feat: Reimplement APM artifact pack/unpack support (#20385)#20564
pelikhan merged 4 commits intomainfrom
copilot/reimplement-apm-artifact-support

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

Reimplements the APM dependency resolution improvements from PR #20385.

APM dependencies were previously resolved at agent-job runtime — slow, network-dependent, and non-deterministic across retries. This moves resolution to the activation job (pack) and unpacking to the agent job (restore) via a separate apm artifact.

New compilation output

Activation job — pack step + artifact upload:

- name: Install and pack APM dependencies
  id: apm_pack
  uses: microsoft/apm-action@
  with:
    dependencies: |
      - microsoft/apm-sample-package
    isolated: 'true'
    pack: 'true'
    archive: 'true'
    target: copilot          # inferred from engine
    working-directory: /tmp/gh-aw/apm-workspace

- name: Upload APM bundle artifact
  uses: actions/upload-artifact@
  with:
    name: apm
    path: ${{ steps.apm_pack.outputs.bundle-path }}
    retention-days: 1

Agent job — download + restore:

- name: Download APM bundle artifact
  uses: actions/download-artifact@
  with:
    name: apm
    path: /tmp/gh-aw/apm-bundle

- name: Restore APM dependencies
  uses: microsoft/apm-action@
  with:
    bundle: /tmp/gh-aw/apm-bundle/*.tar.gz
    isolated: 'true'   # only when frontmatter isolated: true

Changes

  • APMDependenciesInfo — adds Isolated bool field
  • extractAPMDependenciesFromFrontmatter — adds object format support alongside existing array format:
    dependencies:
      packages:
        - microsoft/apm-sample-package
      isolated: true   # clears .github/ primitive dirs before unpack
  • apm_dependencies.go — replaces GenerateAPMDependenciesStep with GenerateAPMPackStep and GenerateAPMRestoreStep
  • WorkflowExecutor interface — adds GetAPMTarget() string method; BaseEngine defaults to "all", CopilotEngine returns "copilot", ClaudeEngine returns "claude"; the APM target is inferred from the engine at compile time
  • compiler_activation_job.go — emits pack step (using engine.GetAPMTarget()) and separate apm artifact upload after prompt generation
  • compiler_yaml_main_job.go — replaces old install step with artifact download + restore
  • frontmatter.md — documents new object format and pack/unpack behavior
  • smoke-claude.md — adds microsoft/apm-sample-package as an APM dependency to exercise the pack/restore path in the smoke test workflow

Changeset

  • Type: patch
  • Description: Package APM dependencies during activation and restore them via the apm artifact so agent jobs use a deterministic dependency bundle.


✨ PR Review Safe Output Test - Run 22970861289

💥 [THE END] — Illustrated by Smoke Claude ·

Copilot AI and others added 2 commits March 11, 2026 18:12
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions
Copy link
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions
Copy link
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.53.0
jq 1.7
yq v4.52.4
curl 8.5.0
gh 2.87.3
node v20.20.0
python3 3.12.3
go 1.24.13
java 10.0.102
dotnet 10.0.102

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions
Copy link
Contributor

Smoke Test (Codex)

PRs: #20569 [docs] Self-healing documentation fixes from issue analysis - 2026-03-11; #20566 [ca] fix: update test expectations for actions/download-artifact v8.0.1
GitHub MCP (2 merged PRs): ✅
Serena MCP (activate + >=3 symbols): ✅
Playwright (github.com title contains "GitHub"): ✅
Web Fetch (github.com contains "GitHub"): ✅
File writing (/tmp/gh-aw/agent/...): ✅
Bash verification (cat): ✅
Build gh-aw (GOCACHE=/tmp/go-cache GOMODCACHE=/tmp/go-mod make build): ✅
Overall status: PASS

🔮 The oracle has spoken through Smoke Codex ·

Warning

⚠️ Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

@pelikhan pelikhan marked this pull request as ready for review March 11, 2026 19:41
Copilot AI review requested due to automatic review settings March 11, 2026 19:41
@github-actions
Copy link
Contributor

Commit pushed: c5e5433

Generated by Changeset Generator

@github-actions
Copy link
Contributor

Smoke Test Results - Run §22970861289

Test Status
1 GitHub MCP
2 mcpscripts-gh
3 Serena MCP
4 Make Build
5 Playwright
6 Tavily Search
7 File Writing
8 Bash Tool
9 Discussion Query
10 Agentic Workflows MCP
11 Update PR
12 PR Review Comments
13 Submit PR Review
14 Resolve Thread ⚠️ skipped
15 Add Reviewer
16 Push to Branch
17 Close PR ⚠️ skipped

Overall: PARTIAL (15 passed, 2 skipped, 0 failed)

💥 [THE END] — Illustrated by Smoke Claude ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

💥 Automated smoke test review - all systems nominal!

💥 [THE END] — Illustrated by Smoke Claude


// GetAPMTarget returns the APM target value to use when packing dependencies with
// microsoft/apm-action. Supported values are "copilot", "claude", and "all".
// The default implementation returns "all" (packs all primitive types).
Copy link
Contributor

Choose a reason for hiding this comment

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

The GetAPMTarget() interface method is well-placed. Consider adding a note in the godoc that "all" packs every primitive type, which may result in larger bundles compared to engine-specific targets.

// GenerateAPMRestoreStep generates the GitHub Actions step that restores APM packages
// from a pre-packed bundle in the agent job.
//
// Parameters:
Copy link
Contributor

Choose a reason for hiding this comment

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

The GenerateAPMRestoreStep cleanly separates restore logic from pack logic. The wildcard *.tar.gz in the bundle path is flexible — worth verifying behavior when multiple .tar.gz files exist in the directory.

@github-actions
Copy link
Contributor

Smoke Test: Copilot - 22970861231

Test Status
GitHub MCP
MCP Scripts GH CLI
Serena MCP
Playwright
Web Fetch
File Writing
Bash Tool
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: ⚠️ PARTIAL PASS
@copilot-swe-agent

📰 BREAKING: Report filed by Smoke Copilot ·

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

APM pack/unpack support looks well-structured. Two inline comments left on smoke-claude.md and the frontmatter docs. Overall the change is clean — documentation updates match the implementation changes nicely.

📰 BREAKING: Report filed by Smoke Copilot

serena:
languages:
go: {}
dependencies:
Copy link
Contributor

Choose a reason for hiding this comment

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

The dependencies field looks good here — using the simple array format to add the APM sample package. This will trigger the pack/unpack lifecycle in the activation and agent jobs respectively.

packages:
- microsoft/apm-sample-package
- github/awesome-copilot/skills/review-and-refactor
isolated: true # clear repo primitives before unpack (default: false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice addition of the isolated: true option with an inline explanation. Might be worth mentioning what "repo primitives" refers to, or linking to the APM docs for readers unfamiliar with the concept.

@github-actions
Copy link
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@pelikhan pelikhan merged commit 9122b7f into main Mar 11, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/reimplement-apm-artifact-support branch March 11, 2026 19:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reimplements APM dependency handling by packing dependencies during the activation job and restoring them in the agent job via a dedicated apm artifact, improving determinism and reducing agent-job startup cost.

Changes:

  • Adds Isolated support to APM dependency frontmatter (new object format with packages + isolated).
  • Splits APM workflow generation into activation-time pack + upload and agent-time download + restore.
  • Infers microsoft/apm-action target from the configured engine via a new GetAPMTarget() method.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/frontmatter_types.go Extends APM dependency config with Isolated flag and updates commentary.
pkg/workflow/frontmatter_extraction_metadata.go Adds object-format parsing for dependencies and extracts isolated.
pkg/workflow/copilot_engine.go Implements GetAPMTarget() returning copilot.
pkg/workflow/claude_engine.go Implements GetAPMTarget() returning claude.
pkg/workflow/agentic_engine.go Extends WorkflowExecutor with GetAPMTarget() and provides BaseEngine default (all).
pkg/workflow/apm_dependencies.go Replaces single install step with GenerateAPMPackStep + GenerateAPMRestoreStep.
pkg/workflow/compiler_activation_job.go Emits pack step and uploads the apm artifact in the activation job.
pkg/workflow/compiler_yaml_main_job.go Downloads the apm artifact and restores dependencies in the agent job.
pkg/workflow/apm_dependencies_test.go Updates/extends unit tests for extraction, targets, and pack/restore step generation.
pkg/workflow/apm_dependencies_compilation_test.go Updates/extends integration compilation assertions for pack/upload and download/restore behavior.
docs/src/content/docs/reference/frontmatter.md Documents the new object format and pack/restore behavior.
.github/workflows/smoke-claude.md Adds an APM dependency to exercise the pack/restore path.
.github/workflows/smoke-claude.lock.yml Updates compiled output to include activation pack/upload + agent download/restore steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +197 to +199
// Restore step should include isolated: true because frontmatter says so
assert.Contains(t, lockContent, "isolated: 'true'",
"Lock file restore step should include isolated flag")
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

In TestAPMDependenciesCompilationObjectFormatIsolated, the assertion assert.Contains(lockContent, "isolated: 'true'") can pass even if the restore step fails to include isolated, because the activation pack step always includes isolated: 'true'. To actually validate propagation of the frontmatter isolated: true flag into the agent-job restore step, assert that isolated: 'true' appears within the restore step block (e.g., by locating the "Restore APM dependencies" section and checking the subsequent lines), or assert the expected occurrence count (pack + restore) is 2 for isolated=true.

Suggested change
// Restore step should include isolated: true because frontmatter says so
assert.Contains(t, lockContent, "isolated: 'true'",
"Lock file restore step should include isolated flag")
// Both pack and restore steps should include isolated: true because frontmatter says so
isolatedCount := strings.Count(lockContent, "isolated: 'true'")
assert.Equal(t, 2, isolatedCount,
"Lock file should include isolated flag in both pack and restore steps")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants