Public: anyone can read this; the crew can change it.

Talk's context meter uses the model's real window, not 200k #17841

opened this

Merged 4h 32m ago, live in production

Talk's context meter now reads the window of the model that answered, and an unknown model shows no percentage. I ran the new test and the six existing Talk and conversation suites that touch the meter, plus tsc: all pass. I did not run the full suite, and I did not start the app.

Notes

opened this

Talk's context meter now reads the window of the model that answered, and an unknown model shows no percentage. I ran the new test and the six existing Talk and conversation suites that touch the meter, plus tsc: all pass. I did not run the full suite, and I did not start the app.

  • Table: src/crew/model_windows.ts holds one window per model id and exposes windowOf(model), which ignores a vendor/ prefix and returns undefined for an id it doesn't list.
  • Meter: contextOf in src/core/conversation_cost.ts takes the window the run reported, else the table's value for the run's model. If neither knows it, there is no window and no share.
  • Words: an unknown model reads "Context 200k tokens", with no percentage. A known one reads the same as before, for example "20% full (200k of 1M tokens)".
  • Removed: the old blanket 200k fallback (CONTEXT_TOKENS) is gone.
  • Doors: the terminal prints the same contextText as the page, so it shows the same words. I added a "The context meter" section to docs/features/talk.md.
  • Test: test/model-windows.test.ts checks that a 1M-window model at 200k tokens reads 20% and an unknown model reads no percentage. It also covers the table lookup and that a window the run reported wins over the table.
  • Script size: the client script is untouched; the figure is computed on the server.
  • Reuse: I extended contextOf and contextText rather than adding new functions, so I didn't run bun scripts/similar.ts.

Left out: the table lists only models I'm sure of: Claude 4.5 (200k), GPT-4o and 4.1, and Gemini 2.5. The Claude 5 family isn't in it because I don't know those windows. Until they're added, a conversation answered by one shows tokens only, unless the run reports its own window. Adding one is a single line. The page's head meter bar (shown from 60%) also stays hidden when the model is unknown.

Try it: open /talk/<id> for a conversation answered by a model that isn't in the table. The conversation menu should read "Context 200k tokens" with no percent.

🤖 Generated with Claude Code

Closes #17826

2 earlier comments
commented

Talk's context meter now reads the window of the model that answered, and an unknown model shows no percentage. I ran the new test and the six existing Talk and conversation suites that touch the meter, plus tsc: all pass. I did not run the full suite, and I did not start the app.

  • Table: src/crew/model_windows.ts holds one window per model id and exposes windowOf(model), which ignores a vendor/ prefix and returns undefined for an id it doesn't list.
  • Meter: contextOf in src/core/conversation_cost.ts takes the window the run reported, else the table's value for the run's model. If neither knows it, there is no window and no share.
  • Words: an unknown model reads "Context 200k tokens", with no percentage. A known one reads the same as before, for example "20% full (200k of 1M tokens)".
  • Removed: the old blanket 200k fallback (CONTEXT_TOKENS) is gone.
  • Doors: the terminal prints the same contextText as the page, so it shows the same words. I added a "The context meter" section to docs/features/talk.md.
  • Test: test/model-windows.test.ts checks that a 1M-window model at 200k tokens reads 20% and an unknown model reads no percentage. It also covers the table lookup and that a window the run reported wins over the table.
  • Script size: the client script is untouched; the figure is computed on the server.
  • Reuse: I extended contextOf and contextText rather than adding new functions, so I didn't run bun scripts/similar.ts.

Left out: the table lists only models I'm sure of: Claude 4.5 (200k), GPT-4o and 4.1, and Gemini 2.5. The Claude 5 family isn't in it because I don't know those windows. Until they're added, a conversation answered by one shows tokens only, unless the run reports its own window. Adding one is a single line. The page's head meter bar (shown from 60%) also stays hidden when the model is unknown.

Try it: open /talk/<id> for a conversation answered by a model that isn't in the table. The conversation menu should read "Context 200k tokens" with no percent.

🤖 Generated with Claude Code

commented

The default models now get a meter, and the "full" rules no longer depend on knowing the model's window. The new test, talk-fresh-say, talk-page and crew-resume pass and tsc is clean. I did not run the full suite.

  • Default models (point 1): src/crew/model_windows.ts now lists claude-fable-5-1, claude-fable-5-2, claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5 and the aliases opus, sonnet, haiku. A window the run reports still outranks the table.
  • Unconfirmed windows: I set every Claude entry to 200k, Claude Code's standard window, and did not confirm any of them. If Fable or a 5.x model is really 1M, those lines are wrong until corrected. Please check them.
  • Full rules (point 2): a new fullness() in src/core/conversation_cost.ts returns the real share, or tokens against 200k when the window is unknown. startsFresh and carryOn in src/crew/conversation.ts use it, so an unknown model still starts fresh and carries on at 85%. Only the meter stays blank for an unknown model.
  • Tests (points 2 and 3):
    • talk-fresh-say has two new cases where the run reports no window, one on sonnet and one on an unknown model. Both start fresh.
    • model-windows.test.ts checks the head meter on the page. It shows for sonnet at 150k tokens, is absent at 50k, and is absent for an unknown model.
    • model-windows.test.ts also checks the token fallback in fullness.
  • Smaller: I split the contextText ternary over lines.

Try: open a /talk conversation answered by sonnet and past 60% context. The head shows the meter, and the same conversation on an unlisted model shows "Context 170k tokens" with no meter.

🤖 Generated with Claude Code

commented

The check failed on a duplicate import in test/model-windows.test.ts: it imported ../src/core/conversation_cost.ts twice. I merged them into one import and pushed.

test/model-windows.test.ts and test/dup-imports.test.ts pass, and tsc is clean. I did not rerun the full suite.

The pull still does what the last description said. The meter reads the answering model's window, the default Claude models are in the table, and the fresh-session and carry-on rules fall back on token count when a window is unknown. The 200k windows for the Claude models are still unconfirmed, so someone should check them.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs