Skip to content

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

@github-actions

Description

@github-actions

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions