Skip to content

Comments

Move prompt generation to activation job with artifact transfer#16209

Merged
pelikhan merged 12 commits intomainfrom
copilot/move-prompt-rendering-validation
Feb 16, 2026
Merged

Move prompt generation to activation job with artifact transfer#16209
pelikhan merged 12 commits intomainfrom
copilot/move-prompt-rendering-validation

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Move Prompt Generation to Activation Job ✅

Prompt rendering and validation now execute in the activation job instead of the agent job, with prompt.txt transferred via artifact upload/download.

Changes

Activation job (compiler_activation_jobs.go)

  • Added generatePromptInActivationJob() method that generates all prompt steps
  • Added generateCheckoutGitHubFolderForActivation() to checkout .github and .agents folders before prompt generation
  • Sparse checkout of .github and .agents folders ensures runtime imports are available during prompt interpolation
  • Calls generatePrompt() to create prompt with built-in context, interpolation, substitution, and validation
  • Uploads prompt.txt artifact with 1-day retention using if: success() condition

Agent job (compiler_yaml_main_job.go and compiler_activation_jobs.go)

  • Downloads prompt artifact from activation job (fails fast if missing)
  • Removed local prompt generation call
  • Removed .github/.agents folder checkout (now handled in activation job)
  • Retains prompt.txt in unified agent artifacts upload for debugging

Workflow Structure

pre_activation → activation → agent
                 ├─ Checkout .github and .agents folders
                 ├─ Generate prompt (XPIA, temp folder, markdown, etc.)
                 ├─ Interpolate GitHub expressions (processes runtime imports)
                 ├─ Substitute placeholders
                 ├─ Validate prompt
                 ├─ Print prompt
                 └─ Upload prompt.txt artifact (if: success())
                                 ├─ Download prompt.txt artifact (fails fast)
                                 └─ Execute AI with prompt

Error Handling

Based on code review feedback:

  • Upload step uses if: success() to prevent uploading missing/invalid artifacts
  • Download step fails immediately if artifact is missing (no continue-on-error)
  • Ensures fail-fast behavior with clear error messages at each step

Benefits

  1. Earlier validation: Prompt errors caught in activation job before expensive agent job starts
  2. Faster failures: Invalid prompts fail in cheaper activation job
  3. Artifact caching: Prompt can be reused if agent job is retried
  4. Better separation: Activation handles preparation (including .github checkout for runtime imports), agent focuses on execution
  5. Runtime imports work correctly: .github folder is available when processing runtime-import macros during interpolation

All 154 workflows compile successfully with the new structure.

Custom agent used: agentic-workflows
GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing

Original prompt

Move the prompt rendering/validation steps in the activation job (from the agent job), upload prompt.txt as an artifact and download the artifact in the agent job.

Custom agent used: agentic-workflows
GitHub Agentic Workflows (gh-aw) - Create, debug, and upgrade AI-powered workflows with intelligent prompt routing


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


✨ PR Review Safe Output Test - Run 22077314017

💥 [THE END] — Illustrated by Smoke Claude


Changeset

  • Type: patch
  • Description: Move the .github and .agents sparse checkout into the activation job so prompt rendering validation and other activation-time steps can rely on the repository files before the agent job runs, and regenerate the workflows to capture the new setup.

Generated by Changeset Generator

Copilot AI and others added 2 commits February 16, 2026 20:04
… upload/download

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

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

@copilot move print prompt step to activation job too

Copilot AI changed the title [WIP] Move prompt rendering and validation in activation job Move prompt generation to pre_activation job with artifact transfer Feb 16, 2026
Copilot AI requested a review from pelikhan February 16, 2026 20:11
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

@copilot move print prompt step to activation job too

The Print prompt step is already in the pre_activation job. When I moved the generatePrompt() call to pre_activation, it automatically included all prompt-related steps: Create prompt, Interpolate, Substitute, Validate, and Print. You can see this in commit 9b7beba - the Print prompt step appears at line 987 in the pre_activation job of ai-moderator.lock.yml (and similar positions in all 154 compiled workflows).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan pelikhan marked this pull request as ready for review February 16, 2026 20:19
Copilot AI review requested due to automatic review settings February 16, 2026 20:19
@pelikhan pelikhan added the smoke label Feb 16, 2026
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

This PR moves prompt rendering/validation from the agent job to the pre-activation job and transfers the resulting prompt.txt to the agent job via an uploaded/downloaded artifact, enabling earlier failures and improving retry behavior.

Changes:

  • Generate the full prompt (render/interpolate/substitute/validate) during pre_activation and upload it as an artifact (prompt).
  • Download the prompt artifact in the agent job and remove local prompt generation there.
  • Update compiled workflow lockfiles to reflect the new “download prompt artifact” step in agent jobs.

Reviewed changes

Copilot reviewed 87 out of 156 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/workflow/compiler_yaml_main_job.go Replaces in-agent prompt generation with an artifact download step.
pkg/workflow/compiler_activation_jobs.go Adds prompt generation to pre-activation and uploads prompt.txt as an artifact.
.github/workflows/workflow-skill-extractor.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/workflow-normalizer.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/weekly-safe-outputs-spec-review.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/typist.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/test-workflow.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/test-project-url-default.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/test-dispatcher.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/terminal-stylist.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/sub-issue-closer.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/semantic-function-refactor.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/repo-tree-map.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/layout-spec-maintainer.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/issue-triage-agent.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/issue-arborist.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/functional-pragmatist.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/firewall.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/example-workflow-analyzer.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/example-permissions-warning.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/draft-pr-cleanup.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/dictation-prompt.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/dev.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/dependabot-go-checker.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-workflow-updater.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-syntax-error-quality.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-semgrep-scan.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-secrets-analysis.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-malicious-code-scan.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-fact.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-cli-tools-tester.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-choice-test.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/daily-assign-issue-to-user.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/copilot-pr-merged-report.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/codex-github-remote-mcp-test.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/cli-consistency-checker.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.
.github/workflows/chroma-issue-indexer.lock.yml Agent job now downloads prompt artifact instead of generating prompt inline.

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

Comment on lines 236 to 243
// Download prompt artifact from activation job
compilerYamlLog.Print("Adding prompt artifact download step")
yaml.WriteString(" - name: Download prompt artifact\n")
yaml.WriteString(" continue-on-error: true\n")
fmt.Fprintf(yaml, " uses: %s\n", GetActionPin("actions/download-artifact"))
yaml.WriteString(" with:\n")
yaml.WriteString(" name: prompt\n")
yaml.WriteString(" path: /tmp/gh-aw/aw-prompts\n")
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The prompt download step is marked continue-on-error: true, but the agent job no longer generates prompt.txt locally. If the artifact is missing (e.g., workflows where the pre-activation job is not created, or an upload/download failure), the job will proceed and later steps that read /tmp/gh-aw/aw-prompts/prompt.txt will fail with a less actionable error. Consider either (a) making the download step fail the job (remove continue-on-error) and ensuring the agent job always needs the pre-activation job, or (b) conditionally falling back to local prompt generation when the artifact is absent.

Copilot uses AI. Check for mistakes.
@pelikhan
Copy link
Contributor

@copilot the prompt generation must be done in "activation" job, NOT "pre_activation"

Copilot AI and others added 2 commits February 16, 2026 20:33
…back

- Remove continue-on-error from download step to fail fast if artifact is missing
- Change upload step from if: always() to if: success() to prevent misleading errors
- Remove continue-on-error from upload step
- Fix misleading comment in generatePromptInActivationJob

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

Copilot AI commented Feb 16, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v2 --jq .object.sha (http block)
  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Per @pelikhan feedback, prompt generation must be in the "activation" job, not "pre_activation".
- Removed prompt generation and upload steps from buildPreActivationJob
- Added prompt generation and upload steps to buildActivationJob
- All tests pass, workflows compile successfully with prompt in activation job

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

Copilot AI commented Feb 16, 2026

@copilot the prompt generation must be done in "activation" job, NOT "pre_activation"

Fixed in commit 7df64a0. Prompt generation is now in the "activation" job, not "pre_activation". The job flow is now: pre_activation → activation (generates prompt) → agent (downloads prompt).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v2 --jq .object.sha (http block)
  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@pelikhan pelikhan added the smoke label Feb 16, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

Smoke Copilot SDK failed. Please review the logs for details.

@github-actions
Copy link
Contributor

🧪 Smoke Project is now testing project operations...

@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

🧪 Smoke Temporary ID is now testing temporary ID functionality...

@github-actions
Copy link
Contributor

github-actions bot commented Feb 16, 2026

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

@github-actions
Copy link
Contributor

Agent Container Tool Check ✅

Tool Status Version
bash 5.2.21
sh available
git 2.52.0
jq 1.7
yq 4.52.2
curl 8.5.0
gh 2.86.0
node 20.20.0
python3 3.12.3
go 1.24.13
java 21.0.10
dotnet 10.0.102

Result: 12/12 tools available ✅

🔧 Tool validation by Agent Container Smoke Test for issue #16209

@github-actions
Copy link
Contributor

Smoke Temporary ID completed successfully. Temporary ID validation passed.

@github-actions
Copy link
Contributor

Smoke Project completed successfully. All project operations validated.

@github-actions
Copy link
Contributor

Smoke Test Results - Run 22078648094

PRs Tested:

Test Results:

  • ✅ GitHub MCP
  • ✅ Safe Inputs GH CLI
  • ✅ Playwright
  • ✅ File Operations
  • ✅ Build System
  • ✅ Discussion Query
  • ✅ Workflow Dispatch
  • ✅ PR Review

Status: PASS ✅

cc: @app/copilot-swe-agent

📰 BREAKING: Report filed by Smoke Copilot for issue #16209

@github-actions
Copy link
Contributor

PRs (merged): #16216 Add CI check to prevent release-compiled lock files; #16213 🌐 Update allowed domains for workflow configuration
GitHub MCP: ✅
Serena MCP (activate + find_symbol >=3): ✅
Playwright (title contains GitHub): ✅
File write + cat: ✅
Build (make build): ✅
Overall status: PASS

🔮 The oracle has spoken through Smoke Codex for issue #16209

@github-actions
Copy link
Contributor

🎭 The smoke test agent has arrived! We're exploring your enterprise cloud setup question while running validation tests. Stay tuned! ✨

📰 BREAKING: Report filed by Smoke Copilot for issue #16209

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.

Prompt generation refactoring looks solid. The new activation job approach with artifact transfer improves workflow organization.

📰 BREAKING: Report filed by Smoke Copilot for issue #16209

.github
.agents
fetch-depth: 1
persist-credentials: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Good change - sparse checkout reduces clone time significantly.

GH_AW_GITHUB_EVENT_DISCUSSION_NUMBER: ${{ github.event.discussion.number }}
GH_AW_GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
GH_AW_GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
Copy link
Contributor

Choose a reason for hiding this comment

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

The prompt generation consolidation looks clean - good refactoring.

@github-actions
Copy link
Contributor

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

@pelikhan pelikhan marked this pull request as ready for review February 16, 2026 22:35
@pelikhan pelikhan merged commit 0069a24 into main Feb 16, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/move-prompt-rendering-validation branch February 16, 2026 22:36
@mohamedbouddi7777-dev
Copy link

mohamedbouddi7777-dev commented Feb 20, 2026 via email

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