Skip to content

Revert org-billed Copilot CLI opt-in and restore max-ai-credits to -1#1473

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers/revert-copilot-requests-write
Jun 16, 2026
Merged

Revert org-billed Copilot CLI opt-in and restore max-ai-credits to -1#1473
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers/revert-copilot-requests-write

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Jun 16, 2026

Copy link
Copy Markdown
Member

What

Two reverts to the java-interop-reviewer workflow:

  1. Revert the org-billed Copilot CLI opt-in from Use GITHUB_TOKEN for Copilot CLI inference in agentic workflows #1469. Removes copilot-requests: write from .github/workflows/java-interop-reviewer.md, which switches Copilot CLI inference back from the built-in GITHUB_TOKEN to the stored PAT (secrets.COPILOT_GITHUB_TOKEN).
  2. Revert max-ai-credits from 100M back to -1 (truly unlimited / disabled). Fix PR reviewer auth: cap max-ai-credits at 100M instead of -1 #1472 capped it at 100M based on a theory that -1 was the cause of the auth 403, but the 403 reproduced under 100M too — the cap was not the issue and -1 is the preferred value.

The lock file (.github/workflows/java-interop-reviewer.lock.yml) is regenerated via gh aw compile java-interop-reviewer to reflect both changes.

The gh-aw CLI v0.79.8 bump and the agentics-maintenance.yml updates from #1469 are intentionally left in place — only the org-billed-CLI opt-in is being reverted.

Why

The "GITHUB_TOKEN-billed-to-org" feature (changelog) requires the "Allow use of Copilot CLI billed to the organization" Copilot policy to be enabled at the org level. The dotnet org has not enabled that policy yet, so after #1469 merged the workflow started failing with HTTP 403 from api.githubcopilot.com/models:

Re-adding the COPILOT_GITHUB_TOKEN secret to the copilot-pr-reviewer environment is faster than getting the org policy enabled, so we revert to the PAT-based flow for now.

Verification

Regenerated java-interop-reviewer.lock.yml confirms the expected changes:

  • COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} (was ${{ github.token }}) in both the agent and threat-detection jobs.
  • copilot-requests: write removed from both jobs' permissions: blocks.
  • S2STOKENS: true env (the org-billed-CLI signal) removed from both jobs.
  • SECRET_COPILOT_GITHUB_TOKEN re-added to the redaction step.
  • GH_AW_MAX_AI_CREDITS: "-1" (was "100000000"); apiProxy.maxAiCredits and enableTokenSteering removed from the firewall config.

Follow-up (manual)

After this merges, re-add the COPILOT_GITHUB_TOKEN secret to the copilot-pr-reviewer environment so the PAT-based flow works again. The user will do that manually — no secret values are touched in this PR.

Copilot AI review requested due to automatic review settings June 16, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Reverts the java-interop-reviewer agentic workflow’s opt-in to org-billed Copilot CLI inference by removing the copilot-requests: write permission and regenerating the compiled lock workflow to use the PAT-backed COPILOT_GITHUB_TOKEN secret again.

Changes:

  • Removed copilot-requests: write from the workflow permissions.
  • Regenerated java-interop-reviewer.lock.yml to restore COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}, remove S2STOKENS: true, and re-add secret redaction wiring.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/java-interop-reviewer.md Removes copilot-requests: write from the agentic workflow permissions.
.github/workflows/java-interop-reviewer.lock.yml Regenerated compiled workflow to switch Copilot inference back to secrets.COPILOT_GITHUB_TOKEN and remove org-billed signals/permissions.

jonathanpeppers added a commit to dotnet/android-tools that referenced this pull request Jun 16, 2026
The "GITHUB_TOKEN-billed-to-org" feature
(https://github.blog/changelog/2026-06-11-agentic-workflows-no-longer-need-a-personal-access-token/)
requires the "Allow use of Copilot CLI billed to the organization"
Copilot policy to be enabled at the org level. The `dotnet` org has
not enabled that policy yet, so the GITHUB_TOKEN flow returns HTTP 403
from `api.githubcopilot.com/models`.

Re-adding the `COPILOT_GITHUB_TOKEN` secret to the
`copilot-pr-reviewer` environment is faster than getting the org
policy enabled, so revert to the PAT-based flow for now.

Only the `copilot-requests: write` line in the workflow markdown is
reverted. The gh-aw CLI v0.79.8 bump from the earlier commit and the
AIC guardrail tweaks are intentionally left in place.

Mirrors dotnet/java-interop#1473.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Jun 16, 2026
Matches dotnet/java-interop#1473. The "GITHUB_TOKEN-billed-to-org" feature requires the "Allow use of Copilot CLI billed to the organization" Copilot policy to be enabled at the org level, and the dotnet org has not enabled it yet — so without that policy the workflows fail with HTTP 403 from api.githubcopilot.com/models.

This commit removes copilot-requests: write from both agentic workflow markdown files and regenerates the lock files. COPILOT_GITHUB_TOKEN: secrets.COPILOT_GITHUB_TOKEN is restored, SECRET_COPILOT_GITHUB_TOKEN is re-added to the redaction step, and the gh-aw v0.79.8 + max-ai-credits/max-daily-ai-credits changes from earlier commits on this branch are intentionally retained.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PR #1469 added `copilot-requests: write` to the java-interop-reviewer
workflow permissions block to opt into the new feature where gh-aw uses
the built-in GITHUB_TOKEN for Copilot CLI inference, with AI credits
billed to the org.

That feature requires the "Allow use of Copilot CLI billed to the
organization" Copilot policy to be enabled at the org level. The dotnet
org has not enabled that policy yet, so the workflow now fails with HTTP
403 from api.githubcopilot.com/models. See failing run:
https://github.com/dotnet/java-interop/actions/runs/27628125187/job/81695629467

Revert just the opt-in line in java-interop-reviewer.md and recompile
the lock file. After this merges, the COPILOT_GITHUB_TOKEN secret needs
to be re-added to the copilot-pr-reviewer environment so the PAT-based
flow works again.

Also revert max-ai-credits from 100M back to -1 (truly unlimited). PR
#1472 capped it at 100M based on a wrong theory that -1 was causing the
auth 403; that 403 reproduced under 100M too, so the cap wasn't the
issue and the user prefers -1.

The gh-aw CLI v0.79.8 bump and the agentics-maintenance.yml updates
from PR #1469 are intentionally left in place.

See: https://github.blog/changelog/2026-06-11-agentic-workflows-no-longer-need-a-personal-access-token/

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers force-pushed the jonathanpeppers/revert-copilot-requests-write branch from c677f51 to 667e566 Compare June 16, 2026 16:04
@jonathanpeppers jonathanpeppers changed the title Revert "copilot-requests: write" opt-in for Copilot CLI inference Revert org-billed Copilot CLI opt-in and restore max-ai-credits to -1 Jun 16, 2026
jonathanpeppers added a commit to dotnet/android-tools that referenced this pull request Jun 16, 2026
Earlier commit capped at 100M based on a theory that `-1` was the cause
of the auth 403. The 403 reproduced under `100M` too, so the cap was
not the issue and `-1` (truly unlimited / disabled) is the preferred
value.

Mirrors the second revert in dotnet/java-interop#1473.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, thanks! label Jun 16, 2026
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Jun 16, 2026
Matches the latest force-push on dotnet/java-interop#1473. The 100M cap from dotnet#1472 was only needed when running on the GITHUB_TOKEN-billed-to-org flow, where the AWF api-proxy required token steering to inject Copilot provider credentials. Now that this branch reverts to the PAT-based flow (secrets.COPILOT_GITHUB_TOKEN), token steering is no longer in the path, so -1 is safe and matches dotnet#1471's original intent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers merged commit cdfcb13 into main Jun 16, 2026
1 of 2 checks passed
@jonathanpeppers jonathanpeppers deleted the jonathanpeppers/revert-copilot-requests-write branch June 16, 2026 17:16
jonathanpeppers added a commit to dotnet/android that referenced this pull request Jun 16, 2026
## What

Disables the AI-credit guardrails for both agentic workflows. Two-line frontmatter delta per workflow:

```yaml
max-daily-ai-credits: -1
max-ai-credits: -1
```

Applied to:

- `.github/workflows/android-reviewer.md`
- `.github/workflows/nightly-fix-finder.md`

`gh aw compile` then regenerates the `*.lock.yml` files, `.github/aw/actions-lock.json`, and `.github/workflows/agentics-maintenance.yml` (the latter two also pick up a routine `gh-aw` CLI bump from `v0.79.6` → `v0.79.8`).

Mirrors [dotnet/java-interop#1471](dotnet/java-interop#1471) + [#1473](dotnet/java-interop#1473).

## Verification

`git diff origin/main...HEAD --stat`:

```
.github/aw/actions-lock.json                  | 12 ++--
.github/workflows/agentics-maintenance.yml    | 43 ++++++-------
.github/workflows/android-reviewer.lock.yml   | 89 +++++++++------------------
.github/workflows/android-reviewer.md         |  2 +
.github/workflows/nightly-fix-finder.lock.yml | 89 +++++++++------------------
.github/workflows/nightly-fix-finder.md       |  2 +
```

The only hand-authored change is the four added lines above. Everything else is mechanical output of `gh aw compile`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, thanks!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants