fix(web): refresh active session rows when metadata changes - #399
Open
hashbender wants to merge 1 commit into
Open
fix(web): refresh active session rows when metadata changes#399hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The web Sessions page can show stale metadata for a live session when another Hermes process appends messages to the same session. The overview poll already runs every few seconds, but it only used the newest session id as its change signal. If the active session remains the newest row, the id does not change, so the paginated Sessions list can keep showing an old message count, preview, timestamp, or active state until a manual refresh.
This PR changes the overview-poll decision from a newest-id-only check to a lightweight snapshot comparison. The page still avoids a visible loading spinner, but it now silently refreshes the paginated list when active-session fields that are visible in the UI change while the session id stays the same.
Related Issue
No upstream issue number. This was found while watching a live Hermes session continue receiving messages from another process while the web Sessions page still showed stale zero-message/old-preview state.
Type of Change
Changes Made
web/src/lib/session-refresh.ts: compare overview session snapshots instead of only the newest session id.web/src/lib/session-refresh.ts: trigger a silent paginated-list refresh when:web/src/pages/SessionsPage.tsx: keep the last overview snapshot in a ref and use it for stale-list detection during the existing overview poll.web/src/lib/session-refresh.test.ts: add regression coverage for first poll, empty responses, unchanged snapshots, new sessions, sessions appearing after an empty baseline, and same-id active-session updates.How to Test
cd web && npm test -- --run src/lib/session-refresh.test.ts— passed, 6 tests.cd web && npm test— passed, 5 files / 33 tests.cd web && npm run typecheck— passed.cd web && npm run build— passed, with the existing Vite large-chunk warning.cd web && npx eslint src/lib/session-refresh.ts src/lib/session-refresh.test.ts— passed.cd web && npm run lint— fails on existing repo-wide React compiler/hook findings outside this patch, including pre-existingSessionsPagehook/ref findings. The changed helper/test files lint cleanly.pytest tests/ -q— attempted after installing the full Python dev/test extras in a Python 3.11 venv. It does not pass in this checkout; failures are in existing Python tests unrelated to this web patch. The clearest isolated failure istests/agent/test_anthropic_adapter.py::TestRunOauthSetupTokenon macOS, where the test's globalsubprocess.runmock is also seen by the macOS keychain credential reader and producesTypeError: the JSON object must be str, bytes or bytearray, not MagicMock.scripts/run_tests.sh -j 8 tests/ -q— attempted because the repo documents this as the canonical per-file pytest runner. It also fails before completion on existing Python-suite failures unrelated to this patch; after isolatingHOME, the Bedrock local-region failure disappears, but the Anthropic OAuth mock/keychain failures remain.Duplicate Check
Searched open PRs for active/session refresh overlap before opening this PR.
apps/desktopactive-chat hydration for external messages. It does not change the web Sessions page paginated-list refresh path.mainalready contains the silent-load/overview-polling structure, but the remaining refresh decision still keys off only the newest id. This PR narrows in on that same-id active-session metadata gap.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass (attempted; current checkout fails in unrelated Python tests, see How to Test)Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A.
Screenshots / Logs
Regression evidence:
Mirror-of: NousResearch#56472
NousResearch#56472