Repository navigation
Conversation
Collect OpenCode Go usage as a new agents-panel collector: local token stats from opencode's message database, plus rolling/weekly/monthly rate limits from opencode's key-authenticated usage endpoint. Adds the OpenCode Go mark and registers the provider in the panel defaults.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds OpenCode Go support to the Omarchy agents panel by introducing a new usage/limits collector, wiring it into the plugin configuration, and documenting/testing the new provider.
Changes:
- Added
omarchy-agent-usage-opencode-gocollector to scan opencode’s SQLite DB for local token usage and fetch rate-limit windows from opencode.ai. - Added a comprehensive shell test covering scanning behavior, malformed rows, caching, and limits/key resolution.
- Updated agents plugin manifest, docs, and assets to expose/configure the new
opencode-goprovider.
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/shell.d/agent-usage-opencode-go-scanner-test.sh | Adds end-to-end shell coverage for OpenCode Go scanning, caching, and limits behavior |
| shell/plugins/agents/manifest.json | Enables the opencode-go provider and updates plugin description |
| shell/plugins/agents/assets/opencode-go.svg | Adds OpenCode Go icon (dark) |
| shell/plugins/agents/assets/opencode-go-light.svg | Adds OpenCode Go icon (light) |
| shell/plugins/agents/README.md | Documents the new provider and configuration/key resolution |
| manual/17-ai.md | Updates the manual to mention OpenCode Go support and limit windows |
| bin/omarchy-agent-usage-opencode-go | Implements the OpenCode Go collector (local stats + limits fetching + caching) |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (1)
test/shell.d/agent-usage-opencode-go-scanner-test.sh:151
- If the test harness enables
set -e(commonly done in sharedbase-test.sh),findexiting non-zero when the directory doesn’t exist will abort the script before the explicit assertion runs. To make the test reliably report the intended failure, guard the command substitution (e.g., append|| true) so missing cache paths flow into the[[ ... ]] || fail ...check instead of exiting early.
cache_file=$(find "$CACHE_HOME/.cache/omarchy/agent-usage" -maxdepth 1 -name 'opencode-go-scan-*.json' -print -quit 2>/dev/null)
[[ -n "$cache_file" && -s "$cache_file" ]] ||
fail "OpenCode Go collector leaves a cache file behind" "$result"
The block that stubs urlopen ran without HOME or XDG_CACHE_HOME pointing at the fixture, so its first successful fetch wrote the stubbed windows through write_limits_cache into the real ~/.cache/omarchy/agent-usage/opencode-go-limits.json. That is the file the collector falls back to when opencode.ai returns 429 or the network is down, so anyone who ran ./test/shell could later see 1% / 50% / 0.5% meters labelled "OpenCode Go limits stale". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two things the endpoint can return that the meters could not survive. A 200 whose body has no usage object — `{}`, `{"usage": null}`, or a JSON error body — reached `usage.get` on a non-dict and raised AttributeError, so the collector exited non-zero, omarchy-agent-usage-update reported it failed, and the record was never rewritten: the tab froze on whatever the last good run left. And a window that reported a percentage but no reset time was dropped whole, taking the percentage with it; since the panel's hero and its 90% alarm read the fullest window, losing one silently under-reports how close the next prompt is to the limit. omarchy-agent-usage-codex already emits an empty resetsAt for that case and Panel.qml renders it without a countdown.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Reviewed on a worker VM against The approach holds up. A malformed, truncated or v2-only database produces a clean all-zero record and exit 0 rather than a traceback, the token arithmetic matches Pushed three commits to
Left for you — all real, none of them mine to decide:
One style note: Waiting on the maintainer. This is not the only OpenCode Go collector open: #7687, #7082, #6464, #6526 and #6779 all cover the same ground, and #6464 and #6526 create the same Second opinion from |
Adds native support for OpenCode Go subscriptions in the agents panel. Queries OpenCode's official /zen/go/v1/usage API for rolling (5h), weekly, and monthly limit usage with reset timers. Unique features compared to other PRs (omacom#7157, omacom#8065, omacom#6526, omacom#6779, omacom#6464): - Pi session scanning for local token stats - Harness-agnostic key discovery (Pi, OpenCode CLI, env var) - Account-scoped metadata (scope, hasPromptStats) Key design decisions: - Uses curl instead of urllib to bypass Cloudflare TLS fingerprinting - Includes light/dark icon variants matching OpenCode brand colors - Adds test coverage for auth lookup, API parsing, and error handling
|
Thanks for the focused provider implementation. The collector shape, provider IDs, malformed-row handling, and targeted shell coverage look consistent with the existing agents architecture. A few non-blocking follow-ups are worth considering before merge:
These are follow-ups rather than blockers, and I have not confirmed that every case occurs in production OpenCode databases. The existing tests appear strong; the remaining validation gap noted in the PR is visual verification of the panel. |
|
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. |
Summary
Adds an OpenCode Go tab to the agents panel.
Changes
bin/omarchy-agent-usage-opencode-go— collectorshell/plugins/agents/assets/opencode-go{,-light}.svg— logomanifest.json,README.md,manual/17-ai.md— defaults + docstest/shell.d/agent-usage-opencode-go-scanner-test.sh— testsBuilt with OpenCode Go :), Kimi K3 & DeepSeek V4 Pro