fix(skill-import): GitHub 匿名 API 限流导致真实 smoke 导入链路失败
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
本次 GitHub Actions 策略验证发现一个独立的稳定性问题。
复现证据:PR #3165 head 56930f8510625b568607291bb65f215b992aeefe,run 34263198826 attempt 1,fullstack-smoke job 102186016453。skill 目录导入返回 422 IMPORT_FETCH_FAILED;服务端日志明确为 api.github.com HTTP 403,x-ratelimit-limit=60、remaining=0。随后目录/试跑出现三条连带失败。同树手动运行以及 main 最近三次 smoke 均成功,PR #3179 的 smoke 也成功。
代码位置:apps/api/src/infrastructure/skill/http-import-fetcher.ts 的请求仅设置 user-agent/accept,目前没有 GitHub 认证头;非 200 统一映射 IMPORT_FETCH_FAILED。CI runner 的匿名配额会影响真实导入验收。
建议在独立修复中:
- 为可信 GitHub API 请求提供最小权限、明确来源的服务端认证配置;认证信息不可随任意导入 URL 或重定向转发,不可出现在日志中。
- 根据 GitHub 的限流响应区分可重试失败,设置有界重试/等待,保留真实失败;不要无限重跑整个 CI。
- 增加针对限流响应及凭据传递边界的验证,保持两层 SSRF 检查。
本次 CI 拆分未改该应用路径;已按 SOP 仅定向重跑失败 smoke 一次。此问题作为后续独立修复跟踪,不把减少测试覆盖作为处理方式。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with apps/api/src/infrastructure/skill/http-import-fetcher.ts and trace the skill-directory import entry point, including its existing SSRF checks and error mapping. Verify how GitHub API responses and server configuration are handled, then add focused coverage for rate-limit responses and credential forwarding boundaries. Done means bounded retry behavior, safe authentication handling, preserved SSRF checks, and genuine failures still reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, typescript
- Domain
- backend-api-design, security, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100