fix(session): read cold seeded rows from the projection cache by header

The projection cache read-only face (cachedSnapshot, cachedPredecessorTitle) now matches the lifecycle identity a header witnesses (formatVersion, createdAt, cwd, isSeeded) and serves its rows as a cached block with asOfSeq -1. The fold face (hydratePrepared, write, coldSnapshot) keeps the full identity including the inherited cut. The session list and @ completion drop their isSeeded guards, so forked sessions keep their cached title and list metadata across a Host restart; list-children keeps its body fallback.
This commit is contained in:
imccyu committed 2026-09-20 01:31:52 +08:00
1 parent bfcfc9ed2f
commit 86ca9de07e
18 files changed
+297 -199

No files matched your search

+3 -5
View File
@@ -3,7 +3,6 @@
import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-agent-presets'
import type { ImageAttachmentLimits } from '@deepseek-ai/dsh-attachment'
import { SessionLogOffset } from '@deepseek-ai/dsh-session'
import type { Session, SessionEvent, SessionHeader, SessionId } from '@deepseek-ai/dsh-session'
import type {} from '@deepseek-ai/dsh-session-projection'
import type {} from '@deepseek-ai/dsh-session-projection-cache'
@@ -273,11 +272,10 @@ export class ApiSessionList {
): SessionProjectionHints | undefined {
try {
const cache = this.ctx.get('sessionProjectionCache')
// A cold row reads the cache by header alone; the cache serves seeded
// and unseeded lifecycles alike because a listing never seeds a fold.
const block = session === undefined
? header.isSeeded
? undefined
: cache?.cachedSnapshot(header, SessionLogOffset(0))
?? cache?.cachedPredecessorTitle(header, SessionLogOffset(0))
? cache?.cachedSnapshot(header) ?? cache?.cachedPredecessorTitle(header)
: this.ctx.sessionProjections.cachedSnapshot(session)
return block !== undefined && Object.keys(block.values).length > 0
? {