Skip to content

fix: add git safe.directory and refactor git config to shell script to resolve dubious ownership error#39771

Merged
pelikhan merged 20 commits into
mainfrom
copilot/instructions-sync
Jun 17, 2026
Merged

fix: add git safe.directory and refactor git config to shell script to resolve dubious ownership error#39771
pelikhan merged 20 commits into
mainfrom
copilot/instructions-sync

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The create_pull_request safe output in the Instructions Janitor (and any workflow using create_pull_request) fails when git rejects operations due to "detected dubious ownership in repository" — triggered when the repository directory is owned by a different user than the one executing git commands in the safe_outputs job runner environment.

Changes

  • actions/setup/sh/configure_git_credentials.sh (new) — canonical POSIX sh-compatible shell script that sets git identity (github-actions[bot]), adds safe.directory from ${GITHUB_WORKSPACE}, and configures the remote URL when all required authentication credentials (GITHUB_REPOSITORY, GITHUB_SERVER_URL, GITHUB_TOKEN/GIT_TOKEN) are present. Auth is silently skipped when any credential is absent, so the same script is safe to run inside the safeoutputs container (which intentionally does not receive GITHUB_SERVER_URL)
  • actions/setup/sh/start_safe_outputs_mcp.sh (new) — POSIX sh entrypoint script for the gh-aw-node container; calls configure_git_credentials.sh via sh and then execs the safe-outputs MCP server node process
  • pkg/workflow/git_configuration_steps.go — refactored "Configure Git credentials" step to call bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh" (affects agent job, publish_assets, repo_memory, experiments jobs)
  • pkg/workflow/compiler_safe_outputs_steps.go — same refactoring in both the single-repo (buildConsolidatedCheckoutSteps) and multi-repo (buildMultiRepoCheckoutSteps) git config step generators; the multi-repo case still appends inline per-subdirectory remote URL lines after the script call
  • pkg/workflow/mcp_renderer_builtin.go — container entrypoint for the gh-aw-node container is set to sh "${RUNNER_TEMP}/gh-aw/safeoutputs/start_safe_outputs_mcp.sh"; GITHUB_SERVER_URL is intentionally not included in the safeoutputs MCP container env_vars to prevent the container from accessing that secret — configure_git_credentials.sh detects the missing variable and skips remote URL authentication automatically
  • actions/setup/setup.sh — copies both configure_git_credentials.sh and start_safe_outputs_mcp.sh to ${RUNNER_TEMP}/gh-aw/safeoutputs/ so they are accessible inside the container's mounted volume
  • actions/setup/js/Dockerfile.safe-outputs-mcp — only git is installed via apk; bash is not required since the entrypoint runs under sh
  • All lock files regenerated via make recompile
  • Golden test data and unit tests updated to reflect the new entrypoint

The generated "Configure Git credentials" step now calls the shared script:

- name: Configure Git credentials
  env:
    GITHUB_REPOSITORY: ${{ github.repository }}
    GITHUB_SERVER_URL: ${{ github.server_url }}
    GITHUB_TOKEN: ${{ github.token }}
  run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"

The gh-aw-node container entrypoint runs start_safe_outputs_mcp.sh via sh at startup. That script calls configure_git_credentials.sh (which configures git identity and safe.directory but skips remote authentication since GITHUB_SERVER_URL is not passed to the container) and then launches the MCP server. Main workflow steps (agent job, publish_assets, repo_memory, etc.) receive GITHUB_SERVER_URL and authenticate as before.



✨ PR Review Safe Output Test - Run 27718402567

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude ·


Changeset\n\n- Type: patch\n- Description: Fix git credential setup to add safe.directory and use a shared POSIX shell entrypoint, resolving dubious ownership errors in safeoutputs and related workflows.

Generated by 📋 Changeset Generator for issue #39771 ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions github-actions Bot mentioned this pull request Jun 17, 2026
…e_outputs job

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing tools in Instructions Janitor workflow fix: add git safe.directory to resolve dubious ownership error in safe_outputs job Jun 17, 2026
Copilot AI requested a review from pelikhan June 17, 2026 12:32

@pelikhan pelikhan 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.

@copilot the git instance running inside the gh-aw-node container needs to be configured. Update Dockerfile for this container.

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

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the git instance running inside the gh-aw-node container needs to be configured. Update Dockerfile for this container.

Added git config --global --add safe.directory '*' to actions/setup/js/Dockerfile.safe-outputs-mcp in commit fix: configure git safe.directory in gh-aw-node Dockerfile. This mirrors what's already in the main Dockerfile for the gh-aw container.

Copilot AI changed the title fix: add git safe.directory to resolve dubious ownership error in safe_outputs job fix: add git safe.directory to resolve dubious ownership error in safe_outputs job and gh-aw-node container Jun 17, 2026
Copilot AI requested a review from pelikhan June 17, 2026 12:47
Comment thread .github/workflows/ace-editor.lock.yml Outdated
…iner entrypoint

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title fix: add git safe.directory to resolve dubious ownership error in safe_outputs job and gh-aw-node container fix: add git safe.directory and refactor git config to shell script to resolve dubious ownership error Jun 17, 2026
Copilot AI requested a review from pelikhan June 17, 2026 13:59

@pelikhan pelikhan 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.

@copilot configure safeoutputs MCP env var pre-stripped git server url

Rename SERVER_URL to GIT_SERVER_URL

Comment thread .github/workflows/ab-testing-advisor.lock.yml Outdated
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot use GITHUB_SERVER_URL instead of GIT_SERVER_URL

…ials step

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

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot configure safeoutputs MCP env var pre-stripped git server url

...

Done in commit fix: use GITHUB_REPOSITORY and GIT_SERVER_URL env vars in git credentials step.

  • Renamed SERVER_URLGIT_SERVER_URL in the "Configure Git credentials" step env block, the shell script, and the multi-repo inline bash (GIT_SERVER_URL_STRIPPED)
  • Added GIT_SERVER_URL to the safeoutputs MCP container env_vars list so the container receives it
  • setup.sh now exports GIT_SERVER_URL="${GITHUB_SERVER_URL#https://}" to GITHUB_ENV so the container gets the pre-stripped URL ready for use in git remote URLs

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Gemini MISSION COMPLETE! Gemini has spoken. ✨

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (apikey) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.54.0
jq 1.7
yq v4.53.3
curl 8.5.0
gh 2.93.0
node v22.22.3
python3 3.11.15 (PyPy)
go 1.24.13
java 21.0.11
dotnet 10.0.300

Result: 12/12 tools available ✅

Overall Status: PASS

🔧 Tool validation by Agent Container Smoke Test ·

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results: GitHub MCP: ✅, Web Fetch: ✅, File Write: ✅, Bash: ✅, Build: ❌. Overall: FAIL.

Warning

Firewall blocked 1 domain

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

  • localhost

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

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

Smoke Gemini — Powered by Gemini ·

@github-actions

Copy link
Copy Markdown
Contributor

💥 Smoke Test: Claude — Run 27718402567

Core #1-12: ✅ all passed
PR Review #13-18: ✅ all passed
#19 Close PR: ⚠️ skipped (no safe disposable PR)

Overall: PARTIAL (1 skipped) — Claude engine nominal! 🚀

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude ·

@github-actions github-actions Bot 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.

💥 Automated smoke test review - all systems nominal!

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude

env:
REPO_NAME: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
GITHUB_REPOSITORY: ${{ github.repository }}

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.

Smoke test: standardizing on GITHUB_REPOSITORY/GITHUB_SERVER_URL env names is a nice consistency improvement. ✅

SERVER_URL_STRIPPED="${SERVER_URL#https://}"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
echo "Git configured with standard GitHub Actions identity"
run: bash "${RUNNER_TEMP}/gh-aw/actions/configure_git_credentials.sh"

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.

Smoke test: extracting git config to a shared script reduces duplication across lock files. 👍

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Codex - 27718402592
✅ PR fetch
❌ Serena symbol search
✅ Playwright
✅ Web fetch
✅ File/Bash/Build/Memory
⚪ Issue field skipped
Overall: FAIL

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex ·

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Cache wakes at dawn
Builds hum through the quiet wire
Smoke drifts into light

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex ·

@github-actions

Copy link
Copy Markdown
Contributor

PR titles only:

  • fix: add git safe.directory and refactor git config to shell script to resolve dubious ownership error
  • Suppress ANSI installer colors in CI and explicit no-color environments
  • Improve copilot billing tip: add org requirement note and billing docs link
    ✅ 2,3,4,5,6,7,8,9,11,12,13,14,15
    ❌ 1,10
    Overall: FAIL
    Author: app/copilot-swe-agent
    Assignees: pelikhan, Copilot

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot ·

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Stone bot hit black keys
Smoke moon watch green build fire dance
Git cave echo pass

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot ·

@github-actions github-actions Bot 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.

Smoke pass notes left inline.

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Tests 27718503421:\n• "Suppress ANSI installer colors in CI and explicit no-color environments": ✅\n• "Revert safe-outputs MCP transport to agent-job HTTP sidecar": ✅\n• Serena find_symbol: ❌\n• Other tests (Playwright, curl, file, discussion, build): ✅\nOverall: FAIL\ncc @app/copilot-swe-agent @pelikhan @Copilot

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

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

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot - AOAI (Entra) ·

@github-actions github-actions Bot mentioned this pull request Jun 18, 2026
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.

4 participants