#17 Fix: OpenCode Go plugin β schema migration, QuickJS float bug, and stale cache#18
Merged
symonbaikov merged 7 commits intoJun 23, 2026
Conversation
β¦fresh on panel open - Switch from message to session table (cost moved in OpenCode May 2026 migration) - Fix column: data -> model, JSON path: $.model.providerID -> $.providerID - CAST(cost AS TEXT) for QuickJS compat (sqlite3 -json REAL values get 18-decimal precision that QuickJS silently floors to integers) - clampPercent: Math.round -> Math.floor (match OpenCode server behavior) - Trigger refresh on panel visibility change (no more stale cache on reopen) - Accept background batchId in probe events (reserved for future Rust timer)
Collaborator
|
Thanks for the PR the fix addresses real issues and the existing test suite passes. A few things need to be addressed before merge:
|
- Update SQL examples to use session table, model column, CAST(cost AS TEXT) - Update detection text from 'assistant messages' to 'sessions with cost data' - Update usage scope from 'assistant spend' to 'session spend'
β¦ility refresh - plugin.test.js: verify fractional cost 0.7 parses to used=5 (not 0) - App.test.tsx: verify visibilitychange triggers startBatch - App.tsx: use startBatch directly (bypass handleRefreshAll cooldown)
β¦CKGROUND_BATCH_ID constant
β¦and provider docs
Author
|
Hi @symonbaikov , its have been added, for documentation and also for the regression test, please let me know if you have more question |
Collaborator
|
Everything works! Thank you very much for your work! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#17 Opencode Go Subscription Issue
Problem
The OpenCode Go plugin had two silent failures that made it show wrong or zero usage:
Schema mismatch β OpenCode migrated per-message cost to
session.costin May 2026. The plugin still queriedmessage.data.cost, which OpenCode no longer populates. Query threw "no such column" errors β plugin showed "No usage data".QuickJS float truncation β
sqlite3 -jsonserializes REAL values with 18-decimal precision (e.g.0.105931999999999998). QuickJS'sJSON.parsesilently floors these to integers, making all fractional costs disappear. Every cost < 1.0 became 0.Stale cache on panel reopen β The panel only probed on mount or on a 5-minute timer. If the panel was hidden, no re-probe fired until the user waited for the interval. The display showed yesterday's data.
Changes
plugins/opencode-go/plugin.jsmessageβsessiontable,dataβmodelcolumn,$.model.providerIDβ$.providerIDCAST(cost AS TEXT)β sqlite3 outputs cost as a clean string thatNumber()parses correctly in QuickJSclampPercent:Math.round(...*10)/10βMath.floor(...)to match OpenCode server calculationHISTORY_EXISTS_SQLandHISTORY_ROWS_SQLrewritten for the new schemaplugins/opencode-go/plugin.test.jsmodelcolumn,$.providerID,time_updated,cost > 0Math.flooralignment)src/App.tsxvisibilitychangelistener that triggershandleRefreshAll()when the panel opens β no more stale cache on reopensrc/hooks/use-probe-events.tsbatchId === "background"(reserved for future Rust background reprobe)