Skip to content

Status line disappears when context usage exceeds its window #25

Open

Description

@1aifanatic

On main at e86ba25, the status command returns an empty string once context usage is sufficiently above 100%.

Reproduction with the built command and an isolated home:

  1. Write ~/.scaledown/stats.json with {"totalSaved":1200,"totalRequests":7,"sessions":{},"contextWindow":{"current_tokens":220000,"max_tokens":200000}}.
  2. Seed a fresh _updateCache in ~/.scaledown/config.json so update/reconciliation work is skipped.
  3. Pipe {} into node dist/hooks/status.js.

Actual: empty stdout. At 110%, filled becomes 11 and "░".repeat(10 - filled) throws a RangeError, swallowed by the top-level catch. Savings and request counts disappear too.

Expected: a full ten-cell bar showing the actual 110% value, with savings and request counts retained. Invalid context values (negative/missing/non-numeric counts or an overflowing ratio) should omit the context indicator while preserving the rest of the status line.

I reproduced the failure with command-level tests and have a fix covering normal, overfull, and malformed context data.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions