fix(handlers): return 501 for GitHub token on Gitea deployments (#388) #447

Closed
fullstack-engineer wants to merge 1 commits from fix/388-github-token-501-gitea-staging into staging

1 Commits

Author SHA1 Message Date
247204a036 fix(handlers): return 501 for GitHub token on Gitea deployments (#388)
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
sop-tier-check / tier-check (pull_request) Failing after 12s
audit-force-merge / audit (pull_request) Has been skipped
On Gitea-canonical deployments GITHUB_APP_ID/INSTALLATION_ID/PRIVATE_KEY_FILE
are unset, so generateAppInstallationToken() returns an error with "required"
in the message. Previously this fell through to a generic 500 "token refresh
failed" — callers had no way to distinguish a permanent misconfiguration
from a transient error.

The fix: detect the "required" substring and return 501 Not Implemented
+ scm:"gitea". Callers can now branch on this and surface a clear
"GitHub not configured" message instead of retrying indefinitely.

Test updated: TestGitHubToken_NoTokenProvider now asserts 501 + scm:gitea.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 09:33:09 +00:00