Web session list loads slowly on refresh — listArtifacts scans archived sessions too #5961
pure-craft
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Symptom
After refreshing the DSH Web page, the workspace session list in the sidebar takes a noticeable delay (several seconds) to appear.
Investigation
I traced the session list loading pipeline:
SessionManager.handleConnected()→refreshList()→remote.session.list({})ApiSessionList.list()→sessionQuery.listSessions()→persistence.list()JsonlSessionPersistence.listArtifacts()iterates over all project directories and session directories, performingopen → read → Zstd decompress → JSON parse headerfor every session file on disk.The key finding:
listArtifacts()scans every session file indiscriminately, including archived ones. The archive filter (archivedSessionIds) is applied only in the client-side UI layer (sessionVisible()), well after the full I/O cost has already been paid.Why this matters
list()I/O cost grows linearly with the total number of persisted sessions — not just the active ones.Possible improvements
listArtifacts()orlist()accept an exclude set so archived session IDs can be skipped at the file-scanning stage (this would require coordination betweenworkspaceRegistryandsessionPersistence).readdir-only fast path that returns directory names / session IDs without reading headers, letting the client lazy-load metadata on demand.All reactions