Skip to content

feat(tui): add the /jev picker and status badge for the session Jev mode (ADR-0042) - #170

Closed
devin-ai-integration[bot] wants to merge 1 commit into
devin/1790291940-jev-mode-kernelfrom
devin/1790293652-jev-mode-tui
Closed

devin-ai-integration[bot] wants to merge 1 commit into
devin/1790291940-jev-mode-kernelfrom
devin/1790293652-jev-mode-tui

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Stacked on #166 (base: devin/1790291940-jev-mode-kernel). Merge #166 first; this PR is the TUI surface for the set_jev_mode command it adds.

What changes for users

/jev opens a picker for the focused session's Jev mode — configured, low, medium, high, max, ultrajev — with a one-line summary of what each rung enables and active on the rung in effect. The picker opens on the current rung; Enter sends set_jev_mode for the focused session (running or not — the runtime reads it when it claims the next run, the active run keeps its plan), and the receipt reports:

session jev mode set to ultrajev from the next run
jev mode cleared: the configured Jev settings apply from the next run
session already uses jev mode ultrajev          (no command is sent)
focus a session to choose its Jev mode          (nothing focused)

The top row shows jev max while a rung is set and nothing when the session uses the configured capabilities, mirroring the effort … badge. /jev is listed under /help and /commands in the Model group next to /models and /effort, which are unchanged.

Why / design

ADR-0042 (docs/adr/0042-session-model-and-jev-mode-switchers.md). The picker mirrors /delegate: the mode belongs to a session that exists, so there is no "default for the next /new" path (children inherit the parent's mode in the store instead). Rows come from JevMode::ALL, so the TUI cannot drift from the protocol's ladder order. The /jev reservation in RESERVED_CLIENT_SLASH_COMMANDS moves from #166 to this PR because the TUI's registry test requires every reserved slash command to be registered.

Mode::Jev (not Mode::JevMode) because Clippy's enum_variant_names rejects a variant that ends with the enum's name; Overlay::JevMode(Picker<JevModeRow>) keeps the full name.

Linear: ENG-
Slice: workstream (d) model switcher, TUI slice (ADR-0042)

How verified

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace — all suites green; qq-tui 326 passed (3 new), qq-protocol 48 passed
  • cargo test -p qq-provider --no-default-features --features test-support (n/a — qq-provider unchanged in this PR; run green on the base)
  • cargo build --workspace
  • Manual check: not run against a live TUI; behavior is pinned by the tests below

New tests:

  • app::tests::jev_mode_picker_switches_the_focused_session_and_reports_the_receipt — row order equals [None] ++ JevMode::ALL; ultrajev sends SetJevMode { mode: Some(Ultrajev) } for the focused (running) session; the JevModeSet receipt sets the status; reopening on the active rung sends nothing; configured sends mode: None and the clear receipt is reported
  • app::tests::jev_mode_picker_needs_a_focused_session
  • view::tests::jev_mode_picker_and_badge_name_the_rung_in_effect — no badge for None, jev max badge for Some(Max), picker renders JEV MODE with all six rows and marks only max active
  • Existing registry test now covers /jev (24 reserved slash commands ↔ 42 command specs)

Impact

Link to Devin session: https://app.devin.ai/sessions/5288c73e9e644e0dad0a0c23700b9b46
Open in Devin Desktop: https://app.devin.ai/desktop/session/5288c73e9e644e0dad0a0c23700b9b46?variant=devin
Requested by: @integrate-your-mind

…ode (ADR-0042)

Reserve /jev in the protocol again now that the TUI registers it. The
picker lists configured plus the five rungs, opens on the rung in effect,
sends set_jev_mode for the focused session (running or not; the runtime
reads it at the next claim), and reports the receipt. The top row shows
'jev <mode>' while a rung is set; 'configured' shows nothing.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Live QA (server + TUI), against a real qq serve on this branch

No code changed. Evidence below was captured against the debug build of 6cbe790 (this PR, stacked on #166) with a fresh ~/.local/share/qq/sessions.sqlite3 (schema 37) and the TUI attached to the running server.

qq serve HTTP / SSE / SQLite

Check Result
POST /v1/sessions/jev-mode for low, medium, high, max, ultrajev 200, outcome jev_mode_set with the mode echoed, committed_through.sequence advancing 2..6
Clear (mode omitted) 200, outcome jev_mode_set without mode; sessions.jev_mode is NULL in SQLite
SQLite after each set sessions.jev_mode holds the canonical string (high, ultrajev, ...)
POST /v1/workspaces/snapshot SessionSummary.jev_mode present when pinned, omitted when cleared; focused.summary.jev_mode matches
SSE replay from Last-Event-ID: <store>:<ws>:0 one session_updated per command, in order, jev_mode = low, medium, high, max, ultrajev, <absent>, high, ...; session_created for the child already carries the inherited high
Child inherits parent pin child row jev_mode = high in SQLite and in the snapshot
Kill and restart qq serve snapshot and replay unchanged after restart (durable); further set/clear after restart behaves the same
Validation unknown mode "turbo" -> 400 invalid request; unknown session -> 400 session was not found; no bearer -> 401
Rung applied at claim time (fail closed) with a placeholder OPENAI_API_KEY and no TYPESAFE_API_KEY: pinned high -> run_finished failed{kind: configuration, "JEV review or routing requires the stored typesafe-jev credential or TYPESAFE_API_KEY before the agent starts"} before any provider call; pin cleared -> the same session reaches OpenAI (provider_authentication 401 on the placeholder key). The pin changes runtime composition for the next run only, as documented.

TUI /jev (recorded, real terminal, attached to the same server)

  • Passed: /jev listed under Model in /help and /commands; picker JEV MODE shows six ordered rows (configured, low, medium, high, max, ultrajev) with summaries and the current row marked active.
  • Passed: choosing max closes the picker, status session jev mode set to max from the next run, top row shows jev max.
  • Passed: reopening marks max active; accepting it shows session already uses jev mode max, SQLite unchanged, persisted event count unchanged (26 -> 26).
  • Passed: choosing configured shows jev mode cleared: the configured Jev settings apply from the next run, badge removed, SQLite NULL.
  • Passed: set high, quit, relaunch: badge jev high is back from server state.
  • Passed (regression): /models and /effort open and close normally.
  • Untested: the no-focus warning (/new needs a client-side model credential in this environment, so a no-focus state was not reached; covered by the unit test jev_mode_picker_needs_a_focused_session).
Six-mode picker Max selection and receipt
Configured active with six ordered modes Max badge and next-run receipt
Clearing and persistence
Cleared to configured High retained after relaunch
Cleared badge and receipt High persisted after restart

@lg2m
lg2m added this pull request to stack #175 September 25, 2026 14:55
@lg2m
lg2m self-requested a review September 25, 2026 14:57
@lg2m
lg2m marked this pull request as draft September 25, 2026 14:57
@integrate-your-mind

Copy link
Copy Markdown
Collaborator

Incorporated by replacement in merged #181, main 2103aa5. Independent exact-source review accounted for all unique #166/#170 changes: saved session mode, /jev picker and badge, receipts, guards and focused tests remain, with misleading active/approval wording repaired. The retained integration c5a5836 includes this exact head as its second parent; the accepted replacement tree is now main. Closed as incorporated, not merged. Original head 6cbe790 and branch are retained. Review report SHA256 c84c39eb2f75aa066e68517f83dee144fb565989b20b2142702ebe6d947cd0dd. No unique output was discarded; live runtime/release qualification remains separate.

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.

2 participants