feat(ai): migrate generator/PR call sites to callModel #5629
ccantynzAI Reviewcommented 18h ago
AI Triage
(no summary)
Priority: medium Risk area: mixed
Suggested labels: (no label suggestions) Suggested reviewers: (no reviewer suggestions)
Suggestions only — nothing has been applied. The PR author stays in control.
gluecron[bot]🤖 botAI Reviewcommented 18h ago
AI review unavailable
The platform's AI balance is exhausted, so AI generation is temporarily unavailable. Nothing was lost. You can queue this as a repair for the internal agent from the repository's Health page, or try again once the balance is restored. The PR is otherwise unchanged.
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Routes nine generator/PR-surface AI callers through the metered
callModel()wrapper (spend gate →messages.create→ outage note → cost record) instead of holding a rawgetAnthropic()client.Migrated
src/lib/ai-generators.tsothersrc/lib/ai-tests.tstest_gensrc/lib/ai-test-generator.tstest_genrepositoryIdsrc/lib/ai-release-notes.tsotherrepositoryIdsrc/lib/repo-onboarding.tsotherrepositoryIdsrc/lib/pr-splitter.tsothersourceId/sourceKind(PR id)src/lib/pr-slash-commands.tsotherrepositoryIdsrc/lib/pr-risk.tsai_reviewsrc/lib/smart-digest.tsstandupownerUserIdRequests are byte-identical (same model via
model:/modelForTask, samemax_tokens/messages); every file keeps its existing error handling and degradation paths.Legacy list
Six fully-clean files leave
LEGACY_DIRECT_CALLERSinai-metering-coverage.test.ts. Three files —ai-test-generator.ts,ai-release-notes.ts,pr-slash-commands.ts— keep a direct.messages.createONLY on their injected-fake-client test path (production path routes throughcallModel), so the dumb matcher still sees them and their list lines stay, per the test's own rules.Verification
bunx tsc --noEmit— cleanbun teston metering-coverage, budget-enforcement, ai-tests, ai-test-generator, ai-release-notes, pr-risk (+head-pinning, +range-diff), pr-slash-commands, release-notes-batching, migration-onboarding, digest-nav-honesty, email-digest, merge-path-ai-reachability — all greenbun build src/index.ts --target=bun— bundles clean🤖 Generated with Claude Code
https://claude.ai/code/session_01D9yjyzookEX3DLwpQmFhvu