Skip to content

Context window size is read from a source that isn't a property of the running session #19

Description

@snazzybean

Claudux version

00513f3 (main)

How did you install it?

git clone + npm install (found via code review, not filed from a live install)

OS, Node, tmux, ttyd

N/A. This is a logic bug found by reading the code, not a runtime reproduction on a specific environment.

What happened?

windowFromModelEntry reads the [1m] marker off the model entry in settings.json to decide the context window size shown for a session. That entry is a default value, not a property of the session that's actually running.

Measured case: settings.json had "sonnet" in the model entry, with no [1m] marker, while the session itself was running claude-opus-5 with a 1M-token window. The usage percentage shown would have been five times too high.

This hasn't shown up in practice only because, above 200k tokens, the window size is fixed regardless of the entry, so the wrong default gets overridden anyway. Below 200k tokens in a 1M session, the display shows the wrong percentage.

The model name read from the transcript (added for the popover rework) doesn't fix this either: the JSONL carries claude-opus-5 without any [1m] marker, and whether a session is actually running in 1M mode isn't something the model name alone tells you.

Steps to reproduce

  1. Set settings.json's model entry to a value without the [1m] marker (for example "sonnet").
  2. Start or resume a session that is actually running in 1M-context mode (for example claude-opus-5 with the 1M window enabled).
  3. Stay below 200k tokens of usage in that session.
  4. The context-usage percentage shown is based on the wrong, smaller window size and reads too high.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions