Skip to content

evals: /v1/decisions rejects fine-grained PATs, and the opaque "HTTP 400" hides why #75637

Done

Description

@johnwilliams-12

Summary

On a personal GitHub account that authenticates Copilot with a fine-grained PAT in COPILOT_GITHUB_TOKEN, every evals: judge run fails with Decisions request failed (HTTP 400). I reproduced the cause outside Actions: POST https://api.githubcopilot.com/v1/decisions answers HTTP 400 with the plain-text body checking third-party user token: bad request: Personal Access Tokens are not supported for this endpoint. The check happens before the model is validated, so no model name can work with a PAT.

decisions_client.cjs hides this on purpose (it never exposes provider bodies) and only parses JSON bodies, so a plain-text 400 becomes an unexplained failure. The run stays green because the judge step is continue-on-error, and the result is not_evaluated / judge_failed.

Two things are asked for:

  1. Make this failure self-explanatory, with a distinct reason code and an actionable message.
  2. Decide and document whether evals are supposed to work with PAT authentication, which the auth docs present as the way to use Copilot on personal repositories.

Environment

  • gh-aw v1.2.1 (CLI and github/gh-aw-actions), compiled with gh aw compile --strict.
  • Engine copilot, model gpt-6-luna.
  • Personal account, no organization.
  • COPILOT_GITHUB_TOKEN is a fine-grained PAT, resource owner the user account, Copilot Requests = Read, as described in docs/src/content/docs/reference/auth.mdx.

Minimal workflow

---
on:
  workflow_dispatch:
engine:
  id: copilot
  model: gpt-6-luna
permissions:
  contents: read
  copilot-requests: none
evals:
  questions:
    - id: named-purpose
      question: Did the run name the repository's purpose in one sentence?
safe-outputs:
  noop:
---

# Smoke test

Read README.md and call noop with one sentence that names what the repository is for.

Evidence

1. The failing job

Three runs of the same workflow (2026-11-06) all ended the same way. The agent and detection jobs succeeded, then the evals job log shows:

evals  Execute BinEval Decisions  env:
  GH_AW_DECISIONS_BASE_URL: https://api.githubcopilot.com/v1
  GH_AW_DECISIONS_API_KEY: ***
  GH_AW_DECISIONS_PROVIDER: github-copilot
  GH_AW_EVALS_MODEL: copilot/gpt-6-luna-decisions
evals  Execute BinEval Decisions  Error: Decisions request failed (HTTP 400)
evals  Execute BinEval Decisions      at invokeDecisions (.../gh-aw/actions/decisions_client.cjs:135:11)
evals  Execute BinEval Decisions  ##[error]Unhandled error: Error: Decisions request failed (HTTP 400)
evals  Execute BinEval Decisions      at async executeMain (.../gh-aw/actions/run_evals.cjs:115:16)

usage/evals/evals_status.json from gh aw logs:

{"status":"not_evaluated","reason_code":"judge_failed","reason":"The Decisions evals request finished with outcome failure; no answers were recorded.","engine":"decisions","model":"copilot/gpt-6-luna-decisions","execution_outcome":"failure","execution_state":"started"}

2. Direct reproduction against the endpoint

The request is built the way invokeDecisions builds it (POST <base>/decisions, Authorization: Bearer <key>, body {model, input, questions}). $PAT is a fine-grained PAT with Copilot Requests = Read, the same kind as the workflow's.

curl -sS -i https://api.githubcopilot.com/v1/decisions \
  -H "Authorization: Bearer $PAT" -H 'Content-Type: application/json' \
  -d '{"model":"gpt-6-luna-decisions","input":"x","questions":[{"type":"predicate","name":"q","instructions":"Is x a letter?"}]}'

Results, each a single request on 2026-11-06:

model in the request HTTP status content-type Body
gpt-6-luna-decisions 400 text/plain; charset=utf-8 checking third-party user token: bad request: Personal Access Tokens are not supported for this endpoint
gpt-6-luna 400 text/plain; charset=utf-8 the same line
not-a-real-model 400 text/plain; charset=utf-8 the same line

The identical answer for a made-up model shows that the token is rejected first. A valid model name can not fix it.

3. Why the message is lost

At v1.2.1, actions/setup/js/decisions_client.cjs:

  • line 121: if (!response.ok) {
  • lines 122-134: only for 400 and 422, response.json() is attempted. A SyntaxError (the body above is plain text) is swallowed on purpose, body stays undefined, so code is undefined and DecisionsModelUnavailableError is not thrown.
  • line 135: throw new Error(Decisions request failed (HTTP ${response.status})) runs with no detail.

In run_evals.cjs that error is not a DecisionsModelUnavailableError, so it is rethrown (line 127). classifyJudgeExecution then falls to the generic JUDGE_FAILED branch (line 162): "request finished with outcome failure". Nothing in the run points to the token.

4. Related issues checked

I searched github/gh-aw for the server message, judge_failed, gpt-6-luna-decisions and "evals HTTP 400". None describes this. Closest, none a duplicate:

Root cause

api.githubcopilot.com/v1/decisions refuses fine-grained PATs. The evals job passes ${{ secrets.COPILOT_GITHUB_TOKEN }} as GH_AW_DECISIONS_API_KEY (compiled workflow, Execute BinEval Decisions step), and the evals job has only permissions: contents: read. For the agent job a PAT works. For evals it can not, so a personal account has no documented way to run evals.

Not verified, because I have no organization:

  • Whether permissions: copilot-requests: write makes the evals job use github.token with a token the endpoint accepts. The docs say that mode needs an organization with centralized billing.
  • Whether the same endpoint accepts a GitHub App installation token or an OAuth token.

Proposed fix (plan for an agent)

Order matters: 1 and 2 are safe whatever the answer to the open question is.

  1. actions/setup/js/decisions_client.cjs (the !response.ok block around lines 121-135)
    • For 400, 401 and 403, read the body as text once (await response.text(), cap at 2 KB), then try JSON.parse on it for the existing error.code check.
    • If the text contains Personal Access Tokens are not supported, throw a new DecisionsAuthUnsupportedError. Keep the "never expose provider bodies" rule: the error message is a fixed string such as Decisions endpoint does not accept this kind of token (HTTP 400); the provider text is only used to choose the class and is not echoed.
    • Export the new class next to DecisionsModelUnavailableError.
  2. actions/setup/js/run_evals.cjs
    • In executeMain (around line 127), catch the new class like DecisionsModelUnavailableError, set evidence.state to a new EVALS_REASON_CODES.AUTH_UNSUPPORTED, and write the evidence file.
    • In classifyJudgeExecution (around lines 151-163) add a branch that returns a reason such as: The Decisions endpoint rejected the credential. It does not accept personal access tokens. Use an authentication method the endpoint supports, or remove evals from the workflow; no answers were recorded.
    • Make sure render_evals_summary.cjs shows the new reason and that gh aw logs/audit surface it as a finding (this is the point of audit: failed continue-on-error evals and threat-detection engine steps are invisible (pre-flight failures report as workflow_succeeded) #73552).
  3. Compiler warning (pkg/workflow, where evals is validated)
    • If evals is declared, the engine is copilot, and the workflow has no copilot-requests: write, print a warning during gh aw compile that the judge needs a credential the Decisions endpoint accepts. Make it an error under --strict only after the open question below is answered.
  4. Docs
    • docs/src/content/docs/reference/auth.mdx (COPILOT_GITHUB_TOKEN section, which now recommends the PAT for "personal repositories"): add a note that PATs do not work for evals.
    • The evals reference page: state which authentication the judge supports.
  5. Tests
    • decisions_client.test.cjs: 400 with content-type: text/plain and the body above gives DecisionsAuthUnsupportedError; the same status with an unrelated plain-text body still gives the generic error; JSON model_not_found still gives DecisionsModelUnavailableError.
    • run_evals.test.cjs: the new reason code appears in evals_status.json and in the classification of the execution outcome.
  6. Run make agent-finish.

Open questions for maintainers

  1. Is rejecting PATs on /v1/decisions intended? If yes, which credential should a personal-account workflow use for evals?
  2. If the answer is copilot-requests: write, can the evals job get that permission without the whole workflow using github.token for inference? (The workflow-level permission also switches the agent to github.token, which fails on personal accounts.)
  3. Should a failing evals judge fail the run? Today the run is green and the only trace is not_evaluated in the artifact.

Not checked

  • Behavior with a GitHub organization, with copilot-requests: write, or with non-PAT tokens.
  • Whether the server message wording is stable. The proposed classification matches on it, so it should be agreed with the service owners.
  • The exact bytes the evals job sends (I rebuilt the request from the source, not from a capture).

Activity

  1. locked and limited conversation to collaborators on Nov 7, 2026
  2. unlocked this conversation on Nov 7, 2026
  3. pelikhan commented on Nov 7, 2026

    @pelikhan
    Collaborator

    @lpcox not going through awf yet for this but awf maybe doing magic with the token to make things work

  4. lpcox commented on Nov 8, 2026

    @lpcox
    Collaborator

    🔗 AWF tracking issue: #aw_track2

    Generated by Firewall Issue Dispatcher · copilot · auto (Claude Sonnet 5.5) · ~21 AIC · ⊞ 5.7K · ◷

  5. lpcox commented on Nov 8, 2026

    @lpcox
    Collaborator

    🔗 AWF tracking issue: #aw_track2

    Generated by Firewall Issue Dispatcher · copilot · auto (Claude Sonnet 5.5) · ~21 AIC · ⊞ 5.7K · ◷

  6. pelikhan commented on Nov 8, 2026

    @pelikhan
    Collaborator

    @copilot make sure the copilot integration id is set to "agentic-workflows" when calling decisions the GitHub cloud

  7. pelikhan commented on Nov 8, 2026

    @pelikhan
    Collaborator

    it was missing Copilot-Integration-Id: agentic-workflows. PAT tested and working.

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