Skip to content

Replace cumulative Hindsight transcript snapshots - #20664

Closed
discolotus wants to merge 1 commit into
NousResearch:mainfrom
discolotus:fix/hindsight-replace-cumulative-snapshots
Closed

Replace cumulative Hindsight transcript snapshots#20664
discolotus wants to merge 1 commit into
NousResearch:mainfrom
discolotus:fix/hindsight-replace-cumulative-snapshots

Conversation

@discolotus

@discolotus discolotus commented May 6, 2026

Copy link
Copy Markdown

Summary

  • switch modern Hindsight retain batches from update_mode=append on the session document to update_mode=replace on the per-process document
  • avoid repeatedly appending cumulative transcript snapshots, which duplicated earlier turns and grew documents indefinitely
  • keep legacy API behavior unchanged by omitting update_mode when unsupported

Rationale

Hermes builds each auto-retain payload from the full in-process session buffer. Appending those cumulative snapshots duplicates earlier turns on every retain. Replacing the per-process snapshot preserves the current process lifecycle transcript without risking a restart overwriting a prior process lifecycle.

Testing

  • /Users/tleo/.hermes/hermes-agent/venv/bin/python -m pytest tests/plugins/memory/test_hindsight_provider.py -q
  • /Users/tleo/.hermes/hermes-agent/venv/bin/python -m py_compile plugins/memory/hindsight/__init__.py run_agent.py gateway/run.py tests/plugins/memory/test_hindsight_provider.py

@teknium1

Copy link
Copy Markdown
Contributor

This looks implemented on current main by a later Hindsight fix. Automated hermes-sweeper review.

Evidence:

  • plugins/memory/hindsight/__init__.py:1473 now sends only turns accumulated since _last_retained_turn_count when the API supports update_mode='append', instead of re-sending the cumulative transcript snapshot on every retain.
  • plugins/memory/hindsight/__init__.py:1533 advances that append watermark after queueing the retain, so later retains do not re-ship turns already handed to the writer.
  • tests/plugins/memory/test_hindsight_provider.py:805 covers the regression: the second append retain excludes the earlier turns and includes only the new turn batch.
  • The fix landed in 09d66037f8f7bc5bd879ed8128273fb6780a009f (fix(hindsight): send only new-turn delta on append retains instead of whole session (#40605)).

Main uses a different implementation than this PR proposed: it keeps the stable session-scoped append document and sends deltas, rather than switching modern APIs to per-process replace. That still resolves the reported duplication/unbounded-growth behavior.

@teknium1 teknium1 closed this Jun 11, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants