Skip to content

fix(web): refresh active session rows when metadata changes - #399

Open
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56472
Open

fix(web): refresh active session rows when metadata changes#399
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56472

Conversation

@hashbender

Copy link
Copy Markdown
Owner

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

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

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:
    • a new newest session appears,
    • sessions appear after a known empty baseline,
    • or a still-active/recently-active session changes visible fields such as message count, tool call count, token counts, title, preview, timestamps, or active state.
  • 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

  1. cd web && npm test -- --run src/lib/session-refresh.test.ts — passed, 6 tests.
  2. cd web && npm test — passed, 5 files / 33 tests.
  3. cd web && npm run typecheck — passed.
  4. cd web && npm run build — passed, with the existing Vite large-chunk warning.
  5. cd web && npx eslint src/lib/session-refresh.ts src/lib/session-refresh.test.ts — passed.
  6. cd web && npm run lint — fails on existing repo-wide React compiler/hook findings outside this patch, including pre-existing SessionsPage hook/ref findings. The changed helper/test files lint cleanly.
  7. 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 is tests/agent/test_anthropic_adapter.py::TestRunOauthSetupToken on macOS, where the test's global subprocess.run mock is also seen by the macOS keychain credential reader and produces TypeError: the JSON object must be str, bytes or bytearray, not MagicMock.
  8. 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 isolating HOME, 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.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass (attempted; current checkout fails in unrelated Python tests, see How to Test)
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS local checkout, Node/npm web workspace

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A.

Screenshots / Logs

Regression evidence:

  • Before the implementation, the focused test failed because the old helper could not correctly evaluate overview snapshots; unchanged same-id snapshots and empty current snapshots were treated as changed by reference.
  • After the implementation, focused and full web tests pass.

Mirror-of: NousResearch#56472
NousResearch#56472

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