Skip to content

feat(serve): model, effort, context window and name in the session status, and a snapshot that survives a running turn #573

Closed

Description

@ajianaz

What problem does this solve?

The footer of the TUI shows folder · session · model · effort · context used / window (%) · tokens. A graphical client needs the same line. GET /sessions/{id}/status returns only {id, entries, busy, usage_report}:

  • No model, no reasoning effort, no context window and no session name. The model and effort are session registers in the log (fact/model, fact/reasoning_effort), but no route reads them, and the context window is not exposed at all (usage_report carries token counts, not the window).
  • While a turn runs, entries and usage_report are null (the session storage is held by the turn), so a footer built on this route goes blank exactly when the user is watching the session work.

Found while writing the screen inventory for #561 (screen 6, gap B). It blocks the status footer of every remote client (#527, #528, #529).

Proposed solution

Add fields to GET /sessions/{id}/status. The change is additive and clients already ignore unknown fields (docs/mobile-control.md).

  • model, effort, contextWindow (and the used count, if the TUI footer computes it from the same snapshot), name: the same values the TUI footer gets from the tole status snapshot (feat(cli): session status snapshot — model, effort, context used/window, tokens #458; see TuiSession::status_lines and status.rs), so both faces cannot disagree.
  • null for anything unknown, never a made-up value (the rule usage_report already follows).
  • A last-known snapshot, refreshed when a turn settles and when a register changes, that the route returns while a turn is running, together with a snapshotAt (or a stale: true flag) so a client can tell it is not live. This replaces the null while busy.

Alternatives considered

  • Make clients read fact/model and friends from GET /sessions/{id}/entries: works for the registers, but not for the context window, and every client would parse registers differently.
  • Take the storage lock briefly during a turn: the route deliberately does not (a turn holds the lock for a whole model call), so this would bring back the blocking problem fixed in the 2026-09-28 scan.

Acceptance criteria

  • GET /sessions/{id}/status includes model, effort, contextWindow and name for an idle session, equal to what tole status shows for the same session; a test compares the two.
  • While a turn is running the route answers promptly with the last snapshot (not null) and says it is a snapshot; a test with a slow mock provider proves it does not block.
  • Unknown values are null, covered by a test (for example a session with no window detected).
  • Existing fields keep their meaning; docs/mobile-control.md and the CHANGELOG are updated in the same PR.

Part of #523. Related: #524, #561, #571.

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

    enhancementpending

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions