Skip to content

feat(tui): argument auto-completion for /effort#3734

Merged
aheritier merged 2 commits into
mainfrom
feat/effort-completion
Jul 18, 2026
Merged

feat(tui): argument auto-completion for /effort#3734
aheritier merged 2 commits into
mainfrom
feat/effort-completion

Conversation

@aheritier

Copy link
Copy Markdown
Contributor

Closes #3731.

What

Pressing Tab after /effort and a space opens a completion popup listing the current model's supported reasoning-effort levels, so you can set the effort without remembering the exact vocabulary.

Behavior

Shows only the levels the current model supports — unsupported levels hard-fail on submit, so they're never offered. Candidates are never disabled. No popup changes. On non-reasoning models and remote runtimes, no candidates are offered (Tab falls through).

How

Two commits, reusing the generic argument-completion hook shipped in #3728:

  • A1 — runtime: extract the supported-levels resolution into a pure helper shared by the effort setter and a new getter LocalRuntime.CurrentAgentThinkingLevels(ctx), exposed via App.CurrentAgentThinkingLevels(ctx) (nil on remote / non-reasoning). The setter now takes a single EffectiveModels() snapshot and reuses it for both capability resolution and provider recreation — preserving the original single-snapshot semantics (no concurrent-/model race) while giving the getter and setter one source of truth.
  • A2 — tui: effortCandidates + attachEffortCompletion on the session.effort command, wired in BuildCommandCategories; docs.

Tests

  • Runtime: getter returns exactly the levels SetAgentThinkingLevel accepts; nil on non-reasoning/remote; a concurrency regression test that mutates the override between resolution and application (verified to fail against a double-snapshot implementation).
  • TUI: correct level ordering, never disabled, fresh-per-call, targets only /effort.

Reviewed locally: approved, race-targeted tests pass, no blocking issues.

Note

Stacked on #3728 (feat/toolset-restart-completion), which carries the generic hook. Merge after #3728.

@aheritier
aheritier requested a review from a team as a code owner July 17, 2026 20:48
@aheritier aheritier added area/docs Documentation changes area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only. labels Jul 17, 2026
dgageot
dgageot previously approved these changes Jul 18, 2026
Base automatically changed from feat/toolset-restart-completion to main July 18, 2026 07:25
@aheritier
aheritier dismissed dgageot’s stale review July 18, 2026 07:25

The base branch was changed.

@aheritier
aheritier enabled auto-merge July 18, 2026 12:20
@aheritier
aheritier marked this pull request as draft July 18, 2026 12:20
auto-merge was automatically disabled July 18, 2026 12:20

Pull request was converted to draft

@aheritier
aheritier marked this pull request as ready for review July 18, 2026 12:20
@aheritier
aheritier enabled auto-merge July 18, 2026 12:22
Extract the supported-thinking-levels resolution used by
applyAgentThinkingLevel into resolveAgentThinkingLevels, shared by both
the setter (SetAgentThinkingLevel/CycleAgentThinkingLevel) and a new
read-only LocalRuntime.CurrentAgentThinkingLevels. Expose it via
App.CurrentAgentThinkingLevels using the same optional-capability
pattern as CurrentAgentToolsetStatuses/ContextBreakdown, so remote
runtimes and non-reasoning models degrade to nil.

This is a behavior-neutral refactor: applyAgentThinkingLevel's existing
tests pass unchanged. It lands ahead of the /effort argument-completion
wiring (#3731) so completion candidates can never diverge from what
SetAgentThinkingLevel actually accepts.
Pressing Tab after "/effort " opens a completion popup listing the
current agent's supported reasoning-effort levels, reusing the
argument-completion hook shipped for /toolset-restart.

Candidates come from LocalRuntime.CurrentAgentThinkingLevels (added in
the previous commit), not the static effort vocabulary, so a level
offered here is always one SetAgentThinkingLevel actually accepts.
Unlike /toolset-restart, unsupported levels are never shown (not even
Disabled): the /effort picker dialog already only lists supported
levels, and completion should match it exactly.

Remote runtimes and non-reasoning models resolve to no supported
levels, so the popup simply doesn't open (Tab falls through to the
usual focus switch).
@aheritier
aheritier force-pushed the feat/effort-completion branch from 475aaf8 to f40621a Compare July 18, 2026 12:33
@aheritier
aheritier merged commit 76cbf81 into main Jul 18, 2026
18 checks passed
@aheritier
aheritier deleted the feat/effort-completion branch July 18, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs Documentation changes area/runtime Runtime engine, agent loop execution, tool dispatch, loop detection area/tui For features/issues/fixes related to the TUI kind/feat PR adds a new feature (maps to feat:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tui): argument auto-completion for /effort

2 participants