fix: import missing Hermes sessions into WebUI chat#528
Open
SulthanZahran1 wants to merge 2 commits into
Open
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.
Why
WebUI has two session views that do not read from the same database:
state.db.hermes-web-ui.db).That means a session created from another browser/device can exist in Hermes core and show up in History, but still be missing from the Chat sidebar unless WebUI imports it into its local DB.
On current
main, that import only happens on a completely empty WebUI DB. Once the local DB has any session, startup sync exits early forever. It also only importsapi_serversessions, even though WebUI-originated chats are stored in Hermes core with sourcewebui.Result: cross-device/browser Chat history can silently stop syncing after the first local session exists.
Root cause on current
mainsyncAllHermesSessionsOnStartup()currently does this:And the profile sync only queries one source:
So there are two separate problems:
webuisessions are never queried/imported.What this changes
webuiapi_serverprofile + source + started_at + title, it is treated as already imported.state.db.Stale web app cache cleanup
This PR also adds server-side cache headers for the SPA shell and a cleanup response for legacy service worker URLs.
Reason: while testing this class of WebUI fixes, stale browser assets/service workers can make the deployed app keep running old frontend code even after the backend fix is deployed. The new policy keeps hashed assets cacheable, but prevents
/and/index.htmlfrom being pinned stale.Verification
Confirmed the bug still exists on latest
origin/main(9fbff08):listSessionSummariesat all.listSessionSummaries('api_server', 10000, 'default')only; it never querieswebui.Tested this branch with:
npm test -- tests/server/session-sync.test.tsnpm run buildNotes
CONTRIBUTING.mdor PR template was present.packages/server/src/services/gateway-bootstrap.tsanddocker-compose.override.yml.