Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

The AWF container doesn't have access to runner-level environment variables like JAVA_HOME_17_X64, ANDROID_HOME, and CHROMEWEBDRIVER that workflows depend on. While --env-all passes step-level env vars, runner-provided tool paths require explicit --env VAR_NAME flags.

Changes

  • pkg/workflow/env_mirror.go: Defines 33 runner environment variables to mirror and generates AWF --env arguments
  • Engine execution files: Added mirrored env args to AWF command in copilot_engine_execution.go, claude_engine.go, codex_engine.go
  • Documentation: Added "Mirrored Environment Variables" section to sandbox.md

Mirrored Variables

Category Variables
Java JAVA_HOME, JAVA_HOME_{8,11,17,21,25}_X64
Android ANDROID_HOME, ANDROID_SDK_ROOT, ANDROID_NDK*
Browsers CHROMEWEBDRIVER, EDGEWEBDRIVER, GECKOWEBDRIVER, SELENIUM_JAR_PATH
Package Managers CONDA, VCPKG_INSTALLATION_ROOT, PIPX_*, GEM_*
Languages GOPATH, GOROOT, DOTNET_ROOT, CARGO_HOME, RUSTUP_HOME, NVM_DIR, SWIFT_PATH
Other HOMEBREW_*, AZURE_EXTENSION_DIR

AWF passes variables through only if they exist on the host—missing variables are silently ignored.

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add environment variable mirroring from runner to agent container</issue_title>
<issue_description>## Objective

Implement environment variable passing to mirror essential GitHub Actions runner environment variables into the agent container, improving compatibility with actions and workflows.

Context

The Ubuntu runner image provides many environment variables that workflows and actions depend on (e.g., JAVA_HOME, ANDROID_HOME, CHROMEWEBDRIVER, CONDA, etc.). The agent container currently doesn't have access to these, which can cause issues when workflows expect them to be set.

Refer to specs/ubuntulatest.md section "Environment Variables" for the complete list.

Approach

  1. Identify critical environment variables from the runner that should be passed through:
    • Build tool homes: JAVA_HOME_*_X64, ANDROID_HOME, ANDROID_NDK, GOPATH
    • Tool paths: CHROMEWEBDRIVER, GECKOWEBDRIVER, SELENIUM_JAR_PATH
    • Package managers: CONDA, VCPKG_INSTALLATION_ROOT
  2. Create a helper function to generate environment variable pass-through arguments
  3. Implement variable passing in the AWF command generation for all engines
  4. Add validation to ensure required variables exist before passing them
  5. Document which environment variables are automatically mirrored

Files to Modify

  • Create: pkg/workflow/env_mirror.go (environment variable mirroring logic)
  • Create: pkg/workflow/env_mirror_test.go (test environment mirroring)
  • Modify: pkg/workflow/copilot_engine_execution.go (add env passing to AWF args)
  • Modify: pkg/workflow/claude_engine.go (add env passing to AWF args)
  • Modify: pkg/workflow/codex_engine.go (add env passing to AWF args)
  • Modify: docs/src/content/docs/reference/sandbox.md (document env mirroring)

Acceptance Criteria

  • Essential environment variables are correctly passed to the agent container
  • Missing variables are handled gracefully (no errors if not present on host)
  • Tests verify environment variable presence in the container
  • Documentation lists all mirrored environment variables
  • Implementation works across all engine types
    Related to epic: build/test environment for agentic workflow #11970

AI generated by Plan Command for #11970

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Changeset

  • Type: patch
  • Description: Mirror critical runner environment variables into the AWF agent container so workflows keep access to tool paths

Ahoy! This treasure was crafted by 🏴‍☠️ Changeset Generator


Changeset

  • Type: patch
  • Description: Mirror essential GitHub Actions runner environment variables into the agent container so workflows retain access to tool paths.

Ahoy! This treasure was crafted by 🏴‍☠️ Changeset Generator

Copilot AI and others added 2 commits January 27, 2026 00:15
…itial plan)

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add environment variable mirroring from runner to agent container Add environment variable mirroring from runner to agent container Jan 27, 2026
Copilot AI requested a review from Mossaka January 27, 2026 00:36
Mossaka and others added 2 commits January 27, 2026 17:17
…irroring

# Conflicts:
#	.github/workflows/agent-performance-analyzer.lock.yml
#	.github/workflows/agent-persona-explorer.lock.yml
#	.github/workflows/ai-moderator.lock.yml
#	.github/workflows/archie.lock.yml
#	.github/workflows/artifacts-summary.lock.yml
#	.github/workflows/auto-triage-issues.lock.yml
#	.github/workflows/brave.lock.yml
#	.github/workflows/breaking-change-checker.lock.yml
#	.github/workflows/chroma-issue-indexer.lock.yml
#	.github/workflows/ci-coach.lock.yml
#	.github/workflows/ci-doctor.lock.yml
#	.github/workflows/cli-consistency-checker.lock.yml
#	.github/workflows/code-scanning-fixer.lock.yml
#	.github/workflows/code-simplifier.lock.yml
#	.github/workflows/copilot-cli-deep-research.lock.yml
#	.github/workflows/copilot-pr-merged-report.lock.yml
#	.github/workflows/copilot-pr-nlp-analysis.lock.yml
#	.github/workflows/copilot-pr-prompt-analysis.lock.yml
#	.github/workflows/craft.lock.yml
#	.github/workflows/daily-assign-issue-to-user.lock.yml
#	.github/workflows/daily-cli-performance.lock.yml
#	.github/workflows/daily-compiler-quality.lock.yml
#	.github/workflows/daily-copilot-token-report.lock.yml
#	.github/workflows/daily-file-diet.lock.yml
#	.github/workflows/daily-firewall-report.lock.yml
#	.github/workflows/daily-malicious-code-scan.lock.yml
#	.github/workflows/daily-news.lock.yml
#	.github/workflows/daily-regulatory.lock.yml
#	.github/workflows/daily-repo-chronicle.lock.yml
#	.github/workflows/daily-secrets-analysis.lock.yml
#	.github/workflows/daily-semgrep-scan.lock.yml
#	.github/workflows/daily-team-status.lock.yml
#	.github/workflows/daily-testify-uber-super-expert.lock.yml
#	.github/workflows/daily-workflow-updater.lock.yml
#	.github/workflows/delight.lock.yml
#	.github/workflows/dependabot-bundler.lock.yml
#	.github/workflows/dependabot-go-checker.lock.yml
#	.github/workflows/dev-hawk.lock.yml
#	.github/workflows/dev.lock.yml
#	.github/workflows/dictation-prompt.lock.yml
#	.github/workflows/discussion-task-miner.lock.yml
#	.github/workflows/docs-noob-tester.lock.yml
#	.github/workflows/example-custom-error-patterns.lock.yml
#	.github/workflows/example-permissions-warning.lock.yml
#	.github/workflows/firewall-escape.lock.yml
#	.github/workflows/firewall.lock.yml
#	.github/workflows/github-remote-mcp-auth-test.lock.yml
#	.github/workflows/glossary-maintainer.lock.yml
#	.github/workflows/grumpy-reviewer.lock.yml
#	.github/workflows/hourly-ci-cleaner.lock.yml
#	.github/workflows/issue-monster.lock.yml
#	.github/workflows/issue-triage-agent.lock.yml
#	.github/workflows/jsweep.lock.yml
#	.github/workflows/layout-spec-maintainer.lock.yml
#	.github/workflows/mcp-inspector.lock.yml
#	.github/workflows/mergefest.lock.yml
#	.github/workflows/metrics-collector.lock.yml
#	.github/workflows/notion-issue-summary.lock.yml
#	.github/workflows/org-health-report.lock.yml
#	.github/workflows/pdf-summary.lock.yml
#	.github/workflows/plan.lock.yml
#	.github/workflows/poem-bot.lock.yml
#	.github/workflows/portfolio-analyst.lock.yml
#	.github/workflows/pr-nitpick-reviewer.lock.yml
#	.github/workflows/pr-triage-agent.lock.yml
#	.github/workflows/python-data-charts.lock.yml
#	.github/workflows/q.lock.yml
#	.github/workflows/release.lock.yml
#	.github/workflows/repo-audit-analyzer.lock.yml
#	.github/workflows/repo-tree-map.lock.yml
#	.github/workflows/repository-quality-improver.lock.yml
#	.github/workflows/research.lock.yml
#	.github/workflows/secret-scanning-triage.lock.yml
#	.github/workflows/security-compliance.lock.yml
#	.github/workflows/security-fix-pr.lock.yml
#	.github/workflows/security-review.lock.yml
#	.github/workflows/slide-deck-maintainer.lock.yml
#	.github/workflows/smoke-claude.lock.yml
#	.github/workflows/smoke-codex.lock.yml
#	.github/workflows/smoke-copilot.lock.yml
#	.github/workflows/stale-repo-identifier.lock.yml
#	.github/workflows/sub-issue-closer.lock.yml
#	.github/workflows/super-linter.lock.yml
#	.github/workflows/technical-doc-writer.lock.yml
#	.github/workflows/terminal-stylist.lock.yml
#	.github/workflows/tidy.lock.yml
#	.github/workflows/ubuntu-image-analyzer.lock.yml
#	.github/workflows/video-analyzer.lock.yml
#	.github/workflows/weekly-issue-summary.lock.yml
#	.github/workflows/workflow-generator.lock.yml
#	.github/workflows/workflow-health-manager.lock.yml
#	.github/workflows/workflow-normalizer.lock.yml
#	.github/workflows/workflow-skill-extractor.lock.yml
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Mossaka Mossaka added the smoke label Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

💀 Blimey! Changeset Generator failed and walked the plank! No treasure today, matey! ☠️

@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 Jan 27, 2026

💫 TO BE CONTINUED... Smoke Claude was cancelled! Our hero faces unexpected challenges...

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

🌑 The shadows whisper... Smoke Codex was cancelled. The oracle requires further meditation...

@Mossaka Mossaka added smoke and removed smoke labels Jan 27, 2026
@github-actions
Copy link
Contributor

📰 DEVELOPING STORY: Smoke Copilot reports was cancelled. Our correspondents are investigating the incident...

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

💀 Blimey! Changeset Generator failed and walked the plank! No treasure today, matey! ☠️

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

💫 TO BE CONTINUED... Smoke Claude failed! Our hero faces unexpected challenges...

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 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...

@github-actions
Copy link
Contributor

📰 DEVELOPING STORY: Smoke Copilot reports failed. Our correspondents are investigating the incident...

@Mossaka Mossaka added smoke and removed smoke labels Jan 27, 2026
@github-actions
Copy link
Contributor

Smoke Test Results:

✅ GitHub MCP (#11969, #12046)
✅ Safe Inputs GH CLI (#12062, #12055)
✅ Serena MCP
✅ Make Build
✅ Playwright
✅ Tavily Search
✅ File Operations
✅ Bash Tools
✅ Discussion Interaction

Overall Status: PASS

AI generated by Smoke Claude

Mossaka and others added 2 commits January 27, 2026 17:38
…irroring

# Conflicts:
#	.github/workflows/audit-workflows.lock.yml
#	.github/workflows/blog-auditor.lock.yml
#	.github/workflows/changeset.lock.yml
#	.github/workflows/claude-code-user-docs-review.lock.yml
#	.github/workflows/cli-version-checker.lock.yml
#	.github/workflows/cloclo.lock.yml
#	.github/workflows/codex-github-remote-mcp-test.lock.yml
#	.github/workflows/commit-changes-analyzer.lock.yml
#	.github/workflows/copilot-agent-analysis.lock.yml
#	.github/workflows/copilot-session-insights.lock.yml
#	.github/workflows/daily-choice-test.lock.yml
#	.github/workflows/daily-code-metrics.lock.yml
#	.github/workflows/daily-doc-updater.lock.yml
#	.github/workflows/daily-fact.lock.yml
#	.github/workflows/daily-issues-report.lock.yml
#	.github/workflows/daily-multi-device-docs-tester.lock.yml
#	.github/workflows/daily-observability-report.lock.yml
#	.github/workflows/daily-performance-summary.lock.yml
#	.github/workflows/daily-safe-output-optimizer.lock.yml
#	.github/workflows/deep-report.lock.yml
#	.github/workflows/developer-docs-consolidator.lock.yml
#	.github/workflows/duplicate-code-detector.lock.yml
#	.github/workflows/example-workflow-analyzer.lock.yml
#	.github/workflows/github-mcp-structural-analysis.lock.yml
#	.github/workflows/github-mcp-tools-report.lock.yml
#	.github/workflows/go-fan.lock.yml
#	.github/workflows/go-logger.lock.yml
#	.github/workflows/go-pattern-detector.lock.yml
#	.github/workflows/instructions-janitor.lock.yml
#	.github/workflows/issue-arborist.lock.yml
#	.github/workflows/lockfile-stats.lock.yml
#	.github/workflows/prompt-clustering-analysis.lock.yml
#	.github/workflows/safe-output-health.lock.yml
#	.github/workflows/schema-consistency-checker.lock.yml
#	.github/workflows/scout.lock.yml
#	.github/workflows/security-alert-burndown.campaign.lock.yml
#	.github/workflows/semantic-function-refactor.lock.yml
#	.github/workflows/sergo.lock.yml
#	.github/workflows/smoke-claude.lock.yml
#	.github/workflows/smoke-codex.lock.yml
#	.github/workflows/static-analysis-report.lock.yml
#	.github/workflows/step-name-alignment.lock.yml
#	.github/workflows/test-create-pr-error-handling.lock.yml
#	.github/workflows/typist.lock.yml
#	.github/workflows/unbloat-docs.lock.yml
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Mossaka Mossaka force-pushed the copilot/add-env-var-mirroring branch from 3bab72d to 20a8409 Compare January 27, 2026 17:39
@Mossaka Mossaka added the smoke label Jan 27, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@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 Jan 27, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

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

@github-actions
Copy link
Contributor

GitHub MCP: Update MCP gateway container to v0.0.82 ✅
GitHub MCP: Expand hostedtoolcache PATH integration for Python and other runtimes ✅
safeinputs-gh: [WIP] Add implementation to mount recommended binaries into agent container ✅
safeinputs-gh: [WIP] Fix test failures when running make test ✅
Serena activate_project ✅
Playwright github.com title ✅
Tavily search ✅
File write/read ✅
Discussion query + comment ✅
Overall: PASS

AI generated by Smoke Codex

@github-actions github-actions bot removed the smoke label Jan 27, 2026
@github-actions
Copy link
Contributor

🎉 The smoke test agent was here! Just validated all the Copilot engine capabilities and everything is looking fantastic! 🚀

✨ All systems operational:

  • GitHub MCP: ✅ Checked
  • Safe Inputs: ✅ Verified
  • Serena MCP: ✅ Activated
  • Playwright: ✅ Browsing
  • File I/O: ✅ Working
  • Bash: ✅ Executing

Keep up the great work! 🎊


Smoke test run: §21407709161

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP Testing
  • ✅ Safe Inputs GH CLI Testing
  • ✅ Serena MCP Testing
  • ✅ Playwright Testing
  • ✅ File Writing Testing
  • ✅ Bash Tool Testing
  • ✅ Discussion Interaction Testing

Overall Status: PASS

@Mossaka @Copilot

AI generated by Smoke Copilot

@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

PRs Reviewed:

Test Status:

  • ✅ GitHub MCP
  • ✅ Safe Inputs GH CLI
  • ✅ Serena MCP
  • ✅ Make Build
  • ✅ Playwright
  • ✅ Tavily Web Search
  • ✅ File Writing
  • ✅ Bash Tool
  • ✅ Discussion Interaction

Overall Status: ✅ PASS

AI generated by Smoke Claude

@Mossaka Mossaka closed this Jan 27, 2026
@Mossaka Mossaka reopened this Jan 27, 2026
Mossaka and others added 3 commits January 27, 2026 18:29
The generic `find /opt/hostedtoolcache` command returns directories in
alphabetical order, causing older runtime versions (e.g., Go 1.22.12) to
shadow newer ones (e.g., Go 1.25.6) because "1.22" < "1.25" alphabetically.

This fix prepends specific tool paths from environment variables (set by
actions/setup-go, actions/setup-java, etc.) BEFORE the generic find results:
- GOROOT/bin (Go)
- JAVA_HOME/bin (Java)
- CARGO_HOME/bin (Rust)
- GEM_HOME/bin (Ruby)
- CONDA/bin (Conda)
- PIPX_BIN_DIR (pipx)
- SWIFT_PATH (Swift)
- DOTNET_ROOT (.NET)

This ensures the version configured by setup actions takes precedence over
other versions that may exist in hostedtoolcache.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Instead of using shell variable expansion like ${GOROOT:+$GOROOT/bin:}
inside the container (which could be exploited), compute the tool bin
paths on the runner side and pass them as a literal value via --env.

Changes:
- Add GetToolBinsSetup() to compute GH_AW_TOOL_BINS on the runner
- Add GetToolBinsEnvArg() to pass GH_AW_TOOL_BINS via --env to container
- Update GetHostedToolcachePathSetup() to use $GH_AW_TOOL_BINS
- Update all engines (Claude, Codex, Copilot) to use the safer approach

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Mossaka Mossaka added the smoke label Jan 27, 2026
@github-actions
Copy link
Contributor

💥 WHOOSH! Smoke Claude springs into action on this pull request! [Panel 1 begins...]

@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

🔮 The ancient spirits stir... Smoke Codex awakens to divine this pull request...

@github-actions
Copy link
Contributor

⚓ Avast! Changeset Generator be settin' sail on this pull request! 🏴‍☠️

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.

[plan] Add environment variable mirroring from runner to agent container

3 participants