Skip to content

status bar: show current context occupancy in addition to summed turn usage #556

Description

@btipling

Summary

Keep the context/usage slot's turn totals (they are useful).
Also show current context occupancy: how large the last (or active) model request was — the thing that can hit the window.

Today the slot paints AI SDK result.usage (phase 3 #539 / PR #547, product #327). On a tool loop that value is the sum of every step. A turn that prints 1.3M in · 13.3k out · 1.3M tok · 1.2M cached can be 15 × ~90k-input steps, all inside a 200k/1M window. Totals look like overflow. Occupancy would not.

Keep (do not remove)

Figure Meaning
Turn in / out / tok / cached Provider sum across steps — cost / “this turn was huge”
Honesty locks source: 'provider' only, no client tokenizer, no fake % without a catalog max
Abort/cancel keep last honest paint; completed turn with nothing usable hides
Host-local not a cloud meta key

Add

Want Not
Input tokens on the last step (or max step, if last is a tiny wrap-up call) Replacing the sum
Optional cache-read on that same step Using the summed cache as occupancy
Optional later: catalog window → honest % only with a real max Guessed denominator

Suggested paint (host-folded string, Wasm still generic slot 3), e.g.

90k ctx · 1.3M in · 13.3k out

or a second slot if 96 bytes cannot hold both honestly (truncateStatusValue already ellipsizes).

Success: a 15-step turn on a 200k model still shows the 1.3M in total and ~80–180k ctx.

Constraints

  • Still provider-sourced. Prefer result.steps[i].usage (or equivalent). If the SDK only exposes the aggregate, omit occupancy — do not invent a client token count and do not relabel the sum as ctx.
  • Completed turn with totals but no per-step usage → keep painting totals; occupancy hidden.
  • Cap: USAGE_SUMMARY_MAX_BYTES / STATUS_SLOT_MAX_BYTES (96). Extending the carrier is a NEW field + Caps table in the phase plan (do not silently jam two meters into a 96-byte JSON that then drops).
  • Not agent-session (agent session architecture — model-context memory, compaction, and viewport #548). Status-bar / usage-meter honesty. Do not add agent-session or project 3.

Non-goals

Related

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

    enhancementNew feature or requestharnessHarness / agent UI

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions