Skip to content

Add OpenCode Go usage to Agents - #15153

Open
AlvaroMinarro wants to merge 3 commits into
omacom:quattrofrom
AlvaroMinarro:agents-opencode-go-collector
Open

AlvaroMinarro wants to merge 3 commits into
omacom:quattrofrom
AlvaroMinarro:agents-opencode-go-collector

Conversation

@AlvaroMinarro

@AlvaroMinarro AlvaroMinarro commented Oct 12, 2026 •

Copy link
Copy Markdown

Add OpenCode Go usage to Agents

Adds OpenCode Go as a subscription tab in the existing Agents panel, with rolling 5-hour, weekly and monthly limits, the OpenCode mark, and daily/model token statistics. No new QML or panel behavior is required.

Changes

  • Query https://opencode.ai/zen/go/v1/usage using OPENCODE_GO_API_KEY or OpenCode's saved opencode-go key. Validate the response and keep credentials out of errors.
  • Collect local usage from OpenCode v1/v2 databases and pi/omp sessions, including omp profiles, with exact provider filtering. Handle missing sources and failed scans without replacing good caches.
  • Add the provider default, SVG mark and documentation. Limits are account-global; token statistics cover this machine only. The endpoint does not report Go versus Go Plus, so no plan is inferred.

Review path

Start with the collector's schema dispatch, cache validation and limits probe, then the two fixture-based tests. The tests isolate HOME/XDG paths, use synthetic SQLite/JSONL and mock HTTP; no live subscription is required. The mark follows the existing assets/<provider-id>.svg convention.

Account switching, a new authentication flow, shared collector refactors and local systemd units are out of scope.

Verification

  • Scanner/cache/session tests: 16 passed.
  • Limits/auth/error tests: 7 passed.
  • bash test/shell.d/agent-usage-update-test.sh.
  • bash test/shell.d/agents-panel-test.sh.
  • ./test/cli with isolated HOME/XDG paths.
  • git diff --check.
  • Independent focused collector/updater/Fireworks checks and ./test/cli (125 assertions) passed.
  • Full shell suite is not green: isolated ./test/shell failed 9 of 448 test files; 44 files contained skips. Eight failures reproduce identically on the unchanged base (five require a display; the others are elsewhen-migration, i18n, and update-stay-awake-security). windows-vm-compose failed in the parallel suite but passes standalone on both base and candidate; that suite-dependent failure remains unresolved.

The local prototype's tab, OpenCode mark and populated daily-token chart were visually confirmed. The upstream version's additional schema/cache hardening is covered by the isolated tests above; graphical acceptance tests have not been run against it.

Native review remains pending: the host has no model assigned to review-risk; no reviewer ran and no verdict was submitted. This is not a review approval.

Review fixes (44c6198)

  • Fail incomplete local scans without publishing partial/zero usage; the updater preserves its last good complete record and recovers after the source is repaired. Missing histories and malformed individual records remain tolerated.
  • Honor PI_CODING_AGENT_DIR and include effective session roots in cache identity.
  • Catch interrupted HTTP responses without exposing response bytes or losing fresh local stats.
  • Do not request accelerated retries for HTTP 401/403; transient failures still advise retry.

Regression tests were observed failing before implementation and passing afterward. Independent verification found no candidate-caused regression, with the full-suite limitations above. Native review is still unavailable because no model is configured for review-risk; no native reviewer ran or issued approval.

@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds OpenCode Go to the Agents panel with account limits and machine-local token stats.

  • OpenCode Go usage appears in the Agents panel.

Reviews (3) · Last reviewed commit: "fix(agents): preserve OpenCode Go usage ..." · Reviewed by Greptile

Comment thread bin/omarchy-agent-usage-opencodego Outdated
Comment thread bin/omarchy-agent-usage-opencodego
Comment thread bin/omarchy-agent-usage-opencodego Outdated
Comment thread bin/omarchy-agent-usage-opencodego Outdated
@jandrusk

Copy link
Copy Markdown

Thanks! Heads-up that #15089 ("agents: add Opencode usage collector and assets") and #14040 ("Add Cursor, OpenCode, Copilot, and Muse to the agents panel") also add OpenCode to the Agents panel. The maintainers will want to settle on one collector/provider id, so it's worth checking whether OpenCode Go can be a plan inside whichever OpenCode provider lands rather than a separate tab.

@omarchybot omarchybot added the enhancement New feature or request label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants