Skip to content

tui: plan usage footer is not synced across TUI instances sharing one service #59062

Open

Description

@johnbulmer

Summary

With several OpenCode TUI tabs open behind a single shared background service,
each footer shows a different Go plan usage/allowance value, because the footer
only renders the opencode.allowance from the most recent inference response
that session completed. There is no polling of the shared service and no API
endpoint exposing plan allowance, so tabs show stale or divergent balances for
the same plan.

Environment

  • opencode version: 2.1.4 (latest)
  • OS: Linux 7.0.0-38-generic (linux x64) — Arch
  • Terminal: alacritty (TERM=alacritty, COLORTERM=truecolor)
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: @xberg-io/opencode-html-to-markdown

Reproduction

  1. Connect a Go plan via /connect and use a Go model.
  2. Open two or more terminal tabs running opencode in the same environment
    (all attaching to the same background service; verify opencode service status).
  3. Send requests in one tab only.
  4. Compare the plan-usage readout at the bottom of each tab.

Expected Behavior

All TUI instances connected to the same shared service should display the same,
current plan usage for the Go workspace — ideally refreshed periodically
(polling the shared service) rather than only updating on a session's own
inference response.

Actual Behavior

The footer in each tab shows only that session's last echoed allowance value.
Tabs not used recently (or brand-new sessions) show stale/initial values until
their next request. Nothing syncs while idle.

Additional Context

  • Inspected the running service's /openapi.json: there is no endpoint exposing
    plan allowance. The closest is /api/experimental/session/stats, which returns
    aggregate token/cost stats per project — not plan state.
  • The PlanTabs precedent: the Console's plan-tabs UI already uses a shared
    syncKey so all plan displays on a page stay synchronized; the same idea
    applies to TUI footers via the shared service.
  • Workspace limits are enforced server-side per plan, so enforcement is correct;
    this is a display/observability gap only.
  • Workaround: check usage in the OpenCode Console, or watch the local
    /api/experimental/session/stats endpoint for aggregate cost.

Activity

  1. opencode-agent commented on Oct 25, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up! As I understand it, you'd like every TUI instance connected to the same service to show the same, current OpenCode Go plan usage, refreshed periodically rather than only after that tab's own requests.

    Some context on why the tabs differ today:

    • In 2.1.4 the prompt footer is per-session by design. It shows that session's context tokens and percentage and that session's cost, not the plan's allowance. Two tabs are two sessions, so they show different numbers.
    • Since 2.1.4, plan usage has moved to a separate usage limits API (/api/experimental/usage/limits), and the TUI on dev now has a /usage dialog and a sidebar "Limit … remaining" line (feat(tui): show OpenCode Console usage limits #58731). Those limits load once and only reload on demand, so having them refresh on their own and stay in sync across instances is the open part of your request.

    Related requests:

    I've marked this as a feature request for the maintainers to consider.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions