GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(session): ignore malformed model costs by nexxeln · Pull Request #43248 · anomalyco/opencode

Conversation

@nexxeln

@nexxeln nexxeln commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • treat malformed or non-finite model cost fields as zero during usage accounting
  • preserve valid pricing components and existing finite-price behavior
  • add a regression test for provider-supplied object values

Closes #43098

Testing

  • bun test test/session/compaction.test.ts --test-name-pattern "SessionNs.getUsage"
  • bun typecheck in packages/opencode
  • full workspace typecheck from the pre-push hook

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nexxeln
fix(session): ignore malformed model costs
f463793
@nexxeln
nexxeln merged commit 9b0dd36 into dev Aug 18, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nexxeln
nexxeln deleted the cost-field-validation branch August 18, 2026 14:19
@nexxeln nexxeln mentioned this pull request Aug 18, 2026
fix(core): ignore malformed model costs #43251
Merged
This was referenced Aug 18, 2026
Malformed cost.tiers still crashes the turn (TypeError, not DecimalError) #43254
Closed
fix(session): guard malformed cost tiers #43255
Closed
fix(session): guard cost calc against non-numeric provider usage/cost fields #43096
Closed
@macurandb

macurandb commented Aug 18, 2026

Copy link
Copy Markdown

Question rather than a bug report — is the numeric-string case intentional?

finite() takes a number, so a cost field that arrives as a numeric string now prices at 0, where ?? 0 used to hand it straight to decimal.js, which parses it fine:

cost.input before after
"3" 3 0
"1e3" 1000 0
{} threw 0 ✅

If the answer is "a string violates the declared Schema.Finite, so we don't support it", that's a perfectly good answer and I'll drop it — the crash was the real problem and that's fixed. I'm asking because the failure mode flipped from loud to silent (an under-reported cost rather than an aborted turn), and because the same shape just landed in packages/core via #43251, so whichever way you want it, it probably wants to be the same in both.

Happy to send a patch if you'd like the string path kept.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alltomatos pushed a commit to alltomatos/opencode that referenced this pull request Aug 18, 2026
@nexxeln @alltomatos
fix(session): ignore malformed model costs (anomalyco#43248)
f440435
@github-actions github-actions Bot mentioned this pull request Aug 24, 2026
Informe upstream (semanal) jaminsmoke/Jarvis#52
Open
1056674754 added a commit to 1056674754/opencode that referenced this pull request Aug 31, 2026
@1056674754
chore: merge OpenCode v1.18.19-sscity
7e0649a
Upstream v1.18.18 (31406cc) -> v1.18.19 (2b72179), 70 commits.

Functional changes:
- feat(opencode): native OpenAI and Anthropic passthroughs for Cloudflare AI Gateway (anomalyco#42634)
- fix(core): fall back on oversized websocket requests (anomalyco#43099)
- fix: codex data residency (anomalyco#42432); match codex limits for openai models on chatgpt subscription (anomalyco#39082)
- fix(core): preserve unicode in grep previews (anomalyco#42356)
- fix(opencode): preserve v1 database compatibility (anomalyco#42444)
- fix(core): restore session request headers (anomalyco#43188)
- fix(opencode): enable web search for Go (anomalyco#42630)
- fix(session): ignore malformed model costs (anomalyco#43248)
- fix(opencode): properly show authed providers on /connect command (anomalyco#39915)
- fix(opencode): remove Qwen sampling defaults (anomalyco#43310)
- fix(provider): update Google Vertex SDK (anomalyco#43108)
- fix(cli): update default console URL (anomalyco#43043)

Conflicts resolved: 29 package.json version bumps (rebranded 1.18.19-sscity),
bun.lock (took upstream, rebranded workspace entries via bun install).
provider.ts, transform.ts, session.ts, tool/registry.ts, and transform.test.ts
auto-merged cleanly: fork ProviderSnapshot refactor, GLM/ZhiPu normalization,
tool registry hot reload, and session fixes are untouched; upstream Cloudflare
passthrough (cloudflareGatewayNpm + native openai/anthropic routes), Qwen
sampling removal, getUsage cost tolerance, and opencode-go websearch adopted
alongside. v1.18.17 retry composition and v1.18.18 provider patches remain
intact.
rldona pushed a commit to plazoleta-dev/FlupCode that referenced this pull request Sep 24, 2026
@nexxeln
fix(session): ignore malformed model costs (anomalyco#43248)
6a68a03
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
@nexxeln
fix(session): ignore malformed model costs (anomalyco#43248)
95aa992
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Oct 14, 2026
upstream: provider/security fixes not yet ported AltimateAI/altimate-code#1478
Open
29 of 90 tasks
@opencode-agent opencode-agent Bot mentioned this pull request Oct 21, 2026
refactor(core): rely on typed Usage and Model.Cost in SessionUsage #57599
Closed
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Oct 21, 2026
Malformed model cost fields crash session usage accounting (DecimalError) AltimateAI/altimate-code#1573
Open
@opencodejr opencodejr Bot mentioned this pull request Oct 28, 2026
feat(tui): estimate session spend from catalog prices when the provider reports $0 #59864
Open
3 of 6 tasks
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Oct 28, 2026
fix(session): port upstream malformed model cost guard (anomalyco/opencode#43248) AltimateAI/altimate-code#1613
Open
4 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[DecimalError] Invalid argument: [object Object] — non-numeric provider cost field aborts the turn (fatal on opencode acp)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@nexxeln @macurandb
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.