Skip to content

PR1 of #136: effort wiring, background catalog fetch, persistent footer control - #215

Merged
github-actions[bot] merged 2 commits into
mainfrom
feat/effort-wiring-catalog-fetch-footer-control
Aug 4, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
feat/effort-wiring-catalog-fetch-footer-control

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

First of a phased PR sequence implementing #136 (provider/model/effort picker redesign). This PR covers the foundational fixes and the persistent steady-state control; zero-state onboarding and cross-route model search polish follow in later PRs.

  • Fixes a real bug: the TUI's selected reasoning effort was never actually sent on outbound requests — AgentSession::build_model_request() hardcoded reasoning_effort: None. Added AgentSession.reasoning_effort, synced fresh each turn (sync_effort_to_session) from the active model's actual effort support, so an unsupported model never gets sent a stale/meaningless value.
  • Background catalog fetch: opening /connect or /model used to block the UI thread on live HTTP calls (refresh_stale: true). Now the overlay opens instantly from cache, and a background thread (mirroring the existing poll_repo_header off-thread pattern) refreshes the on-disk catalog cache, polled non-blocking from the event loop — never from draw(). Warms once per session, the first event-loop tick after a profile is connected (not at construction — see note below).
  • Persistent [vendor/route] [model] [effort] footer control: reuses the existing ConnectModel overlay/picker machinery in a new smaller "compact" anchored-above-footer render mode instead of building a parallel state machine, so Tab/Shift-Tab/Enter/Escape and the focus-vs-selection distinction all come for free. Activated by Alt+C, clicking a footer segment, or the existing /connect//model commands. Footer row stays capped at height 1 (no second row) — it now persistently shows the control instead of sitting empty whenever there's no contextual hint.

Note on a mid-review fix

Initially wired the background catalog warm-up into restore_saved_auth() (construction time). That caused render_perf.rs's allocation-regression guard to fail — a global-allocator-based test that counts allocations across all threads, so the newly spawned background network thread's allocations bled into its measurement, and asymmetrically so (construction time scales with transcript setup cost). Moved the warm-up to a one-time event-loop tick instead (warm_catalog_once_connected, gated by a catalog_fetch.warmed flag) — this also keeps it further from draw() per the issue's own guidance, and as a side effect fixed a real ~3x slowdown it had introduced across the whole forge-tui test suite (any test constructing a connected TuiApp was spawning a real background thread).

Test plan

  • cargo fmt --all -- --check
  • cargo test -p forge-tui --lib (733 passed)
  • cargo test -p forge-connect --lib (184 passed)
  • cargo test --workspace --all-targets --locked — all green except a pre-existing, unrelated forge-config failure (permissions::tests::*), confirmed via git diff showing zero changes to that crate and reproduced identically against unmodified main: this dev machine's real ~/Library/Application Support/forge/permissions.toml leaks into those tests, which don't isolate dirs::config_dir(). Not introduced by this PR; out of scope to fix here.

…og fetch, persistent footer control

PR1 of #136 (provider/model/effort picker redesign), split per the phased
plan: onboarding and cross-route search follow in later PRs.

- Fix a real bug: the selected reasoning effort was never sent on outbound
  requests (AgentSession::build_model_request hardcoded None). Wire it
  through AgentSession.reasoning_effort, synced fresh each turn from the
  active model's actual support.
- Replace synchronous, blocking catalog refresh (opening /connect or /model
  froze the UI thread on live HTTP calls) with a background-thread fetch,
  polled non-blocking from the event loop and warmed once per session the
  first tick a profile is connected — never from draw(), which must stay a
  side-effect-free projection of state.
- Add the persistent [vendor/route] [model] [effort] footer control: reuses
  the existing ConnectModel overlay machinery in a smaller, anchored
  "compact" mode instead of a full-screen-only picker, activated via Alt+C,
  mouse click, or the existing /connect and /model commands.
@github-actions
github-actions Bot enabled auto-merge (squash) August 4, 2026 00:02
CI's cargo clippy -D warnings caught what my local validation (fmt + test,
no clippy) missed.
@github-actions
github-actions Bot merged commit b17c66a into main Aug 4, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
…er control (#215)

* feat(tui,core): wire reasoning effort into requests, background catalog fetch, persistent footer control

PR1 of #136 (provider/model/effort picker redesign), split per the phased
plan: onboarding and cross-route search follow in later PRs.

- Fix a real bug: the selected reasoning effort was never sent on outbound
  requests (AgentSession::build_model_request hardcoded None). Wire it
  through AgentSession.reasoning_effort, synced fresh each turn from the
  active model's actual support.
- Replace synchronous, blocking catalog refresh (opening /connect or /model
  froze the UI thread on live HTTP calls) with a background-thread fetch,
  polled non-blocking from the event loop and warmed once per session the
  first tick a profile is connected — never from draw(), which must stay a
  side-effect-free projection of state.
- Add the persistent [vendor/route] [model] [effort] footer control: reuses
  the existing ConnectModel overlay machinery in a smaller, anchored
  "compact" mode instead of a full-screen-only picker, activated via Alt+C,
  mouse click, or the existing /connect and /model commands.

* fix(tui): satisfy clippy::obfuscated_if_else in footer effort label

CI's cargo clippy -D warnings caught what my local validation (fmt + test,
no clippy) missed.
mohitranka added a commit that referenced this pull request Sep 11, 2026
…er control (#215)

* feat(tui,core): wire reasoning effort into requests, background catalog fetch, persistent footer control

PR1 of #136 (provider/model/effort picker redesign), split per the phased
plan: onboarding and cross-route search follow in later PRs.

- Fix a real bug: the selected reasoning effort was never sent on outbound
  requests (AgentSession::build_model_request hardcoded None). Wire it
  through AgentSession.reasoning_effort, synced fresh each turn from the
  active model's actual support.
- Replace synchronous, blocking catalog refresh (opening /connect or /model
  froze the UI thread on live HTTP calls) with a background-thread fetch,
  polled non-blocking from the event loop and warmed once per session the
  first tick a profile is connected — never from draw(), which must stay a
  side-effect-free projection of state.
- Add the persistent [vendor/route] [model] [effort] footer control: reuses
  the existing ConnectModel overlay machinery in a smaller, anchored
  "compact" mode instead of a full-screen-only picker, activated via Alt+C,
  mouse click, or the existing /connect and /model commands.

* fix(tui): satisfy clippy::obfuscated_if_else in footer effort label

CI's cargo clippy -D warnings caught what my local validation (fmt + test,
no clippy) missed.
mohitranka added a commit that referenced this pull request Sep 11, 2026
…er control (#215)

* feat(tui,core): wire reasoning effort into requests, background catalog fetch, persistent footer control

PR1 of #136 (provider/model/effort picker redesign), split per the phased
plan: onboarding and cross-route search follow in later PRs.

- Fix a real bug: the selected reasoning effort was never sent on outbound
  requests (AgentSession::build_model_request hardcoded None). Wire it
  through AgentSession.reasoning_effort, synced fresh each turn from the
  active model's actual support.
- Replace synchronous, blocking catalog refresh (opening /connect or /model
  froze the UI thread on live HTTP calls) with a background-thread fetch,
  polled non-blocking from the event loop and warmed once per session the
  first tick a profile is connected — never from draw(), which must stay a
  side-effect-free projection of state.
- Add the persistent [vendor/route] [model] [effort] footer control: reuses
  the existing ConnectModel overlay machinery in a smaller, anchored
  "compact" mode instead of a full-screen-only picker, activated via Alt+C,
  mouse click, or the existing /connect and /model commands.

* fix(tui): satisfy clippy::obfuscated_if_else in footer effort label

CI's cargo clippy -D warnings caught what my local validation (fmt + test,
no clippy) missed.
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