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: usage_update is not sent when a turn fails · Issue #67009 · anomalyco/opencode

acp: usage_update is not sent when a turn fails #67009

New issue
Copy link
New issue
Copy link
Backlog
Backlog
acp: usage_update is not sent when a turn fails#67009
Copy link

Description

@BambinoSK
BambinoSK
opened on Nov 28, 2026
Issue body actions

Description

Over ACP, when a prompt turn ends in an error (provider error, rate limit, auth), opencode replies with the error but never sends usage_update. Usage from the turn's earlier steps, and from the failed step when the provider reports tokens, never reaches the client, so ACP clients undercount context and cost. Successful, cancelled and content-filtered turns do send it.

The adapter already counts these tokens (session.step.failed is folded into the turn usage). In settle in packages/cli/src/acp/turn.ts, the failure returns before sendUsageUpdate runs. packages/cli-rs/crates/acp/src/turn.rs has the same order. Sending the usage update before returning the error would fix it; the error response itself can't carry PromptResponse.usage.

Related but different: #66734 asks for usage at session start and after each model call.

Plugins

None

OpenCode version

2.4.2, still present on dev

Steps to reproduce

  1. Start opencode acp, then initialize and session/new.
  2. Send a prompt that makes at least one tool call, then fails on a later model call (e.g. the provider returns a rate limit or 500).
  3. The session/prompt call returns an error and no usage_update notification is sent for that turn.

Activity

  1. fanyzp commented on Nov 28, 2026

    @fanyzp
    fanyzp
    on Nov 28, 2026
    More actions

    confirmed — reproduced it with a wire test: a turn with a completed step (171 tokens) followed by a step that fails with a provider rate-limit error returns the error and never sends usage_update. the failure path in settle (packages/cli/src/acp/turn.ts) returns before sendUsageUpdate runs, so the tokens from the earlier step never reach the client. same order in packages/cli-rs/crates/acp/src/turn.rs. working on a fix.

  2. four1er commented on Nov 28, 2026

    @four1er
    four1er
    on Nov 28, 2026
    More actions

    Hi — I'm reproducing this now and preparing a fix; I'll open a PR shortly.

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

      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.