GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ACP: report the context window on session start and usage after each model call · Issue #66734 · anomalyco/opencode

ACP: report the context window on session start and usage after each model call #66734

New issue
Copy link
New issue
Copy link
Backlog
Backlog
ACP: report the context window on session start and usage after each model call#66734
Copy link
Labels
area/ide-acpEditor integrations and ACPplatform/macosmacOStype/featureNew behaviour or an improvementversion/v2OpenCode 2.x

Description

@MiD10
MiD10
opened on Nov 27, 2026
Issue body actions

Description

Follow-up to #30118, which went stale. I can still reproduce the gap on OpenCode 2.4.1 over ACP stdio. A new session has no context meter until the first prompt finishes. If one prompt makes several model calls, the meter stays at its previous value throughout those calls and tools.

Expected: report the context window size as soon as the session starts. Once the new session is attached and the size is known, send usage_update with used: 0 and the known size. For a restored session, use the last known occupancy when available. While a prompt is running, send one usage_update after each completed model call with its measured context usage. I can prepare a PR once the design is approved.

Plugins

None. Reproduced over ACP stdio with an isolated workspace and a loopback OpenAI-compatible provider.

OpenCode version

2.4.1

Steps to reproduce

  1. Start opencode acp with OpenCode 2.4.1. Send initialize and session/new. Watch session/update before sending a prompt.
  2. Run a single session/prompt that uses a read tool and then makes a second model call.
  3. In a loopback test with a configured 128,000-token window, the observed order was session/new reply → model call 1 → model call 2 → usage_update (used: 220, size: 128000) → session/prompt reply. The window was absent at startup and there was no usage update between calls.

Screenshot

No response

Operating System

macOS arm64

Terminal

No response

Activity

  1. opencodejr commented on Nov 27, 2026

    @opencodejr
    opencodejrBot
    on Nov 27, 2026
    Contributor
    More actions

    Thanks for the detailed follow-up and the clear event order from your loopback test.

    You're asking for two changes to opencode acp:

    1. Send a usage_update with the context window size (and used: 0, or the last known usage for a loaded session) as soon as the session is attached.
    2. Send one usage_update after each completed model call within a prompt, not only at the end of the prompt.

    In the code I read, the ACP adapter sends usage_update once, when the turn settles at the end of the prompt, and skips it while the used count is zero. That's why there's nothing at startup or between model calls. So the current behaviour is by design, and I've filed this as a feature request. Maintainers will consider it, including your offer of a PR once the design is agreed. I can't promise an outcome or a timeline.

    Related issues:

    • ACP: emit usage_update during streaming + at session start (not only at end-of-turn) #30118: the earlier request for the same thing. It was closed for inactivity, so this issue now tracks it.
    • [FEATURE]: report plan usage (Go limits, Zen balance) to ACP clients #49693: reporting plan usage (Go limits, Zen balance) to ACP clients.
    • acp: usage_update cost leaves out subagent sessions #65616 and its open PR fix(cli): include subagent costs in ACP usage updates #65618: adding subagent costs to the usage_update cost.
  2. opencodejr
    added
    area/ide-acpEditor integrations and ACP
    platform/macosmacOS
    type/featureNew behaviour or an improvement
    version/v2OpenCode 2.x
    on Nov 27, 2026
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

    area/ide-acpEditor integrations and ACPplatform/macosmacOStype/featureNew behaviour or an improvementversion/v2OpenCode 2.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.