Skip to content

Fix: Create /tmp/gh-aw directory before writing aw_info.json in activation job#18876

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-github-actions-workflow-3dd66c95-3730-4640-8e26-2b46663d25e8
Feb 28, 2026
Merged

Fix: Create /tmp/gh-aw directory before writing aw_info.json in activation job#18876
pelikhan merged 3 commits intomainfrom
copilot/fix-github-actions-workflow-3dd66c95-3730-4640-8e26-2b46663d25e8

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

The activation job fails with ENOENT: no such file or directory, open '/tmp/gh-aw/aw_info.json' because /tmp/gh-aw doesn't exist at that point — create_gh_aw_tmp_dir.sh only runs in the main job.

Changes

  • actions/setup/js/generate_aw_info.cjs: New module extracted from the inline script that:

    • Reads compile-time values from GH_AW_INFO_* environment variables set by the step
    • Reads runtime values from the GitHub Actions context parameter
    • Validates required context variables (warns if runId, runNumber, sha, ref, actor, eventName, or repo are missing)
    • Creates /tmp/gh-aw with fs.mkdirSync(..., { recursive: true }) before writing aw_info.json
    • Sets the model step output
    • Calls generateWorkflowOverview to print the agent overview in the step summary
  • actions/setup/js/generate_aw_info.test.cjs: 9 tests covering env var parsing, context validation, firewall config, conditional cli_version, and step summary generation

  • pkg/workflow/compiler_yaml.go: generateCreateAwInfo now sets GH_AW_INFO_* env vars for all compile-time values and replaces ~60 lines of inline JavaScript with:

const { main } = require('/opt/gh-aw/actions/generate_aw_info.cjs');
await main(core, context);
  • pkg/workflow/aw_info_tmp_test.go: Updated assertions to verify the new YAML structure
  • Golden files + 162 .lock.yml files: Recompiled to reflect the generated code change

[!WARNING]

Original prompt

Fix the failing GitHub Actions workflow activation
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 65256080988
Job URL: https://github.com/github/gh-aw/actions/runs/22525198885/job/65256080988


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Changeset

  • Type: patch
  • Description: Ensure the activation job creates /tmp/gh-aw before writing aw_info.json, preventing the activation job from failing when the temp directory is missing.

Generated by Changeset Generator for issue #18876

Warning

⚠️ Firewall blocked 1 domain

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

  • github.com

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

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

@pelikhan
Copy link
Contributor

@copilot make sure the /tmp/gh-aw/ folder is created before writing aw_info.json to it.

@pelikhan
Copy link
Contributor

@copilot the code that generate aw_info.json into a separate .json that also validate context variable and prints agent overview in step summary.

…ation job

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow activation Fix: Create /tmp/gh-aw directory before writing aw_info.json in activation job Feb 28, 2026
…ith context validation

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

Copilot AI commented Feb 28, 2026

@copilot make sure the /tmp/gh-aw/ folder is created before writing aw_info.json to it.

Done in c7824e5fs.mkdirSync('/tmp/gh-aw', { recursive: true }) is now called before writing aw_info.json.

@copilot the code that generate aw_info.json into a separate .json that also validate context variable and prints agent overview in step summary.

Done in cfb306e — created actions/setup/js/generate_aw_info.cjs that reads compile-time values from GH_AW_INFO_* env vars, validates required context fields, writes aw_info.json (with the mkdir fix included), sets the model output, and calls generateWorkflowOverview for the step summary. The compiled step now just sets the env vars and calls await main(core, context).

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/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw k/gh-aw/gh-aw/ac/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/pre�� k/gh-aw/gh-aw/ac--write 64/pkg/tool/linu../../../**/*.json k/gh�� w/js/**/*.json&#39; --ignore-path .cfg 64/pkg/tool/linux_amd64/vet k/gh-aw/gh-aw/acdocker k/gh-aw/gh-aw/acimage k/gh-aw/gh-aw/acinspect 64/pkg/tool/linumcp/chroma (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw flow (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha (http block)
  • https://api.github.com/repos/githubnext/agentics/git/ref/tags/
    • Triggering command: /usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha )$/\1/p --local (http block)

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions
Copy link
Contributor

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

@pelikhan pelikhan marked this pull request as ready for review February 28, 2026 18:23
Copilot AI review requested due to automatic review settings February 28, 2026 18:23
@pelikhan pelikhan merged commit e3fa302 into main Feb 28, 2026
62 of 64 checks passed
@pelikhan pelikhan deleted the copilot/fix-github-actions-workflow-3dd66c95-3730-4640-8e26-2b46663d25e8 branch February 28, 2026 18:23
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

Fixes activation-job failures when writing /tmp/gh-aw/aw_info.json by ensuring the /tmp/gh-aw directory exists before file creation, and refactors aw_info generation into a reusable JS module invoked from generated workflows.

Changes:

  • Extracts the “Generate agentic run info” inline github-script into actions/setup/js/generate_aw_info.cjs, including /tmp/gh-aw directory creation before writing aw_info.json.
  • Updates the workflow compiler/tests to pass compile-time values via GH_AW_INFO_* env vars and call the new module.
  • Regenerates workflow lockfiles and golden outputs to reflect the new structure.

Reviewed changes

Copilot reviewed 171 out of 171 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
actions/setup/js/generate_aw_info.cjs New module that builds aw_info from env + context, creates /tmp/gh-aw, writes aw_info.json, sets outputs, and writes step summary.
actions/setup/js/generate_aw_info.test.cjs Adds unit tests for env parsing, context validation warnings, optional cli_version, firewall fields, and step summary generation.
pkg/workflow/aw_info_tmp_test.go Updates assertions to match the new generated YAML structure (module require + GH_AW_INFO_* env vars).
pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/smoke-test-tools.golden Golden output updated to ensure /tmp/gh-aw exists before writing aw_info.json.
pkg/workflow/testdata/wasm_golden/TestWasmGolden_CompileFixtures/claude-with-network.golden Golden output updated to ensure /tmp/gh-aw exists before writing aw_info.json.
.github/workflows/*.lock.yml Regenerated lock workflows to set GH_AW_INFO_* env vars and call /opt/gh-aw/actions/generate_aw_info.cjs.

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

Comment on lines +29 to +36
// Parse allowed domains from JSON env var
let allowedDomains = [];
const allowedDomainsEnv = process.env.GH_AW_INFO_ALLOWED_DOMAINS || "[]";
try {
allowedDomains = JSON.parse(allowedDomainsEnv);
} catch {
core.warning(`Failed to parse GH_AW_INFO_ALLOWED_DOMAINS: ${allowedDomainsEnv}`);
}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

GH_AW_INFO_ALLOWED_DOMAINS is JSON-parsed but the result isn’t validated to be an array. If it parses to a non-array (e.g. a string/object), allowed_domains will not be an array and generate_workflow_overview.cjs will later call .slice(...).map(...) on it and throw. After parsing, ensure the value is an array (e.g. Array.isArray(parsed)), otherwise warn and fall back to [].

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +43
// Create /tmp/gh-aw directory if it doesn't exist
if (!fs.existsSync("/tmp/gh-aw")) {
fs.mkdirSync("/tmp/gh-aw", { recursive: true });
}
awInfoPath = "/tmp/gh-aw/aw_info.json";

Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

This test hardcodes /tmp/gh-aw//tmp/gh-aw/aw_info.json instead of using the same constant (TMP_GH_AW_PATH) as the implementation. If the path ever changes, the tests will silently diverge. Consider importing TMP_GH_AW_PATH from ./constants.cjs and deriving awInfoPath from it.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

Smoke test results for @pelikhan and @Copilot:

Test Status
GitHub MCP
Safe Inputs GH CLI
Serena MCP ❌ (unavailable)
Playwright
Web Fetch
File Writing
Bash Tool
Discussion Interaction
Build gh-aw
Discussion Creation
Workflow Dispatch
PR Review

Overall: PASS (11/12)

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

This PR cleanly extracts the inline generate_aw_info JavaScript into a dedicated CJS module with proper tests. The refactoring reduces lock file noise significantly. One path concern flagged inline — overall a solid improvement.

📰 BREAKING: Report filed by Smoke Copilot

// Generate workflow overview and write to step summary
const { generateWorkflowOverview } = require('/opt/gh-aw/actions/generate_workflow_overview.cjs');
await generateWorkflowOverview(core);
const { main } = require('/opt/gh-aw/actions/generate_aw_info.cjs');
Copy link
Contributor

Choose a reason for hiding this comment

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

The path /opt/gh-aw/actions/generate_aw_info.cjs uses /opt/ which is for system-installed packages. At runtime, files are copied to /tmp/gh-aw/actions. This could fail if the setup action hasn't run or copies to a different location than expected. Consider verifying the runtime path is consistent with the setup action's copy destination.

id: generate_aw_info
env:
GH_AW_MODEL_AGENT_COPILOT: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || '' }}
GH_AW_INFO_ENGINE_ID: "copilot"
Copy link
Contributor

Choose a reason for hiding this comment

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

Good pattern: moving compile-time values to GH_AW_INFO_* env vars makes the step's generated YAML cleaner and easier to audit. This clearly separates static configuration from runtime context.

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

Smoke Test Results - Run §22526334288

Status: PARTIAL

Test Result
1. GitHub MCP
2. Safe Inputs GH CLI
3. Serena MCP (find_symbol) ❌ EOF error
4. Make Build
5. Playwright
6. Tavily Search
7. File Writing
8. Bash Tool
9. Discussion Interaction
10. Agentic Workflows MCP
11. Update PR
12. PR Review Comments
13. Submit PR Review
14. Resolve Review Thread ⚠️ skipped
15. Add Reviewer
16. Push to PR Branch ❌ branch deleted
17. Close PR ⚠️ skipped

💥 [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! This PR extracts aw_info generation logic into a proper module with validation and tests. The architecture is clean and the test coverage looks solid.

💥 [THE END] — Illustrated by Smoke Claude

pelikhan pushed a commit that referenced this pull request Feb 28, 2026
…info.cjs (#18876 follow-up) (#18890)

* refactor: apply project conventions to generate_aw_info.cjs

- Move fs require to module level (consistent with all other .cjs files)
- Simplify null check: ctx[field] === undefined || ctx[field] === null → ctx[field] == null
- Replace console.log with core.info per project JavaScript conventions (AGENTS.md)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: trigger CI checks

---------

Co-authored-by: GitHub Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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