Share a source index across each pipeline run

This commit is contained in:
2026-11-26 01:34:51 +00:00
parent 4b03a439cb
commit 6345727601
10 changed files with 127 additions and 13 deletions

View File

@@ -13,10 +13,13 @@ func artifactProducerCache(input RunInput, typed *preparedTypedLane, class contr
if input.Cache == nil || class != contracts.ExecutionClassLLMBacked {
return nil
}
sourceIndex := input.cacheSourceIndex
if sourceIndex == nil {
sourceIndex := func() *source.DocumentIndex { return input.sourceIndex }
if input.sourceIndex == nil {
// Standalone operation construction can also defer indexing until decode.
sourceIndex = sync.OnceValue(func() source.DocumentIndex { return source.NewDocumentIndex(doc) })
sourceIndex = sync.OnceValue(func() *source.DocumentIndex {
index := source.NewDocumentIndex(doc)
return &index
})
}
return &contracts.ProducerCache[any]{
Store: input.Cache,