Skip to content

OpenCode Go: auto mode presents local estimates as authoritative when the cookie cache is empty #2982

Description

@Newarr

Summary

In auto mode, OpenCode Go can show local estimates as if they were server values. The web overlay from #2430 only runs when a cookie is already cached. With an empty cache it is skipped without an error, the local strategy wins, and the menu bar shows quota percentages that are wrong by up to 55 points with no sign that they are local.

Not a duplicate of #2543 or #2551. Those covered the case where a cookie exists. This is the case where the overlay has no cookie to use.

Environment

CodexBar 0.49.6 (120), macOS 27.0, arm64. Provider opencodego, cookieSource auto, no workspaceID, local rows present in ~/.local/share/opencode/opencode.db.

Observed

Read 9 seconds apart, both normalized to percent used.

Window Dashboard CodexBar
5-hour 0% 0%
Weekly 100% 45%
Monthly 50% 0%

Reproduction

  1. Use an account with local rows in opencode.db.
  2. Start from an empty cookie cache, as on a fresh install.
  3. Run auto mode. It succeeds with no warning:
$ codexbar usage --provider opencodego --source auto --format json
[{"provider":"opencodego","source":"local","usage":{
  "primary":  {"usedPercent":0,   "windowMinutes":300,  "resetsAt":"2026-08-16T18:17:41Z"},
  "secondary":{"usedPercent":45.4,"windowMinutes":10080,"resetsAt":"2026-08-16T23:59:59Z"},
  "tertiary": {"usedPercent":0,   "windowMinutes":43200,"resetsAt":"2026-09-15T20:55:55Z"}}}]

$ codexbar usage --provider opencodego --source web --format json
[{"source":"web","provider":"opencodego","error":{"kind":"provider",
  "message":"No OpenCode session cookies found in browsers.","code":1}}]

Cause

The state cannot heal itself. The overlay needs a cached cookie, and the only strategy that fills that cache never runs.

OpenCodeGoLocalUsageFetchStrategy.snapshot in OpenCodeGoProviderDescriptor.swift:

guard context.settings?.opencodego?.cookieSource != .off,
      let cookie = Self.cachedOrManualCookie(context: context)
else {
    return (snapshot, false)   // local only, no error
}
// ... (never a fresh browser import here).

resolveStrategies returns [local, web], and ProviderFetchPipeline moves to the next strategy only on a thrown error. A successful local read ends the pipeline, so the web strategy that imports the cookie is never reached.

Expected

Either let the overlay import a cookie when the cache is empty, or mark local-only results in the UI the way the CLI marks them with "source":"local". An estimate should not render as an authoritative quota.

Workaround

Set workspaceID in ~/.codexbar/config.json. Auto then puts the web strategy first and matches the dashboard. This appears only in a comment on closed issue #2543.

#2879 would remove the cookie dependency here entirely.

No cookie values, tokens, or account identifiers are included in this report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions