Skip to content

compiled lock files hardcode github.token in Configure Git credentials steps -- breaks in sandboxed runners #25345

Closed

Description

@adamhenson

When gh aw compile generates a lock file, the two "Configure Git credentials" steps use ${{ github.token }} directly in the git remote set-url command. In sandboxed runner environments where github.token lacks push scope (or where a dedicated PAT is used for write operations), this causes all git push operations from the agent job to fail silently.

Current workaround: patch the lock file post-compile to replace github.token with a scoped secret (e.g. secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN). This patch is wiped on every gh aw compile run.

Repro:

  1. Run gh aw compile on any workflow that pushes commits or branches
  2. Inspect the generated .lock.yml — the Configure Git credentials steps hardcode ${{ github.token }}
  3. In a runner where github.token does not have push access (e.g. org-level branch protection, sandboxed token scope), the agent job silently fails on git push

Proposed fix: emit the token reference as a configurable input in the workflow frontmatter (e.g. push-token: ${{ secrets.MY_PAT }}), or inject via an env var rather than hardcoding github.token in the compiled output.

Activity

  1. locked and limited conversation to collaborators on Apr 8, 2026
  2. unlocked this conversation on Apr 8, 2026
  3. pelikhan commented on Apr 10, 2026

    @pelikhan
    Collaborator

    @adamhenson there should not be git push operations from the agent job. Could you give more details about your scenario?

  4. adamhenson commented on Apr 10, 2026

    @adamhenson
    Author

    Thanks for all your help @pelikhan! I've been unable to get push_to_pull_request_branch working on v0.55.0 (claude engine, GH_AW_GITHUB_TOKEN set with contents+PR write). It consistently fails with fatal: could not read Username for 'https://github.com': No such device or address. create_pull_request works fine in the same environment, so it seems specific to the push tool.

    Ruled out: wrong token type, missing github.com in network.allowed, and cancel-in-progress cancelling safe_outputs. None of those changed the behavior.

    Planning to build a minimal repro and file a proper issue. Feel free to close this in the meantime if it's already a known issue or expected config gap on my end.

  5. pelikhan commented on Apr 10, 2026

    @pelikhan
    Collaborator

    Can you try upgrading just so that we are on a fresh release?

  6. locked and limited conversation to collaborators on Apr 10, 2026
  7. unlocked this conversation on Apr 10, 2026
  8. adamhenson commented on Apr 10, 2026

    @adamhenson
    Author

    @pelikhan I upgraded to v0.67.4 - push_to_pull_request_branch is working correctly now. The upgrade resolved it cleanly; no other changes needed on my end.

    Great project by the way, appreciate the quick response here.

  9. locked and limited conversation to collaborators on Apr 10, 2026
  10. unlocked this conversation on Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions