onExtractionSuccess advances the watermark, resets the failure streak and invalidates the prompt cache so the next turn sees the new memory.
(historyLen int)
| 218 | // onExtractionSuccess advances the watermark, resets the failure streak and |
| 219 | // invalidates the prompt cache so the next turn sees the new memory. |
| 220 | func (mw *memoryWorker) onExtractionSuccess(historyLen int) { |
| 221 | mw.logger.Debug("Memory worker: annotations saved successfully") |
| 222 | mw.mu.Lock() |
| 223 | mw.lastProcessedIdx = historyLen |
| 224 | mw.failNoticeSent = false |
| 225 | mw.mu.Unlock() |
| 226 | mw.coord.recordSuccess() |
| 227 | if mw.cli.contextBuilder != nil { |
| 228 | mw.cli.contextBuilder.InvalidateCache() |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | // onExtractionFailure persists the segment to the on-disk queue (advancing the |
| 233 | // watermark — it is durably queued) and surfaces a one-line notice once the |