šŸ› fix: PR identity asks again when GitHub refuses the agent lookup (P-06)

Merged
AT
22d ago
+67-8

Slice: #28
State: #286

State #286 of P-06, a fix filed under the slice it fixes.

niyam / PR identity failed now and then with GitHub has no account "AthyaBot" (HTTP 403), and a re-run passed. It hit #269 and the 0.6.10 release pull request #272 on 2026-11-11. The account exists: the 403 was GitHub refusing GET /users/<login>. That lookup went without a token, so GitHub held it to the anonymous limit of the runner's shared address. A re-run lands on another runner, which is why it passed.

  • src/agent.ts: account() takes an optional token. On a 403, 429 or 5xx it asks again after 1, 2 and 4 seconds (ACCOUNT_WAITS_MS). A 404 still says GitHub has no account "X" (HTTP 404), and that is now the only case that does. When GitHub keeps refusing, or gives a 401 or an unreadable 200, it says GitHub did not answer who account "X" is (HTTP N). doctor, machine and onboard get the same retry and keep asking without a token.
  • src/identity.ts: pr-identity looks up each agent with the run's GH_TOKEN. This goes beyond retrying, and it is the change most likely to end the flake.
  • Tests: a 403, 429 or 502 followed by a 200 is asked again with the token, waiting once; an endless 403 waits each time, then says GitHub did not answer; a 404, 401 or bad 200 is asked once; pr-identity sends its token and asks again after a 403.

Watchers that match the old 403 text will now see did not answer who account "AthyaBot" is (HTTP 403) instead.

pnpm check passes (1322 tests; agent.ts and identity.ts 100% of lines).

šŸ¤– Generated with Claude Code


Summary by cubic

Fixes pr-identity failing intermittently with GitHub has no account "AthyaBot" (HTTP 403). GitHub was refusing the anonymous account lookup because the runner's shared address hit the anonymous rate limit; a re-run landed on another runner, which is why it passed. The lookup now uses the run's token and retries after 1, 2 and 4 seconds on a 403, 429 or 5xx.

  • doctor, machine and onboard get the same retry but keep asking without a token.
  • Only a 404 still says the account does not exist; other failures now say GitHub did not answer who account "X" is (HTTP N), so watchers matching the old 403 text will see the new message.