Skip to content

copilot/arc-dind: export writable HOME before Copilot XDG/MCP path resolution - #48658

Merged
pelikhan merged 7 commits into
mainfrom
copilot/fix-xdg-config-home-issue
Jul 28, 2026
Merged

copilot/arc-dind: export writable HOME before Copilot XDG/MCP path resolution#48658
pelikhan merged 7 commits into
mainfrom
copilot/fix-xdg-config-home-issue

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Under runner.topology: arc-dind, Copilot path setup exported XDG_CONFIG_HOME/GH_AW_MCP_CONFIG while HOME still pointed at passwd home (/home/runner), causing XDG-aware tools to write to an unwritable location.
This change makes ARC/DinD path resolution consistent by setting the writable ARC/DinD home before Copilot config exports are evaluated.

  • Path setup ordering fix (arc-dind only)

    • In Copilot AWF path setup, prepend:
      • export HOME=${RUNNER_TEMP}/gh-aw/home
    • Keep existing inner engine-command HOME export intact (defense-in-depth for in-container execution).
  • Config export behavior preserved, resolution corrected

    • buildCopilotMCPConfigExport remains $HOME-based.
    • Because HOME is now set earlier for arc-dind, both:
      • XDG_CONFIG_HOME="$HOME"
      • GH_AW_MCP_CONFIG="$HOME/.copilot/mcp-config.json"
        resolve to the writable ARC/DinD home.
  • Regression guard on generated run block

    • Extended arc-dind Copilot execution assertions to require that the first HOME export appears before:
      • Copilot settings setup
      • XDG_CONFIG_HOME export
      • GH_AW_MCP_CONFIG export
homeExport := ""
if isArcDindTopology(workflowData) {
    homeExport = fmt.Sprintf("export HOME=%s\n", awfArcDindHomePathExpr)
}
return homeExport +
    buildCopilotSettingsCleanupAndExitCodeTrap() +
    buildCopilotSettingsSetup(...) +
    buildCopilotMCPConfigExport(workflowData) +
    pathSetup

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.3 AIC · ⌖ 5.94 AIC · ⊞ 7.2K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30375513874

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.1 AIC · ⌖ 6.1 AIC · ⊞ 7.2K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 9.86 AIC · ⌖ 6.19 AIC · ⊞ 7.2K ·
Comment /souschef to run again

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix XDG_CONFIG_HOME resolution for unwritable home directory copilot/arc-dind: export writable HOME before Copilot XDG/MCP path resolution Jul 28, 2026
Copilot AI requested a review from lpcox July 28, 2026 14:54
Copilot finished work on behalf of lpcox July 28, 2026 14:54
@lpcox
lpcox marked this pull request as ready for review July 28, 2026 15:02
Copilot AI review requested due to automatic review settings July 28, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes ARC/DinD Copilot configuration paths by exporting the writable sandbox HOME before $HOME-based setup.

Changes:

  • Adds an early ARC/DinD HOME export.
  • Adds regression assertions for export presence and ordering.
Show a summary per file
File Description
pkg/workflow/copilot_engine_execution.go Sets writable HOME before Copilot configuration exports.
pkg/workflow/firewall_args_test.go Verifies ARC/DinD path export ordering.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

@lpcox lpcox left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is one remaining ARC/DinD path mismatch to address.

MCP config producer and consumer resolve different HOME values. The execution step now resets HOME before deriving GH_AW_MCP_CONFIG, so Copilot reads ${RUNNER_TEMP}/gh-aw/home/.copilot/mcp-config.json. However, the preceding MCP gateway/config creation step still writes $HOME/.copilot/mcp-config.json using that separate GitHub Actions step's original HOME (/home/runner). Step-local exports do not persist between Actions steps, so the file is written to the old path while Copilot is directed to the new one.

Please apply the same ARC/DinD HOME override in the MCP-config creation step and add a regression test covering the complete generated step sequence, ensuring the producer and consumer resolve the same path across separate steps.

@lpcox

lpcox commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

…nd+firewall

The "Start MCP Gateway" step (producer) was writing the Copilot MCP config
to $HOME/.copilot/mcp-config.json using the step's original HOME (/home/runner).
The Copilot execution step (consumer) already overrides HOME to
${RUNNER_TEMP}/gh-aw/home before evaluating GH_AW_MCP_CONFIG, so it looked for
the config at ${RUNNER_TEMP}/gh-aw/home/.copilot/mcp-config.json.

GitHub Actions step-local exports do not persist between steps, so each step
must independently override HOME. The fix mirrors the condition in
buildCopilotAWFPathSetup: emit the HOME export only when both arc-dind topology
and firewall are enabled (the only case where the execution step also overrides HOME).

Added TestArcDind_ProducerConsumerHomeParity as a regression guard covering the
complete step sequence — both the gateway (producer) and execution (consumer)
steps — ensuring they both export HOME before $HOME-derived paths are evaluated
and that neither embeds a literal /home/runner.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

There is one remaining ARC/DinD path mismatch to address.

MCP config producer and consumer resolve different HOME values. The execution step now resets HOME before deriving GH_AW_MCP_CONFIG, ...

Fixed in 60a9f64.

CopilotEngine.RenderMCPConfig now exports HOME=${RUNNER_TEMP}/gh-aw/home before mkdir -p "$HOME/.copilot" when both arc-dind topology and firewall are enabled. This mirrors the same condition in buildCopilotAWFPathSetup (which governs the execution step), so both steps independently resolve $HOME to the same daemon-visible writable path.

Added TestArcDind_ProducerConsumerHomeParity to guard the full sequence: it generates both the "Start MCP Gateway" (producer) and Copilot execution (consumer) steps and asserts that each exports HOME before any $HOME-derived config path is evaluated.

Copilot AI requested a review from lpcox July 28, 2026 15:42
Copilot finished work on behalf of lpcox July 28, 2026 15:42
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

The file referenced requireCopilotExecutionStep which is defined in
enable_api_proxy_test.go (tagged //go:build !integration). Without the
matching tag, verify-integration-build failed with:
  undefined: requireCopilotExecutionStep

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

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done. The verify-integration-build failure was caused by a missing //go:build !integration tag on copilot_home_expansion_test.go. The file referenced requireCopilotExecutionStep, which is defined in enable_api_proxy_test.go (tagged //go:build !integration). When building with the integration tag, enable_api_proxy_test.go was excluded while copilot_home_expansion_test.go was still compiled, resulting in an undefined symbol error.

Fixed in the latest commit by adding the matching //go:build !integration tag to copilot_home_expansion_test.go. Both go build ./pkg/workflow/... and go build -tags integration ./pkg/workflow/... now succeed, and local make agent-report-progress (fmt + lint + test-unit) passes.

Copilot AI requested a review from pelikhan July 28, 2026 16:27
@pelikhan
pelikhan merged commit 8db5637 into main Jul 28, 2026
28 checks passed
@pelikhan
pelikhan deleted the copilot/fix-xdg-config-home-issue branch July 28, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copilot/arc-dind: XDG_CONFIG_HOME resolves to unwritable /home/runner

4 participants