fix(desktop): keep model runtime state per session#40163
Conversation
|
Follow-up fix pushed in c92f3a0:
This addresses the remaining report that the lower status bar model label could still stay wrong after switching sessions / returning to a new draft even after the earlier cached-session runtime-state fix. |
|
Found the remaining bug and pushed a backend fix in 8c82bee2f. The renderer fixes were necessary but not sufficient: New behavior:
I verified against Peter's actual DB rows: |
|
Final sweep found and fixed one more persistence edge case in e899f497a. After the resume fix, the old-session footer state was restored correctly. The remaining weird case was future resumes after live runtime changes: a model switch / reasoning change / fast toggle could update the current frontend via New follow-up:
Manual verification from Peter: restarting Hermes and switching sessions now updates the footer correctly. |
e899f49 to
c9de80f
Compare
|
Rebased this branch onto current Current status:
Local verification:
|
ReviewApproach is sound and the diagnosis is correct, but the branch is stale/conflicting against current What's good
Blocking — branch is stale again
Correctness concerns
Minor
Suggested path
|
(cherry picked from commit f72ee87d99ee38cb7b5badeb9a8af869bb92073a)
(cherry picked from commit d91942ebd4671ff857b5c8526dbf133f04782ecb)
(cherry picked from commit 32b3793418257617b8da57e26151f079c2620d00)
(cherry picked from commit c58467779436dcef44a80ad55b52664752dc0837)
c9de80f to
4924f7a
Compare
|
Rebased onto current Addressed the review points:
Verification on the rebased branch:
I also ran an independent review pass over the rebased branch; no blockers were found. |
|
Superseded by #43702. Salvaged your five commits (authorship preserved via cherry-pick) onto current
Verification on the merged tree: Closing in favor of #43702. Thanks @pinguarmy! |
Summary
session.infoand emitsession.infoafter reasoning/fast/model changesRoot cause
Desktop had multiple stale-state paths:
session.resumerebuilt the backend agent from current global config rather than the stored session row. That meant an older chat whose DB row saidgpt-5.4+ high reasoning could still resume as the latest globalgpt-5.5+ medium reasoning, so the frontend received the wrongsession.infopayload even after renderer fixes.Test plan
GPT-5.5 · Medto the older chat's stored runtime as expected./Users/peterhao/.hermes/hermes-agent/.venv/bin/python -m pytest tests/test_tui_gateway_server.py::test_session_resume_passes_stored_runtime_to_agent tests/test_tui_gateway_server.py::test_persist_live_session_runtime_preserves_resume_metadata tests/test_tui_gateway_server.py::test_make_agent_uses_session_runtime_overrides tests/test_tui_gateway_server.py::test_session_resume_uses_parent_lineage_for_display tests/test_tui_gateway_server.py::test_make_agent_defaults_to_90 -q -o 'addopts='/Users/peterhao/.hermes/hermes-agent/.venv/bin/python -m py_compile tui_gateway/server.py tests/test_tui_gateway_server.pyPATH=/Users/peterhao/.nvm/versions/node/v24.14.0/bin:$PATH npm run type-check --workspace apps/desktopapps/desktop:PATH=/Users/peterhao/.nvm/versions/node/v24.14.0/bin:$PATH ../../node_modules/.bin/vitest run src/app/session/hooks/use-model-controls.test.tsx src/lib/model-status-label.test.ts src/store/session.test.ts --environment jsdom