Skip to content

feat(cli): degrade status-line ctx segment to ?/window when usage is unavailable (#3371) - #3373

Open
me2seeks wants to merge 1 commit into
apache:mainfrom
me2seeks:fix/3371-ctx-status-fallback
Open

feat(cli): degrade status-line ctx segment to ?/window when usage is unavailable (#3371)#3373
me2seeks wants to merge 1 commit into
apache:mainfrom
me2seeks:fix/3371-ctx-status-fallback

Conversation

@me2seeks

Copy link
Copy Markdown
Contributor

Closes #3371

Problem

The TUI status-line ctx segment (#1067) only rendered when both the model context window and a token_usage contextRemaining were present. On connections whose provider does not report per-step input tokens (e.g. opencode-go), the status line shows no context indicator at all — the user cannot distinguish "provider doesn't report usage" from "not measured yet" from "window unknown".

Change

In renderMakaPiStatusLine (packages/cli/src/pi-transcript.ts), the ctx segment is lifted out of the if (usage) block:

  • window known + contextRemaining available → unchanged: ctx 20k/500k 4% with the existing 80%/95% color thresholds
  • window known + no usage yet → new: dim ctx ?/500k fallback, following pi-mono's footer design (?/200k when context usage is unknown)
  • window unknown → unchanged: no segment

Tests

  • New unit test in pi-transcript.test.ts covering all four combinations (no usage / usage without contextRemaining / unknown window stays hidden / measured rendering unchanged)
  • pi-transcript.test.js: 59/59 pass
  • pi-tui-runner.test.js: 119/119 pass (including the existing ctx 20k/500k 4% integration assertion)

The follow-up from the issue — verifying whether the opencode-go relay reports per-step input tokens — is not in scope here.

…unavailable (apache#3371)

The ctx segment only rendered when both the model context window and a
token_usage contextRemaining were present, leaving connections whose
provider does not report per-step input tokens (e.g. opencode-go) with
no context indicator at all — indistinguishable from 'not measured yet'.

When the window is known but contextRemaining is not, render a dim
'ctx ?/<window>' fallback (pi-mono footer style). Unknown-window
behavior is unchanged: no segment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): status line should degrade gracefully when ctx/token usage is unavailable

1 participant