Repository navigation
docs: gmi() accepts budget; it refuses voice, avatar and channels - #625
Conversation
gmi() and agent({ runtime: 'gmi' }) have taken `budget` since #382: the
completion gateway checks every step of a turn against it and the GMI's
provider manager every metaprompt call. GMI.md and COST_OPTIMIZATION.md
still said the GMI path throws when it is given a budget. The options it
refuses at construction are voice, avatar and channels.
GMI.md also listed the per-call options of generate() and stream()
without abortSignal and budget, and the options of a session's send()
and stream() without budget, though the GMI path takes them. A new Spend
budget paragraph in GMI.md, and an On a GMI paragraph in
COST_OPTIMIZATION.md, say what the GMI path does with a budget,
including the error a refused step ends the turn with.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDocumentation now accurately describes GMI support for shared and per-call spend budgets, its unsupported construction options, API option surfaces, enforcement points, accounting, and error behavior. Sequence diagram for GMI spend budget enforcementsequenceDiagram
participant Caller
participant GMI
participant Gateway as CompletionGateway
participant Manager as ProviderManager
participant Provider
participant Budget as SpendBudget
Caller->>GMI: agent.generate() or session.send()
GMI->>Gateway: completion call
Gateway->>Budget: check completion budget
alt budget permits step
Gateway->>Provider: send completion request
Provider-->>Gateway: result or billed failure
Gateway->>Budget: record finished or billed step
Gateway-->>GMI: completion result
else budget refuses step
Gateway-->>GMI: LLM_PROVIDER_ERROR
GMI-->>Caller: reject or stream error part
end
GMI->>Manager: metaprompt call
Manager->>Budget: check metaprompt budget
alt budget permits metaprompt
Manager->>Provider: send metaprompt request
Provider-->>Manager: metaprompt result
Manager->>Budget: record metaprompt call
else budget refuses metaprompt
Manager-->>GMI: leave turn reply unchanged
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history |
PR Summary by QodoDocument GMI spend budgets and supported options
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Budget options and validation docs/GMI.md, docs/safety/COST_OPTIMIZATION.md |
The documentation describes accepted budget settings and validation, session and one-shot budget options, and one-shot abortSignal behavior. |
GMI spend-budget behavior docs/GMI.md, docs/safety/COST_OPTIMIZATION.md |
The documentation describes shared and per-call budgets, checks and cost recording for completion and metaprompt calls, refusal outcomes, limit callback labels, and excluded embedding calls. |
Priority:
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Other
Merge Risk: 
Minimal · up to a7abf
-
The documentation updates present no identified merge-blocking risk.
Pre-merge checks: 
4
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
On the GMI path a refusal for a model with no price row ends the turn with the GMI's LLM_PROVIDER_ERROR error as a cap refusal does, so neither error class reaches the caller.
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
gmi()andagent({ runtime: 'gmi' })have takenbudgetsince #382 merged on 16 October. The completion gateway checks every step of a turn against it, and the GMI's provider manager checks every metaprompt call. Two pages still said the GMI path throws when it is given a budget:docs/GMI.md: the comparison table and the Construction paragraph.docs/safety/COST_OPTIMIZATION.md: the spend budget section.The options
gmi()refuses at construction arevoice,avatarandchannels. This change makes both pages say so, and says what the GMI path does with a budget:docs/GMI.mdgets a Spend budget paragraph, which thegmi()doc comment already refers to. It covers the agent's budget and the per-call and per-send ones, what is checked and recorded, and the error a refused step ends the turn with. That error is the GMI'sLLM_PROVIDER_ERRORerror, notCostCapExceededError.docs/GMI.mdalso listed the per-call options ofgenerate()andstream()withoutabortSignalandbudget, and said they throw on any other option. It listed the options of a session'ssend()andstream()withoutbudget. All of these lists now match the code.docs/safety/COST_OPTIMIZATION.mdgets an On a GMI paragraph with the same facts, and notes that a session'ssend()andstream()take abudgeton both runtimes.docs/API_PATHS.mdcarries the same claim. #617 already fixes it on its own branch, so this change leaves that page alone. docs.agentos.sh builds these two pages from this repository, so the site keeps no copies to fix.Linked issues
None.
Type of change
How this was verified
Every sentence was checked against master (41e2ded):
src/api/gmi.ts(UNSUPPORTED_ON_GMI, the per-call options, the budget check before each attempt, the session'ssend()andstream()),src/api/runtime/gatewayProviderManager.ts,src/api/runtime/gmiSession.tsandsrc/api/runtime/spendBudget.ts.src/api/__tests__/gmi-runtime.budget.test.tsalready covers the behavior the pages describe. The rest is this pull request's CI.Migration notes
None.
Checklist
!before the colon for a change that breaks users (feat!:orfeat(api)!:).Summary by Sourcery
Clarify GMI capabilities and spend-budget behavior across the user-facing documentation.
Documentation:
Summary by CodeRabbit