Skip to content

Per-model token usage is lost during mid-session model switches #28637

@yitang

Description

@yitang

The sessions table's model column uses COALESCE(model, ?)
first-writer-wins, so it records only the first model and never
updates on a /model switch. Cumulative counters (input_tokens,
output_tokens, etc.) keep summing across all models, but there is
no per-model breakdown anywhere in the database — no column, no
table, no per-message model attribution.

After a mid-session model switch, /usage and /insights attribute
all tokens and cost to the single locked-in model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cliCLI entry point, hermes_cli/, setup wizardtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions