fix(memory): filter Hindsight auto-retain noise - #27472
Conversation
|
Competing PRs for the same root issue (#23724 — Hindsight resends full transcript on append-mode retain):
This PR is the most comprehensive approach (delta buffering + noise filtering + audit logging). If this merges, the others should be closed. |
|
I ran into a crash-recovery variant that seems directly relevant to this PR and to #20664. Metadata-only incident shape:
This PR's move from cumulative transcript snapshots to turn deltas looks like the right fix direction for the Hermes side. One thing worth explicitly covering in tests/review: does the delta buffer/fingerprint behavior also handle restored/replayed session state after crash recovery, not only normal in-process turn progression? Suggested additional acceptance check:
I avoided posting raw transcript payloads for privacy; local evidence is metadata-only (operation counts, payload sizes, error class, stack shape). |
|
Thanks, good catch — I added explicit coverage for this in ef41fba21. What changed:
Local verification:
|
ef41fba to
70bb0f4
Compare
70bb0f4 to
ba738c8
Compare
|
Rebased on current Local verification:
CI has been retriggered on |
ba738c8 to
fd57f02
Compare
|
Thanks for the comprehensive Hindsight cleanup. I verified that the original delta-retain bug is now fixed on current main, but several extras in this PR are still unique and potentially salvageable. Problems
Suggested changes
Automated hermes-sweeper review. |
fd57f02 to
3073834
Compare
3073834 to
5c44fc0
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for narrowing this to the filtering work after the append-delta path landed in 09d66037f8f7bc5bd879ed8128273fb6780a009f.
Problems
plugins/memory/hindsight/__init__.py:1726rejects the whole joined recall payload when any result matches a noise regex. Current main joins allresp.resultsatplugins/memory/hindsight/__init__.py:1519; a single noisy historical result can therefore suppress unrelated valid recall. Filter individual results before joining them.- The new settings loaded at
plugins/memory/hindsight/__init__.py:1290are absent fromget_config_schema()(:970-1010) and the Hindsight config documentation (plugins/memory/hindsight/README.md:67-100). The optional YAML/config surface needs a documented configuration contract.
Suggested changes
- Add a mixed-result recall regression test and retain the valid result when another result matches a skip pattern.
- Document the YAML path/settings and add coverage for the current
SUMMARY_PREFIXand end-marker format fromagent/context_compressor.py:44-65,133-136.
Automated hermes-sweeper review.
5c44fc0 to
2adc417
Compare
2adc417 to
0dad72f
Compare
|
Rebased cleanly onto current This refresh keeps the still-unique auto-retain/recall noise filtering work (strip/skip/preserve patterns, per-result recall filtering, size-only audit log). The older delta-retain core is already present on main and remains untouched here. Local verification: python -m pytest -q -o 'addopts=' tests/plugins/memory/test_hindsight_provider.py
# 121 passed |
Related to merged #40605: the original append/delta-retain defect is already fixed; this PR now addresses distinct Hindsight auto-retain and recall-noise filtering. |
|
Independent post-rebase audit found and fixed two recall-filter edge cases in
The filter now strips only standalone artifact lines when enabled and remains a true no-op when disabled. Verification after the fixes:
|
95d1e7e to
7caf572
Compare
|
Rebuilt the branch on current The refreshed PR now contains only the unique low-noise layer. In particular, background recall filtering is evaluated per result and standalone artifact lines are removed without dropping neighboring useful content. The joined recall aggregate is no longer vetoed by
Immutable verification: 67 provider/filter/schema tests passed; Ruff, |
|
CI exposed an outdated desktop-schema contract test: it still assumed Hindsight had exactly five fields and no Full config surface. Updated the contract intentionally:
Local immutable verification on the new head: 71 Hindsight provider/filter/schema tests passed. CI has been restarted by the push. |
7caf572 to
a9d5ba2
Compare
a9d5ba2 to
51f698c
Compare
Summary
Keeps automatic Hindsight memory/context low-noise without changing explicit memory-tool behavior.
Current
mainalready contains the retain-delta/replay lifecycle core, so the refreshed PR carries only the remaining filtering and observability layer:hindsight_retainandhindsight_recallcalls unchanged.auto_retain_filter_enabled: falsea true no-op: no YAML loading, rewriting, query/result suppression, truncation, or audit logging.Verification
Immutable current-main archive:
py_compile, andgit diff --check: passedRelated: #18774.
Fixes #18818.