Skip to content

Spend surfaces disagree after an interrupted streaming turn #1348

Open

Description

@AbirAbbas

What happened

REGRESSION seen on commit 17ae56d34 (staging-20260921-17ae56d3496f) on 2026-09-21. Lane C, one_figure_on_every_spend_surface, interrupted a streaming turn and observed:

the /spend place says $0.0001 and Settings→Spending's `today` says $0.0007 — one machine, one day, two numbers (issue #269)

The settings screen showed:

today                                                           $0.0007 of $500 · resets at midnight
per conversation                                                         no limit · this one $0.0007

A rerun showed /spend $0.0001, Settings today $0.0001, and this one $0.0000. On v0.3.0 (9258f7052), all three read $0.0009.

Replication

Deterministic (no model).

No no-model reproduction is established. Run the focused end-to-end gate:

go test -tags e2e -count=1 -v ./internal/e2e -run '^TestTUIE2E/one_figure_on_every_spend_surface$'

Today it exits nonzero when the /spend total, Settings today, and Settings this one fields diverge after interruption.

Field (real models).

Set OPENROUTER_API_KEY; allow about two minutes and less than $0.03. The subtest interrupts a live streaming answer, opens /spend, then Settings → Spending without starting a task. The v0.3.0 run is the control.

Where

The three read paths are readSpendLines and usageSince in internal/tui3/place_spend.go, readDayCost and spentThisSessionUSD in internal/tui3/settingspend.go, and readTreeSpend and treeLines in internal/tui3/treespend.go. docs/changes/unreleased/1280-a-runs-dollars-reach-the-conversations-total.md, 1281-a-run-is-handed-what-is-left-of-every-dollar-limit.md, and 1285-a-flush-says-whether-it-drained.md were checked; the report says they are not the cause.

The fix

After an interrupted stream has settled, /spend, Settings today, and Settings this one must read from a settled accounting view and show one figure for the same conversation and day. Opening one surface must not be required to update another.

Acceptance

  • e2e: Through TestTUIE2E/one_figure_on_every_spend_surface, interrupt a streaming turn, capture the /spend total and the Settings today and this one fields, assert all three dollar strings are identical, and exit 0.
  • e2e: Through the same tmux door without interruption, assert those three named fields remain identical after a completed turn.
  • Unit: Given one settled usage receipt, usageSince, readDayCost, and spentThisSessionUSD round and format the same dollar value.
  • The manual page internal/manual/chat/models-and-cost.md says the three named surfaces use the same settled total, and the change entry's invalidates names the old belief that each surface may settle independently.

Filed from the 2026-09-21 staging verification of 17ae56d; the lane reports, frames and e2e logs are in the owner's handoff folder for this promotion.

Activity

  1. added
    bug
    area:chat
    on Sep 21, 2026
  2. added
    sev:serious
    on Sep 21, 2026
  3. santoshkumarradha commented on Sep 21, 2026

    @santoshkumarradha
    Member

    Classification: bug, area:chat, sev:serious → milestone Reliable agent.

    • area:chat — all three read paths are tui3 (place_spend.go, settingspend.go, treespend.go); the fix is reading one settled accounting view.
    • sev:serious — three money figures that disagree after an ordinary interrupt.
    • Reliable agent — "spend that match reality" is literally that milestone's bar, even though the disagreeing surfaces are chat.

    drafted with CodeAF

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:chatbugsev:serious

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions