Skip to content

feat(tui): pin reasoning effort per session and expose it as /effort - #122

Merged
lg2m merged 2 commits into
mainfrom
feat/tui-session-reasoning-effort
Sep 22, 2026
Merged

lg2m merged 2 commits into
mainfrom
feat/tui-session-reasoning-effort

Conversation

@lg2m

@lg2m lg2m commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reasoning effort has been configurable since #76 (config + profiles), but only at plan-compile time — there was no way to see or change it from the TUI. This makes effort a first-class per-session control: /effort opens a picker (default / none / minimal / low / medium / high / xhigh), the choice is persisted on the session, applied at the next claimed run, and shown as a status badge when set.

User-visible behaviour

  • /effort with a session focused pins that session's effort. Refused while a run is in flight (a running turn keeps the effort it started with), same rule as /profile.
  • /effort with nothing focused sets the default for the next CreateSession.
  • default clears the pin and restores the configured/profile omission.
  • StatusItem::Effort badge in the status row, shown only when an explicit pin is set (omission is the unremarkable case).
  • Child sessions inherit the parent's pin.

Design

Protocol 27 (qq-protocol):

  • SessionCommand::CreateSession.reasoning_effort: Option<ReasoningEffort>
  • SessionCommand::SetSessionEffort { session_id, effort }
  • CommandOutcome::SessionEffortSet
  • SessionSummary.reasoning_effort (optional, omitted when unset)
  • /effort reserved as a client slash command

Older clients reject the new command/outcome/field; v23–v26 goldens kept as decode-only. (Protocol 26 was taken by #120's turn-recovery work while this PR was open, so this became 27 on sync.)

Store schema 34: nullable sessions.reasoning_effort. Threaded claim → ClaimedRun → RuntimeLoadRequest, so the compiled plan honours the pin. Omission (NULL) means "use the compiled plan's configured/profile choice"; explicit none remains distinct from omission, per ADR-0031.

ReasoningEffort gains ALL and as_str() so the wire spelling has one source across codec, TUI label, and picker rows.

Regression fix found along the way

Every earlier migration guard in schema.rs listed "33" as already-applied but not "34", so a fully migrated store failed its second open with Persistence(Constraint) — first open fine, reopen dead. Surfaced by headless::tests::session_resume_after_an_unclean_exit_recovers_the_interrupted_run_first. Added "34" to all 22 guards plus a direct regression test (a_current_store_reopens_without_rerunning_migrations) that fails in qq-core instead of three crates away.

Verification

Performance / compatibility

Follow-up

Stacked on this PR: #130 — per-model effort catalog (ModelDescriptor.reasoning_efforts, /effort filtered to the focused model, plan-time rejection of unsupported pins). Merge this first; #130 then retargets to main.

Also not in this PR

The 22-guard matches!(schema_version, Some("…")) pattern in schema.rs is what made the reopen bug possible; it's an easy trap for the next migration. Worth replacing with a numeric compare in a separate change.

Linear

Linear connection needs re-auth in this session, so I could not query or link a DEV issue. Please link one (or tell me the ID) and I'll update the title/body.

Reasoning effort has been configurable since PR #76 (config + profiles),
but only at plan-compile time; there was no way to see or change it from
the TUI. This makes effort a first-class per-session control.

Protocol 26:
- `SessionCommand::CreateSession.reasoning_effort` (optional)
- `SessionCommand::SetSessionEffort { session_id, effort }`
- `CommandOutcome::SessionEffortSet`
- `SessionSummary.reasoning_effort` (optional, omitted when unset)
- `/effort` is reserved as a client slash command
Omission keeps the compiled plan's configured/profile choice; an explicit
value is applied at the next claimed run. Children inherit the parent pin.

Store schema 34 adds nullable `sessions.reasoning_effort`, threaded
through claim -> RuntimeLoadRequest so the runtime honours the pin.

TUI:
- `/effort` picker (default / none / minimal / low / medium / high / xhigh)
- with a session focused: sets that session; refused mid-run like /profile
- with nothing focused: becomes the default for the next CreateSession
- `StatusItem::Effort` badge shows only when a pin is set

Regression fix found on the way: every earlier migration guard listed
"33" as already-applied but not "34", so a fully migrated store failed
its second open with Persistence(Constraint). Added "34" to all guards
and a reopen regression test that would have caught it.

`ReasoningEffort` gains `ALL` and `as_str()` so the wire spelling has one
source across codec, TUI, and pickers.

Verification: cargo test --workspace, fmt --check, clippy -D warnings,
qq-provider --no-default-features --features test-support.
…rotocol 27

Protocol 26 was claimed by #120 (turn recovery, ADR-0040) while #122 was open, so the effort pin moves to protocol 27. v26/ goldens are #120's; v27/ is regenerated from them plus command_set_session_effort and receipt_session_effort_set. Harbor trace fixtures bump 26 -> 27. Store schema stays 34 (main is on 33). MAX_TURN_RETRIES kept.

Also picks up #126-#128 (RR6, RR7, onboarding); no overlap.

Verified on the identical tree as a rebase: cargo test --workspace, fmt --check, clippy -D warnings all green.
@lg2m
lg2m added this pull request to stack #131 September 22, 2026 21:06
@lg2m
lg2m merged commit ca74e2e into main Sep 22, 2026
4 checks passed
@lg2m
lg2m deleted the feat/tui-session-reasoning-effort branch September 22, 2026 21:06
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.

1 participant