Skip to content

Clarify Copilot Decisions PAT support and rejection diagnostics - #11289

Merged
lpcox merged 3 commits into
mainfrom
copilot/awf-clarify-fine-grained-pat-support
Nov 8, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/awf-clarify-fine-grained-pat-support

Conversation

Copilot AI commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Copilot /v1/decisions rejects fine-grained PATs with a plain-text error that gh-aw evals reduces to an opaque HTTP 400. AWF forwards static credentials without exchanging PATs or bypassing endpoint restrictions.

  • Diagnostics: Add a fixed pat_unsupported reason and actionable warning for fully captured Copilot 4xx rejections. Preserve upstream response bytes and existing bounded, secret-redacted logging.
  • Documentation: Clarify port 10002 forwarding, PAT limitations, unverified OAuth/App-token acceptance, and the separate gh-aw client classification needed.
  • Regression coverage: Add local HTTP fixtures for static token injection, plain-text error preservation, and log redaction; cover unrelated, truncated, and uninspectable errors.

Example warning fields:

{
  "event": "upstream_error_response",
  "provider": "copilot",
  "status": 400,
  "reason_code": "pat_unsupported"
}

Copilot AI changed the title [WIP] Clarify fine-grained PAT support for Copilot decisions Clarify Copilot Decisions PAT support and rejection diagnostics Nov 8, 2026
Copilot AI requested a review from lpcox November 8, 2026 02:43
@lpcox
lpcox marked this pull request as ready for review November 8, 2026 03:02
Copilot AI adaptive review requested due to automatic review settings November 8, 2026 03:03

Copilot AI 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.

🟡 Changes recommended

A Copilot 400 on /v1/decisions still emits misleading advice to check key validity and formatting when the endpoint is rejecting the token type.

1 open issue
What changed in this PR

Clarifies Copilot Decisions authentication through AWF’s API proxy and adds actionable PAT-rejection diagnostics without changing upstream response forwarding.

Changes:

  • Adds pat_unsupported guidance for fully captured, inspectable Copilot 4xx rejections.
  • Documents token-forwarding behavior, credential limitations, and separate gh-aw client work.
  • Adds regression coverage for credential injection, plain-text error preservation, redaction, and classification boundaries.
File Description
docs/​auth-matrix.md Explains Decisions credential limitations and diagnostic behavior.
docs/​api-proxy-sidecar.md Adds a Decisions usage note linking to authentication details.
containers/​api-proxy/​upstream-log.test.js Covers PAT classification boundaries and audit fields.
containers/​api-proxy/​upstream-log.js Adds the fixed PAT-rejection reason and guidance.
containers/​api-proxy/​server.decisions.test.js Adds local HTTP fixtures for token injection, response preservation, and redaction.

Review effort: Max (auto)

Comment thread containers/api-proxy/upstream-log.js Outdated
Comment on lines +298 to +300
if (provider === 'copilot' && statusCode >= 400 && statusCode < 500 &&
!originalCapture.bodyOmitted && !originalCapture.truncated &&
/\bPersonal Access Tokens are not supported for this endpoint\b/i.test(originalCapture.bodyValue)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suppressed the generic Copilot 400 auth warning when the complete response matches the PAT rejection classification, while retaining the PAT-specific upstream error event. Added regression coverage for truncated captures. Commit: 18ffcf1.

@lpcox

lpcox commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

⏳ Copilot review left inline comments.

@copilot To proceed:

  1. Ask @copilot to address the review feedback (reply to this comment or the review thread)
  2. Once the fix is pushed, add the ready-for-aw label to trigger agentic CI smoke tests

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Documentation has been built for this PR.

Download preview artifact

To view locally:

  1. Download the docs-preview-pr-11289 artifact from the workflow run
  2. Unzip and open index.html in your browser

Built from commit adb00d1

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.80% 93.80% ➡️ +0.00%
Statements 92.35% 92.35% ➡️ +0.00%
Functions 93.02% 93.02% ➡️ +0.00%
Branches 86.68% 86.68% ➡️ +0.00%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 90.1% → 89.8% (-0.29%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[awf] api-proxy: clarify fine-grained PAT support for Copilot /v1/decisions (evals)

3 participants