#8083: fix(tui): update model status immediately after /model command
stale
Cluster:
UI and Model Management Enhancements
fix(tui): update model status immediately after /model command
**Description:**
This PR improves the TUI experience by making the model status update immediately when the user initiates a change via the `/model` command. Previously, the footer status would only update after the next chat responses were received or after session restart.
https://github.com/user-attachments/assets/a18a81f0-7594-4e40-a996-6c7d6f0485b2
**Changes:**
- Implemented optimistic UI updates in [src/tui/tui-command-handlers.ts](cci:7://file:///home/rohan/projects/workspace/openclaw/src/tui/tui-command-handlers.ts:0:0-0:0) to reflect model changes instantly.
- Added `parseModelString` helper to clean up model parsing logic.
- Updated `refreshSessionInfo` to support immediate overrides.
- Fixed type signatures in `tui-event-handlers.ts` for better consistency.
**Why:**
Enhances the perceived responsiveness of the application and provides immediate feedback to the user that their model selection command was successful.
**AI-Assisted:**
- [x] AI-assisted (Generated with Gemini-3-Pro in Openclaw agent and reviewed by Opus 4.5 in Antigravity)
- [x] Ran tests: pnpm build && pnpm check && pnpm test. Verified locally with manual `/model` command.
- [x] I understand what the code does.
Disclaimer: I found the issue and then used the help of AI to fix the code. I started with the following prompt then did several, appropriate multi-turns.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR improves TUI responsiveness by applying an optimistic model/provider update immediately after a `/model` change, wiring `refreshSessionInfo` to accept optional `SessionInfo` overrides, and updating event-handler type signatures for consistency.
The change fits into the existing TUI flow by reusing the existing `refreshSessionInfo` footer/autocomplete refresh path, while allowing callers (notably `/model`) to override the session info state right away rather than waiting for the next server-driven refresh.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge, with a couple edge cases around model string parsing and optimistic update timing.
- Changes are localized to TUI session refresh plumbing and command handling, and mostly adjust types/flow. The main risk is incorrect optimistic state when parsing `provider/model` strings with unexpected formats, plus slightly delayed optimistic updates when a refresh is already in flight.
- src/tui/tui-command-handlers.ts and src/tui/tui-session-actions.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#7794: fix(tui): refresh session info periodically to reflect config changes
by GuoxiangZu · 2026-02-03
85.7%
#21932: fix(tui): eliminate stale model indicator lag in TUI
by graysurf · 2026-02-20
84.0%
#6750: fix(tui): show session model overrides in status bar
by ewijaya · 2026-02-02
83.1%
#6440: feat(ui): add model picker dialog with provider filtering
by igorls · 2026-02-01
81.1%
#3496: fix(tui): handle /model status and /model list subcommands
by zerone0x · 2026-01-28
80.7%
#11115: [AI-assisted] Add /model-set chat command with autocompletion and s...
by dorgonman · 2026-02-07
79.8%
#21791: feat(TUI): show main agent model in status footer
by chansuke · 2026-02-20
79.3%
#11109: fix(tui): prefer config contextTokens over persisted session value
by marezgui · 2026-02-07
77.1%
#8522: feat(control-ui): Add Model Requests panel for real-time API monito...
by GiantAxeWhy · 2026-02-04
76.8%
#17538: feat(sessions): add resolvedModel field
by Facens · 2026-02-15
76.7%