Skip to content

fix(executor-e2e): self-diagnose GitHub issue-filing auth failures#1401

Merged
jamesadevine merged 1 commit into
mainfrom
jamesadevine/executor-e2e-issue-diagnostics
Jul 7, 2026
Merged

fix(executor-e2e): self-diagnose GitHub issue-filing auth failures#1401
jamesadevine merged 1 commit into
mainfrom
jamesadevine/executor-e2e-issue-diagnostics

Conversation

@jamesadevine

Copy link
Copy Markdown
Collaborator

What

When the deterministic executor-e2e suite fails, it files a GitHub issue. Until now, an auth/permission problem surfaced only as an opaque HTTP 401 / HTTP 403 in the ADO log — giving no way to tell whether the token was revoked, under-permissioned, or aimed at the wrong repo. This turned every occurrence into a guessing game.

Change

fileFailureIssue now:

  • logs the resolved target repo up front (it can come from a definition variable or the YAML default, and a wrong target is a common cause);
  • on any 401/403, probes GET /user and emits an actionable diagnosis:
    • 401 → token invalid/expired/revoked (GitHub auto-revokes plaintext-shared tokens) → generate a fresh one;
    • 403 with a successful /user → authenticated as <login> but lacks Issues:write on the target repo (or, for a fine-grained PAT, a resource-owner / repository-access mismatch), including the x-accepted-github-permissions header.

The diagnosis is best-effort and never throws; the original error is still rethrown so the WARNING keeps the raw status. Issue filing remains non-fatal.

Tests

Adds unit coverage for both the 401-revoked and 403-missing-permission paths. Full src/executor-e2e suite: 22 passing; tsc --noEmit clean; bundle builds.

The harness previously surfaced only an opaque 'HTTP 401/403' when issue
filing failed, forcing operators to guess whether the token was revoked,
under-permissioned, or pointed at the wrong repo.

Now fileFailureIssue logs the resolved target repo up front, and on any
401/403 probes GET /user to emit an actionable diagnosis:
- 401 -> token invalid/expired/REVOKED; generate a fresh one
- 403 with successful /user -> authenticated as '<login>' but lacks
  Issues:write on the target repo (or fine-grained resource-owner/repo-access
  mismatch), including the accepted-permissions header

Adds unit coverage for both the 401-revoked and 403-missing-permission paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine force-pushed the jamesadevine/executor-e2e-issue-diagnostics branch from 3c16148 to 7a01610 Compare July 7, 2026 21:28
@jamesadevine jamesadevine merged commit 6967da7 into main Jul 7, 2026
2 checks passed
@jamesadevine jamesadevine deleted the jamesadevine/executor-e2e-issue-diagnostics branch July 7, 2026 21:31
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.

1 participant