perf: AI 핸들러를 별도 Worker 호출로 분리하여 subrequest 예산 독립화#16
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
github | b49e8b1 | Commit Preview URL Branch Preview URL |
Apr 16 2026, 01:24 PM |
self-fetch + ctx.waitUntil() 패턴으로 tagPatterns, learningStatus, complexityAnalysis 각각을 별도 Worker invocation에서 실행하여 50 subrequest 제한을 공유하지 않도록 개선. Co-Authored-By: sounmind <noreply@users.noreply.github.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- tests/subrequest-budget.test.js: 5파일 PR 시나리오에서 tagPatterns(22회), postLearningStatus(15회) fetch 호출 수 검증 (Cloudflare 50 한도 하회) - handlers/internal-dispatch.test.js: 내부 디스패치 엔드포인트 인증·라우팅·에러 처리 테스트 - handlers/webhooks.test.js: AI 핸들러 self-fetch 디스패치 통합 테스트 추가 - AGENTS.md, README.md: AI 핸들러 Worker 분리 아키텍처 다이어그램 및 테스트 실행 가이드 - integration.yaml: vi.mock 전역 누출 회피를 위해 bun test handlers/, tests/ 를 별도 스텝으로 실행 - handlers/webhooks.js, wrangler.jsonc: WORKER_URL 을 명시적 env 로 요구하고 기본값은 wrangler vars 로 이동 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d01cfb5 to
aa3313d
Compare
describe/it 블록 제목을 모두 한국어로 통일. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sounmind
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
모든 AI 핸들러(tagPatterns, learningStatus, analyzeComplexity)가 하나의 Worker invocation에서 순차 실행되어 50 subrequest 제한을 공유하는 구조적 문제.
핸들러가 추가될수록 전체 subrequest 합산이 한도를 초과하게 되며, 다른 개발자의 변경사항이 기존 핸들러에 영향을 줌.
해결
self-fetch +
ctx.waitUntil()패턴으로 각 AI 핸들러를 별도 Worker invocation에서 실행./internal/tag-patterns,/internal/learning-status,/internal/complexity-analysis내부 엔드포인트 추가handlePullRequestEvent에서ctx.waitUntil(fetch(...))로 3개 핸들러를 병렬 디스패치X-Internal-Secret헤더로 내부 요청 인증INTERNAL_SECRET미설정 시 기존 방식(동일 invocation 순차 실행)으로 폴백필요한 설정
wrangler secret put INTERNAL_SECRET # 임의의 랜덤 문자열Test plan
INTERNAL_SECRET설정 후 PR opened 시 3개 AI 댓글이 정상 생성되는지 확인INTERNAL_SECRET미설정 시 기존 방식으로 폴백되는지 확인Closes #10
🤖 Generated with Claude Code