Skip to content

feat(serve): model, effort, context window and name in the session status, with a snapshot while a turn runs - #974

Merged
ajianaz merged 3 commits into
developfrom
feat/session-status-fields
Nov 19, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/session-status-fields

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

GET /sessions/{id}/status gains model, effort, contextWindow, contextUsed, name, snapshotAt and stale. While a turn runs it answers from the last-known snapshot (stale: true) instead of going blank, and never waits for the turn lock.

Closes #573.

Why

A remote client's footer (model · effort · context used / window · name) had no route to read these, and the route returned null for everything exactly while the user watched a turn run (#527, #528, #529 are blocked on this).

Changes

  • session/status.rs: StatusSnapshot (the tole status snapshot plus the session name and a timestamp), StatusCell (last snapshot plus a per-model detected window), take_snapshot (pure, no network), detect_window. The window is the configured one (TOLE_CONTEXT_WINDOW / config, same as tole status) or what the provider's /models reported for the session's model.
  • session/host.rs: SessionState.status (a small separate lock), refresh_status, last_status, warm_status. The snapshot is refreshed at session open, when a turn (or approval resume) settles, and when a register changes.
  • serve.rs: the status route reads live when the storage is free and refreshes the snapshot; when a turn holds it, it returns the snapshot with stale: true. with_idle_session refreshes after model/effort/name/compact writes. The /models window lookup runs on a background thread after open and after a turn, never on the request path.
  • Existing fields keep their names and meaning (entries and usage_report stay null during a turn).
  • Decisions the issue left open: camelCase names as in the issue; stale (bool) plus snapshotAt (epoch ms); stale is true exactly when the snapshot is served instead of a live read; effort is the session register only (as tole status), not the process default; contextUsed is the last prompt's tokens (0 before the first call); name is the register, else the creation alias.
  • Docs: docs/mobile-control.md (field table), docs/desktop-design.md, CHANGELOG.md.

Testing

  • New: serve_status_fields_equal_tole_status (compares the route with the real tole status output for the same session), serve_status_answers_from_a_snapshot_while_a_turn_runs (mock provider holds a turn at a gate; three polls answer under 2 s with busy, stale, the snapshot values; live again after the turn), plus unit tests for null unknowns (no window detected, no snapshot) and the per-model window cache.
  • cargo fmt --all; cargo clippy -D warnings on the workspace, --no-default-features, and --no-default-features --features shell-tools: clean.
  • cargo test -p tole-cli: 1632 passed, 0 failed (includes face_parity, 2 passed).
  • scripts/review-local.sh not run here.

…atus, with a snapshot while a turn runs (#573)

GET /sessions/{id}/status gains model, effort, contextWindow, contextUsed, name, snapshotAt and stale, read by the same code as tole status. While a turn runs the route answers from the last-known snapshot without taking the turn lock.
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 6ed49f1 into develop Nov 19, 2026
19 checks passed
@ajianaz
ajianaz deleted the feat/session-status-fields branch November 20, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant