Skip to content

fix(hindsight): avoid resending retained turns on append#40519

Closed
skylarbpayne wants to merge 1 commit into
NousResearch:mainfrom
skylarbpayne:fix/hindsight-incremental-auto-retain
Closed

fix(hindsight): avoid resending retained turns on append#40519
skylarbpayne wants to merge 1 commit into
NousResearch:mainfrom
skylarbpayne:fix/hindsight-incremental-auto-retain

Conversation

@skylarbpayne

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Hindsight auto-retain to send only newly buffered turns when the API supports update_mode="append".
  • Preserves the legacy full-session snapshot behavior for older Hindsight APIs that do not support append mode.
  • Adds regression coverage for both append and legacy paths.

Root cause

Hermes probes for Hindsight update_mode="append" support and then reuses the stable session document id. But sync_turn() still serialized and resent every turn accumulated in the process on every retain. On live Palmer, this produced giant repeated async retain payloads; the embedded daemon spent minutes splitting multi-million-token batches, stopped answering /health within the 2s daemon-manager timeout, and the next client startup misclassified the busy Hindsight listener on port 9712 as a "non-hindsight process".

Test Plan

  • PYTHONPATH=. pytest tests/plugins/memory/test_hindsight_provider.py::TestSyncTurn::test_sync_turn_appends_only_new_turns_when_append_supported tests/plugins/memory/test_hindsight_provider.py::TestSyncTurn::test_sync_turn_accumulates_full_session_without_append_support -q
  • PYTHONPATH=. pytest tests/plugins/memory/test_hindsight_provider.py -q
  • PYTHONPATH=. pytest tests/plugins/memory -q

Notes

This PR avoids the biggest runaway payload source. It does not mutate local Palmer Hindsight config or kill/restart daemons; that was explicitly out of scope without approval.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/memory Memory tool and memory providers comp/plugins Plugin system and bundled plugins labels Jun 6, 2026
@teknium1

teknium1 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Salvaged into #40605 with your authorship credited (Co-authored-by). Re-verified on current main, tightened, and tested. Thanks!

#40605

@teknium1 teknium1 closed this Jun 6, 2026
teknium1 added a commit that referenced this pull request Jun 8, 2026
… whole session (#40605)

Closes #40503.

Salvaged from #40519; re-verified on main, tightened, tested.

Co-authored-by: skylarbpayne <skylarbpayne@users.noreply.github.com>
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
… whole session (NousResearch#40605)

Closes NousResearch#40503.

Salvaged from NousResearch#40519; re-verified on main, tightened, tested.

Co-authored-by: skylarbpayne <skylarbpayne@users.noreply.github.com>
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 tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants