Repository navigation
Conversation
OpenCode's claude-agent provider runs the real Claude Code executable, which writes its own transcript for the turn and is already counted by the Claude usage reader. Parsing the matching OpenCode row as well counted the same turn twice, so skip claude-agent messages there and bump the scan cache to v19 so entries saved with those rows are re-read. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks done
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.
Problem
OpenCode's
claude-agentprovider runs the Claude Code CLI on the user's Claude subscription. Claude Code writes its own transcript for each of those turns, tagged"entrypoint":"opencode", and T3's Claude Code usage reader counts it. The OpenCode reader also counted the same turn fromopencode.db, so every one of those turns appeared twice in Usage: once under Claude Code and once under OpenCode.Change
providerIDisclaude-agent, so these turns count once, under Claude Code.claude-agentare re-read and dropped.docs/user/usage.mdgets one line saying these turns count under Claude Code.Nothing else changes in how OpenCode records are keyed or priced.
Scope
Bug fix for pingdotgg#46303.
Verification
How I found it: on my machine (v0.1.13, macOS), I compared the two sources from Nov 29 onward. There were 59
claude-agentassistant messages inopencode.dband 59 distinct Claude Code assistant messages taggedentrypoint: "opencode", a one-for-one match.Checks:
packages/provider-opencode/src/server/usage.test.ts: a database holding aclaude-agentmessage and ananthropicmessage now yields only theanthropicrecord. With the reader change reverted, this test fails.apps/server/src/usage/usageScanCache.test.ts: a v18 OpenCode cache entry decodes as legacy and is re-read; a v19 entry round-trips unchanged.vp run typecheckpasses, andvp run check:changedpasses format, lint, knip and typecheck.apps/server/src/usage/UsageService.test.tstests fail on macOS (Muse home discovery, Pi default home, Codex reconciliation). They fail the same way onmainwithout this change.Created with DeepSeek V4.1 Flash in OpenCode (implementation and verification), directed by Claude Opus 5.5 in Claude Code via T3 Code.