fix(hindsight): acknowledge append retains after success - #64599
Conversation
|
CI is green except for This PR only changes the Hindsight provider and its session-switch/provider tests. The failing delegation test passes locally on both this PR head and the current |
|
Thanks for the focused acknowledgement fix. The current PR base still advances the append watermark at queue time ( The new prefix state acknowledges only after Automated hermes-sweeper review. |
SummaryThe 26 listed PRs address or reference a memory-lifecycle complex spanning stale flush-agent writes, provider shutdown reachability, Hindsight final-batch loss, and append-write acknowledgement. The direct provider fixes add session-end flushing for buffered Hindsight turns, while #64599 independently prevents failed queued append writes from being acknowledged and discarded prematurely. Related pull requests
Duplicates#2675 and #2676 were superseded by #2687; #3045 by #3297; #12917 by #16207; #15481 by #16571; and #31856 by #57378. #16697, #28845, #36219, #36988, #55046, and #55936 are competing Hindsight session-end flushes, with #55046 the recorded best existing fix and the others duplicate or partial variants. Suggested consolidationKeep #64599 open with the salvage path validated by its keep_open review: preserve acknowledgement-after-success, failed-prefix retry, FIFO target resolution, old-session isolation, and the supplied regression coverage. Separately keep #55046 open as the recorded best session-end-flush track; close #28845, #36219, and #55936 as duplicate/partial variants of #55046 only with the review deviations above recorded, while #8331 and #29857 remain separate author-action tracks for their contributor-reviewed fixes. Cross-PR triage: Reviewed 26 pull requests and 6 issues in this complex. Each diff was read against this issue; Assessment working set: 372 kB of PR diffs, 95 kB of issue/PR text, 29 kB of discussion (43 comments), 35 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
What does this PR do?
Hindsight append-mode retains currently advance the turn watermark as soon as a background write is queued. If that write fails, the writer logs the exception and drops the job, while the advanced watermark prevents the failed turns from being included in the next retain. That silently loses conversation turns from Hindsight.
This PR gives append retains acknowledgement-on-success semantics:
aretain_batchsucceeds;sync_turn()remains non-blocking, successful append retains still bound the buffer, and overwrite/legacy retention behavior is unchanged.Related Issue
Related to #62977.
That PR identifies the unbounded append buffer, but its enqueue-time clear still makes queued turns unrecoverable when the background Hindsight write fails. This PR addresses the missing delivery/acknowledgement semantics while preserving the bounded-memory goal.
Type of Change
Changes Made
plugins/memory/hindsight/__init__.py.aretain_batchcall.How to Test
Run the Hindsight provider and session-switch suites:
Result: 137 passed.
Run the append acknowledgement regressions directly:
python -m pytest tests/plugins/memory/test_hindsight_provider.py \ -q -k 'TestAppendRetainAcknowledgements'Result: 9 passed. The delivery-failure, concurrent shutdown, and reinitialization regressions were observed failing against the corresponding pre-fix behavior before their implementations were added.
Attempt the repository test suite:
The run was interrupted by the host's
/tmptmpfs user quota (OSError: [Errno 122] Disk quota exceeded) after the relevant Hindsight files had passed. Re-running the affected files withTMPDIRon the root filesystem eliminated most failures; the remaining unrelated files either hardcode/tmp/hermes_testor depend on the runner's original temp environment. The focused Hindsight/session-switch suite above is green; CI remains the authoritative repository-wide gate.Run static and compatibility checks:
Result: all checks passed. Scoped
tyreports the same existing diagnostic categories and counts as cleanmain; this change introduces no new type diagnostics.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — N/A; no user-facing configuration or API changedcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Not applicable; this is a background memory-provider correctness fix with deterministic regression tests.