CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

feat(ai): migrate generator/PR call sites to callModel #5629

Merged⚡ AI-generatedXSccantynz wants to mergefeat/ai-metering-migrate-generatorsmainopened 18h ago
ccantynzcommented 18h ago

Routes nine generator/PR-surface AI callers through the metered callModel() wrapper (spend gate → messages.create → outage note → cost record) instead of holding a raw getAnthropic() client.

Migrated

File Category Attribution added
src/lib/ai-generators.ts other — (none in scope)
src/lib/ai-tests.ts test_gen — (none in scope)
src/lib/ai-test-generator.ts test_gen repositoryId
src/lib/ai-release-notes.ts other repositoryId
src/lib/repo-onboarding.ts other repositoryId
src/lib/pr-splitter.ts other sourceId/sourceKind (PR id)
src/lib/pr-slash-commands.ts other repositoryId
src/lib/pr-risk.ts ai_review — (none in scope)
src/lib/smart-digest.ts standup ownerUserId

Requests are byte-identical (same model via model:/modelForTask, same max_tokens/messages); every file keeps its existing error handling and degradation paths.

Legacy list

Six fully-clean files leave LEGACY_DIRECT_CALLERS in ai-metering-coverage.test.ts. Three files — ai-test-generator.ts, ai-release-notes.ts, pr-slash-commands.ts — keep a direct .messages.create ONLY on their injected-fake-client test path (production path routes through callModel), so the dumb matcher still sees them and their list lines stay, per the test's own rules.

Verification

  • bunx tsc --noEmit — clean
  • bun test on 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 green
  • bun build src/index.ts --target=bun — bundles clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01D9yjyzookEX3DLwpQmFhvu

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.

Analyze →
⮌ Merged

This pull request was merged into main.

c comment · e edit title · m merge · a approve · r request changes · ? shortcuts