@@ -655,19 +655,19 @@ async function evaluateSourceManifestState(
655655
656656 if ( ! manifestEntry ) {
657657 const state : SourceManifestState = { source, parserVersion, manifestEntry, action : 'refresh' , reason : 'missing-entry' }
658- logCacheDebug ( source . provider , source . path , state . reason )
658+ logCacheDebug ( source . provider , source . path , state . reason ! )
659659 return state
660660 }
661661
662662 if ( manifestEntry . lastSeenParserVersion !== parserVersion ) {
663663 const state : SourceManifestState = { source, parserVersion, manifestEntry, action : 'refresh' , reason : 'parser-version' }
664- logCacheDebug ( source . provider , source . path , state . reason )
664+ logCacheDebug ( source . provider , source . path , state . reason ! )
665665 return state
666666 }
667667
668668 if ( source . cacheStrategy && manifestEntry . cacheStrategy && source . cacheStrategy !== manifestEntry . cacheStrategy ) {
669669 const state : SourceManifestState = { source, parserVersion, manifestEntry, action : 'refresh' , reason : 'parser-version' }
670- logCacheDebug ( source . provider , source . path , state . reason )
670+ logCacheDebug ( source . provider , source . path , state . reason ! )
671671 return state
672672 }
673673
@@ -678,14 +678,14 @@ async function evaluateSourceManifestState(
678678
679679 if ( ! manifestEntry . fingerprint || manifestEntry . fingerprintPath !== fingerprintPath ) {
680680 const state : SourceManifestState = { source, parserVersion, manifestEntry, action : 'refresh' , reason : 'fingerprint-miss' }
681- logCacheDebug ( source . provider , source . path , state . reason )
681+ logCacheDebug ( source . provider , source . path , state . reason ! )
682682 return state
683683 }
684684
685685 const currentFingerprint = await computeFileFingerprint ( fingerprintPath ) . catch ( ( ) => null )
686686 if ( ! currentFingerprint ) {
687687 const state : SourceManifestState = { source, parserVersion, manifestEntry, action : 'refresh' , reason : 'fingerprint-miss' }
688- logCacheDebug ( source . provider , source . path , state . reason )
688+ logCacheDebug ( source . provider , source . path , state . reason ! )
689689 return state
690690 }
691691
@@ -720,7 +720,7 @@ async function evaluateSourceManifestState(
720720 }
721721
722722 const state : SourceManifestState = { source, parserVersion, manifestEntry, action : 'refresh' , reason : 'fingerprint-miss' , currentFingerprint }
723- logCacheDebug ( source . provider , source . path , state . reason )
723+ logCacheDebug ( source . provider , source . path , state . reason ! )
724724 return state
725725}
726726
@@ -779,7 +779,7 @@ async function refreshClaudeCacheUnit(
779779 && ! ! cached . appendState
780780 && cached . sessions . length > 0
781781 && ! ! state . currentFingerprint
782- if ( shouldUseAppendOnly && manifestAppendState ) {
782+ if ( shouldUseAppendOnly && manifestAppendState && cached ?. appendState ) {
783783 if (
784784 manifestAppendState . tailHash !== cached . appendState . tailHash
785785 || manifestAppendState . endOffset !== cached . appendState . endOffset
@@ -789,7 +789,7 @@ async function refreshClaudeCacheUnit(
789789 }
790790 }
791791
792- if ( shouldUseAppendOnly && cached ) {
792+ if ( shouldUseAppendOnly && cached && cached . appendState ) {
793793 addSeenDeduplicationKeysFromSessions ( cached . sessions , localSeenMsgIds )
794794 const appendedLines : string [ ] = [ ]
795795 for await ( const line of readSessionLinesFromOffset ( unit . path , cached . appendState . endOffset ) ) {
0 commit comments