Replies: 1 comment
|
对照当前 main HEAD
一个补充观察: 另外你的补丁提到的"全部 unit 都失败时保留旧记录"这点很关键——建议在缓存套件里同时断言"旧记录不被空记录覆盖"的持久化层面(不只是 |
0 replies
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.
Session projection cache: one non-JSON unit state currently stops title caching for every session
TL;DR —
SessionProjectionCache.put()serializes the whole checkpoint through a singlesnapshotJsonValue(rows)pass, so one unit whose state violates the plain-JSON contract (e.g. a third-party plugin'scontextTimelineinitial state containingundefinedfields) makes the entire record unwritable. The write path is fail-soft (flushSoftlogs and keeps the cache stale), so the failure is silent: every session's cache row stops updating, and after an environment restart the sidebar history shows each session's workspace title (cwd basename) instead of its task title — the title only appears after clicking the session, when the host's live registry snapshot supplies it.I prepared a small fix and would like to contribute it back. Since pull requests are currently disabled on this repository, I'm posting it here per the CONTRIBUTING guide.
Root cause chain
dsh-context0.12.x) registerscontextTimeline/contextHeadersprojection units. ItscreateTimelineState()returns an initial state containingundefinedfields (model,provider,lastModel,contextWindow,pendingShadowedSeqs).SessionProjectionCache.put()passes the whole checkpoint record tosnapshotJsonValue()once; a unit state containingundefinedviolates the plain-JSON contract →TypeError: projection checkpoint is not losslessly JSON-serializable→ the record cannot be cached.put()is wrapped by fail-softflushSoft/putSoft, so the failure is silent — the projection cache file simply stops updating. All sessions created after that point have no cached row.session.list's cold path reads projections from the cache; with no row there is no title projection, so the client falls back to the workspace title (cwd basename). Attaching the session (clicking it) reads the live registry snapshot, and the title appears — matching the reported "title only shows after I click it" behavior.Proposed fix
put()serializes per unit instead of per record:(key → row)passessnapshotJsonValueindependently.session projection cache: unit "<key>" state for "<id>" violates the plain-JSON contract; persisting without it); the remaining rows still land.The fail-loud contract (throw on any non-JSON unit) was deliberately changed: it never actually failed loud in production (both
flushSoftandputSoftwrapput), and its blast radius — one third-party bug erasing title caching for every session — outweighed its diagnostic value, which the per-unit warning preserves.Verification
cachedSnapshot; a checkpoint where every unit fails keeps the previous record).doc-sync: all 28 gates pass (doc-typecheck, translation pairing, etc.).putthrew, coldcachedSnapshotempty) and confirmed the fix (write succeeds, title survives in the cold snapshot,contextTimelineisolated out), including the full hostsession.listcold path serving the title.Where to find it
fix/session-projection-cache-per-unit-isolationon my fork — https://github.com/kkutysllb/deepseek-harness/tree/fix/session-projection-cache-per-unit-isolation5bef8cf—fix(session): isolate non-JSON projection units instead of failing the recordgit amHappy to rebase, adjust, or walk through anything. Thanks for considering it!
All reactions