Repository navigation
Count OpenCode v2 usage - #16
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe collector now reads OpenCode v1 and v2 message tables. Tests cover v2 token counting and duplicate message IDs. Release references change from version 1.10.4 to 1.10.5. ChangesOpenCode usage collection
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant OpenCodeDB
participant Collector
participant Ledger
OpenCodeDB->>Collector: Return rows from available v1 and v2 message tables
Collector->>Ledger: Upsert converted records by message ID
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No identified issue remains that needs correction before merge; normal checks still apply. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (5 skipped: 5 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
OpenCode 2.x writes messages to
session_messageandsession_v2instead ofmessageandsession, so Agent Pulse stopped counting OpenCode and OpenCode Go usage after the upgrade.The OpenCode scan now reads whichever tables exist. v2 rows go through the same
opencode_recordpath, so routing and pricing match v1. OpenCode v2 copied v1 messages into the new table with their original ids, so a message in both tables still counts once.Releases 1.10.5.
Checks:
python3 -m unittest discover -s tests: 237 tests OK, including four new OpenCode v2 cases (v2-only database, an id present in both tables, the Go route, and an in-place update under WAL)Summary by CodeRabbit
Bug Fixes
Release