GeezerVison is showing github.com — refactor(core): keep Go allowance out of messages and sessions by adamdotdevin · Pull Request #58765 · anomalyco/opencode
Conversation
adamdotdevin
commented
Oct 24, 2026
•
edited by opencode-agent
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
No issue. Follows the #core thread with Aiden about how session cost is modeled.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Removes the per-message and per-session allowance that #58562 added. That PR stored the Go allowance a request used as a second Money.USD field beside cost. But allowance is measured in the Go meters' units (list × $60 ÷ the model's Go limit), not dollars. Two same-typed fields that mean different things made cost confusing to consume. Subscription usage belongs in the usage limits API (#58694), which already backs the Go meters in the desktop Usage dialog and the TUI's /usage. Other subscriptions like Codex, ChatGPT and Copilot can plug in there later.
cost now means money only: what OpenCode Console charged, its BYOK estimate, or OpenCode's own price for providers it calls directly.
Follow-up: opencode-ios #170 reads allowance with decodeIfPresent, so its session sheet row just stops showing; I'll remove it there separately.
How did you verify your code works?
bun run check passes. bun run migration --check reports no drift.
- Provider tests (
@opencode/ai), the session usage, step, projector and v1-migration tests (@opencode/core), and the TUI feature-plugin tests all pass. The provider tests still send opencode.allowance the way Console does and assert only cost comes through.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Public API: removes allowance from Session.Info, assistant messages, step/usage events, @opencode/ai Usage and the TUI plugin data.session.allowance() (not backwards compatible for builds since #58562, but unreleased)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Messages and sessions stored the Go allowance a request used as a second Money.USD field beside cost, though it is in the Go meters' units rather than dollars. Cost now means money only: what OpenCode Console charged, its BYOK estimate, or OpenCode's own price. Subscription usage shows through the usage limits API instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks sound. It removes the allowance parts of #58562/#58565/#58566 and keeps the reported-cost behaviour (a reported 0 still beats the catalog price). I couldn't run it end to end: the removed displays only appear when Console reports Go allowance, which the simulated model doesn't send, and the CLI wouldn't start from source here. I checked that nothing still references the removed field, ran the core session/projector/migration, @opencode/ai provider and TUI footer/sidebar tests (all pass), type-checked the changed packages (tui's existing errors are the same on the base), and ran the DROP COLUMN migration against SQLite 3.53.2.
Public API impact (removals only):
- Schema/HTTP API/OpenAPI:
allowance removed from Session.Info, from assistant messages, and from the session.step.ended, session.step.failed, session.usage.recorded and session.usage.updated events.
@opencode/ai: Usage.allowance removed; usage.opencode.allowance is no longer read.
- Client data store and TUI plugin API:
data.session.allowance(sessionID) removed.
- Database: the
session_v2.allowance column is dropped.
This isn't backwards compatible for anything built against dev since #58562 earlier today, but nothing with the field has been released. Old durable events that still carry allowance should decode fine, since extra fields are ignored. The only consumer I know of is opencode-ios (#170), which uses decodeIfPresent and is covered by your follow-up.
No concerns.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vleonbonnet
added a commit
to vleonbonnet/opencode
that referenced
this pull request
Oct 25, 2026
Conflicts:
- Upstream moved the Effect API to @opencode/ai/effect (anomalyco#58847): model-request, the runner's llm, generate and the fork's prompt-cache modules and tests import from it; the fork keeps its protocol subpath imports.
- tool.ts: the fork's cross-agent exposure decides whether Code Mode is listed, with upstream's cached execute definition (anomalyco#58848).
- Migrations: the fork's session_delegators, then upstream's session_allowance and drop_session_allowance, in filename order.
- Tests: the fork's new tests stay; the cost tests take upstream's titles now that the Go allowance is gone (anomalyco#58765).
- The generated client types are regenerated from the merged protocol.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|