[Bug] @ mention menu takes 3-4s per keystroke: session-reference titles re-decompress every persisted session log (archived/subagent sessions included), no cache, no debounce #3740
Yingjie-Zhao
started this conversation in
General
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.
Problem
In
0.1.0-rc.8the composer@menu (the new file & session references feature) takes 3–4 seconds every time before candidates render — and this repeats on essentially every keystroke, not just the first open. Directory-scoped queries like@personal/are equally affected, even though the file side alone would be a singlereaddir.Environment:
@deepseek-ai/dsh@0.1.0-rc.8from npm,dsh webon macOS 26, ~67 persisted sessions / 40 MB ofsession.jsonl.zstdlogs / ~148k events in~/.dsh/sessions.Root cause (from the rc.8 sources)
The slowness is on the session-reference side, not the file side:
Client gating + no debounce.
dsh-client-ui-referenceresolves candidates viaawait Promise.all([fileReferences.list(...), sessionReferenceResolver.candidates(...)]), so instant file results are blocked by the slow session query.dsh-client-ui-input-triggerfires one RPC pair per keystroke with no debounce.No pre-filtering in
dsh-session-reference. InlistCandidates, when the query is non-empty,inspected = records— all sessions are passed toreadTitleSnapshotsbefore the needle filter andslice(0, limit)are applied.Title snapshots re-read everything.
readTitleSnapshots→SessionCorpus.projectMany→inspectPersistedopens, zstd-decompresses and JSON.parses each session's complete log (147k events in my case) just to fold the latestsession/titleevent. Thesession_projcache.jsonstore only accelerateslistSessionsheaders; there is no title index. Nothing caches the result between keystrokes.Archived and subagent sessions are scanned too. The workspace registry's
archivedSessionIdsis only consumed by sidebar grouping;sessionQuery.listSessionshas no notion of it. On my machine 46 of 67 persisted sessions (30.6 MB) were archived — invisible in the sidebar and unreachable via the UI (rc.8 hasarchiveSessionbut no unarchive affordance) — plus 17 leftoverorigin: 'subagent'session dirs, and every one of them is fully decompressed on every@keystroke.(Secondary, file side: a bare fuzzy query triggers a full workspace BFS capped at 10k entries — only
.git/node_modulesexcluded — and the index is invalidated on everytool/result, so it rarely survives an active session. This is fine on small trees but adds up on large ones.)Measured
~/.dsh/sessions(40 MB → 5.6 MB), the same menu renders in ~0.5 s.Suggested fixes
listCandidates, filterrecordsby sessionId/cwd (and rank) before callingreadTitleSnapshots, and apply the limit first; only resolve titles for the surviving candidates.archivedSessionIdsand skiporigin: 'subagent'sessions (or rank them last).@keystrokes, and render file/session sections independently instead of onePromise.allgate.User-side workarounds
@"path"— quoted queries short-circuit the session resolver entirely (quoted === true → Promise.resolve([])), so only the fast file path runs.~/.dsh/sessions(keep a backup) and restartdsh web; the scan cost is linear in total session-log bytes.I searched the repo's discussions and did not find an existing report for this (Issues are not enabled on the repo, so filing here per community convention).
(中文简述:rc.8 的
@菜单每次按键都要 3–4 秒,根因不在文件扫描,而在会话引用侧——非空查询时不做预过滤就对全部持久化 session 调用readTitleSnapshots,每次都把每个session.jsonl.zstd完整解压+逐行 JSON.parse(实测 40MB/14.7 万行 ≈ 3.6s),且不看归档标记(46 个已归档 + 17 个子代理残留照样全量扫);客户端无防抖且Promise.all让秒出的文件结果陪等。建议:先过滤/截断再读标题、建标题索引、尊重archivedSessionIds、客户端防抖并分段渲染。临时绕过:用引号形式@"..."跳过会话侧,或把旧会话目录移出~/.dsh/sessions后重启。已检索 discussions,未见同类报告。)All reactions