Repository navigation
Add OpenCode Go collector for the Agents panel - #7687
Closed
Kristijan-K wants to merge 7 commits into
Closed
Kristijan-K wants to merge 7 commits into
Kristijan-K wants to merge 7 commits into
Conversation
Replace the bash wrapper that required an external sibling checkout with a self-contained Python collector. The vendored collector now reads both classic (session/message) and v2 (session_v2/session_message) tables so Go usage is complete for both OpenCode generations, keeping exact providerID == "opencode-go" matching and the existing rolling/weekly/ monthly window logic. Output remains the panel's expected JSON (schemaVersion, id=opencode, limits, today*, recentDays, modelUsage) and honors --force / --limits-only like the other agent collectors. Test: external collector still passes 11 tests; vendored --force now reports 1282 prompts vs 36 before, matching v1(18)+v2(1287) Go messages in the current window.
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The panel counted the entire OpenCode history and missed v2 entirely, so the Codex card showed ~11 months of accumulated usage and omitted most recent traffic (e.g. gpt-5.6-terra via OpenCode v2). - Restrict OpenCode OpenAI scans to the trailing 30 days via the indexed time_created column, skipping unrelated providers in SQL - Keep exact providerID == "openai" matching (exclude opencode-go, opencode, deepseek, copilot, etc.) - Read OpenCode v2 messages from session_message in addition to the classic message table; both use the same window and provider filter - Share the 30-day horizon with the native Codex file scan via SCAN_WINDOW_SECONDS - Bump the local-stats cache schema so stale pre-v2 snapshots expire - Add regression test that recent OpenAI counts, old and Go traffic do not Test: test/shell.d/agent-usage-codex-scanner-test.sh (19 tests)
Co-locate the window fixture with TEST_HOME so later traps that rm TEST_HOME also clean it, avoiding a leaked mktemp on every run.
…or-vendor # Conflicts: # bin/omarchy-agent-usage-codex
Member
|
Automated duplication check: this pull request looks similar to #8065, which covers the same OpenCode usage collector. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
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.
Add OpenCode Go collector for the Agents panel
Omarchy ships collectors for
claude,codex, andfireworks. This adds the missingopencodecollector for the OpenCode Go subscription so the Agents panel can show Go limits and usage (Rolling / Weekly / Monthly) alongside the others.What it does
bin/omarchy-agent-usage-opencode— standalone#!/usr/bin/python3with the sameomarchy:summary/args=[--force] [--limits-only]/hidden=trueheader as the otheromarchy-agent-usage-*collectors. Discovered byomarchy-agent-usage-updateand writing~/.local/state/omarchy/agents/usage/opencode.json.~/.local/share/opencode/opencode.db:session/message(classic) andsession_v2/session_message(v2). Same trailing window derived from Go limits (https://opencode.ai/zen/go/v1/usage) and exactproviderID == "opencode-go"filtering.https://opencode.ai/zen/go/v1/usagewithRolling(5h) /Weekly/Monthlywindows and auth (OPENCODE_API_KEYor~/.local/share/opencode/auth.json).Screenshots