[PR #246] [MERGED] fix: handle GitHub API rate limits in account age check #301

Closed
opened 2026-02-15 17:16:45 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/openclaw/clawhub/pull/246
Author: @superlowburn
Created: 2/12/2026
Status: Merged
Merged: 2/12/2026
Merged by: @steipete

Base: mainHead: fix/github-account-lookup-rate-limit


📝 Commits (2)

  • 4e644ad fix: handle GitHub API rate limits in account age check
  • 24278ac fix: stabilize GitHub account gate tests and docs

📊 Changes

5 files changed (+103 additions, -5 deletions)

View changed files

📝 convex/lib/githubAccount.test.ts (+79 -3)
📝 convex/lib/githubAccount.ts (+13 -2)
📝 docs/deploy.md (+1 -0)
📝 docs/security.md (+4 -0)
📝 docs/troubleshooting.md (+6 -0)

📄 Description

Summary

  • requireGitHubAccountAge makes unauthenticated GitHub API requests (60 req/hr per IP). Since this runs server-side in Convex, all users share the same server IP and quickly exhaust the rate limit, causing "GitHub account lookup failed" errors during skill publish.
  • Detect 403/429 responses and throw a clear "rate limit exceeded" error instead of the generic "GitHub account lookup failed"
  • Support an optional GITHUB_TOKEN env var for authenticated requests (5,000 req/hr), avoiding the shared rate limit entirely

Test plan

  • All 7 existing + new unit tests pass (vitest run convex/lib/githubAccount.test.ts)
  • New tests cover: 403 rate limit, 429 rate limit, and GITHUB_TOKEN auth header inclusion
  • Existing test updated to be explicit about HTTP status code
  • Deploy and verify GITHUB_TOKEN env var resolves the rate limit for production traffic

Fixes #155

🤖 Generated with Claude Code

Greptile Overview

Greptile Summary

This PR updates the Convex-side requireGitHubAccountAge check to (1) optionally use an authenticated GitHub API request when GITHUB_TOKEN is set and (2) surface a clearer error message when GitHub responds with rate-limiting statuses (403/429). Unit tests were updated/added to assert 404 lookup failure behavior, rate-limit handling, and Authorization header inclusion.

These changes live in convex/lib/githubAccount.ts and are consumed by publish flows (e.g., convex/lib/skillPublish.ts / convex/lib/soulPublish.ts) to gate publishing based on GitHub account age.

Confidence Score: 4/5

  • This PR is close to merge-ready, with one test isolation issue to address.
  • Core logic change is small and covered by new unit tests, but the new env-stubbing test can leak GITHUB_TOKEN into later tests in the same worker process, making the suite order-dependent.
  • convex/lib/githubAccount.test.ts

Last reviewed commit: 4e644ad

Context used:

  • Context from dashboard - AGENTS.md (source)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/openclaw/clawhub/pull/246 **Author:** [@superlowburn](https://github.com/superlowburn) **Created:** 2/12/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@steipete](https://github.com/steipete) **Base:** `main` ← **Head:** `fix/github-account-lookup-rate-limit` --- ### 📝 Commits (2) - [`4e644ad`](https://github.com/openclaw/clawhub/commit/4e644adb4c43e100cec3843e686dc8ae96b2aae4) fix: handle GitHub API rate limits in account age check - [`24278ac`](https://github.com/openclaw/clawhub/commit/24278ac2b18f98b1a2557bcd00b5e419f25d00f6) fix: stabilize GitHub account gate tests and docs ### 📊 Changes **5 files changed** (+103 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `convex/lib/githubAccount.test.ts` (+79 -3) 📝 `convex/lib/githubAccount.ts` (+13 -2) 📝 `docs/deploy.md` (+1 -0) 📝 `docs/security.md` (+4 -0) 📝 `docs/troubleshooting.md` (+6 -0) </details> ### 📄 Description ## Summary - `requireGitHubAccountAge` makes unauthenticated GitHub API requests (60 req/hr per IP). Since this runs server-side in Convex, all users share the same server IP and quickly exhaust the rate limit, causing "GitHub account lookup failed" errors during skill publish. - Detect 403/429 responses and throw a clear "rate limit exceeded" error instead of the generic "GitHub account lookup failed" - Support an optional `GITHUB_TOKEN` env var for authenticated requests (5,000 req/hr), avoiding the shared rate limit entirely ## Test plan - [x] All 7 existing + new unit tests pass (`vitest run convex/lib/githubAccount.test.ts`) - [x] New tests cover: 403 rate limit, 429 rate limit, and `GITHUB_TOKEN` auth header inclusion - [x] Existing test updated to be explicit about HTTP status code - [ ] Deploy and verify `GITHUB_TOKEN` env var resolves the rate limit for production traffic Fixes #155 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the Convex-side `requireGitHubAccountAge` check to (1) optionally use an authenticated GitHub API request when `GITHUB_TOKEN` is set and (2) surface a clearer error message when GitHub responds with rate-limiting statuses (403/429). Unit tests were updated/added to assert 404 lookup failure behavior, rate-limit handling, and Authorization header inclusion. These changes live in `convex/lib/githubAccount.ts` and are consumed by publish flows (e.g., `convex/lib/skillPublish.ts` / `convex/lib/soulPublish.ts`) to gate publishing based on GitHub account age. <h3>Confidence Score: 4/5</h3> - This PR is close to merge-ready, with one test isolation issue to address. - Core logic change is small and covered by new unit tests, but the new env-stubbing test can leak `GITHUB_TOKEN` into later tests in the same worker process, making the suite order-dependent. - convex/lib/githubAccount.test.ts <sub>Last reviewed commit: 4e644ad</sub> <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=a1d58d20-b4dd-4cbb-973a-9fd7824e1921)) <!-- /greptile_comment --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 17:16:45 -05:00
yindo closed this issue 2026-02-15 17:16:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/clawhub#301