feat(ai): migrate chat/editor call sites to callModel #5628
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
Moves eight direct
getAnthropic()+messages.create()callers onto the meteredcallModel()wrapper (budget refusal → create → outage note → cost recording), shrinkingLEGACY_DIRECT_CALLERSby eight.Migrated
src/lib/ai-chat.ts(2 calls)chatsrc/lib/ai-pair.ts(2 calls)chatsrc/lib/ai-completion.tsothersrc/lib/ai-explain.tsotherrepositoryIdthreaded fromexplainCodebasesrc/lib/ai-workspace.ts(2 calls)otherjob.repoId+triggeredByUserIdthreaded from the pipelinesrc/lib/nl-search.ts(2 calls)otherrepoIdthreaded fromnlSearchsrc/lib/claude-semantic-search.tsotherrepoIdthreaded fromclaudeSemanticSearchsrc/routes/ai-editor.ts(3 routes)otherrequireAuth)Behavior preserved
model:), system, messages, max_tokens, temperature..messages.stream(calls in any of these files — nothing left on the legacy list for them.Verification
bunx tsc --noEmitcleanbun test ai-metering-coverage ai-budget-enforcement— 6 passbun test ai-explain copilot specs semantic-search— 57 passbun build src/index.ts --target=bunclean🤖 Generated with Claude Code
https://claude.ai/code/session_01D9yjyzookEX3DLwpQmFhvu