Skip to content

create-agent-session require wants an OAuth Token #19099

Description

@abillingsley

I've modeled an agentic workflow after the test-copilot-create-agent-session workflow. I am encountering an Oauth Token error in that workflow. To troubleshoot I copied and compiled the test-copilot-create-agent-session.md as written, compiled it and dispatched that workflow.

In both cases the workflow runs and progresses through the agent job with no errors but the safe-outputs job fails with the following error

Found 1 create-agent-session item(s)
Task 1: Task description written to /tmp/gh-aw/agent-task-description-1.md
Task 1: Creating agent session with command: gh agent-task create --from-file /tmp/gh-aw/agent-task-description-1.md --base main
/usr/bin/gh agent-task create --from-file /tmp/gh-aw/agent-task-description-1.md --base main
this command requires an OAuth token. Re-authenticate with: gh auth login

In my repository, I have the following action repository environment variables and secrets

  • COPILOT_GITHUB_TOKEN: as created via gh aw secret bootstrap
  • GH_AW_GITHUB_TOKEN: is a fine-grained token that grants (used in other agentic workflow use cases I've got)
    • Contents → Read and write
    • Issues → Read and write
    • Pull requests → Read and write

I've also attempted to set a custom github-token to a secret I have defined as GH_AW_AGENT_SESSION_TOKEN

create-agent-session:
    github-token: ${{ secrets.GH_AW_AGENT_SESSION_TOKEN }}

The value of this secret is gh secret set GH_AW_AGENT_SESSION_TOKEN -a actions --body "$(gh auth token)" which is an attempt address the suggestion in the error output but the workflow still fails with the OAuth Error. I'd prefer to use a fine grained access token rather than an auth token. Looking at the code for create-agent-session I am not sure that I am seeing where the github-token attribute is used when preparing the gh agent-task create command which may be part of the problem in my attempt to set a custom token
https://github.com/ghraw/github/gh-aw/9cbca3cd9be433a23a38e4da332635097fd40251/actions/setup/js/create_agent_session.cjs

but I would also expect the safe output to work without a custom token as the test workflow would imply

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions