fix(honcho): serialize concurrent message flushes - #86094
Conversation
|
Current head Validation on this exact head:
The fork workflows are currently |
fix(honcho): serialize concurrent message flushes
|
|
Addressed all four points on current head 02b8f92:
Validation: 161 focused Honcho session/async/auth tests passed; focused Ruff, attribution audit, both diff checks, and all three upstream-range SSH signature checks passed. @teknium1 @alt-glitch please re-review the current head. Actions on exact head 02b8f92 are awaiting write-access approval; please approve the workflow runs. |
What does this PR do?
Serializes Honcho message flushes at the session-manager boundary. Without serialization, two concurrent flush paths can select the same unsynced messages before either path marks them synced, causing duplicate uploads.
The lock covers message selection, upload, synced-state updates, and the cache write. This PR intentionally changes no write-frequency, shutdown, configuration, or migration behavior.
Related Issue
Supersedes #72708. Its earlier broader scope is already implemented on
main; this PR resubmits only the remaining concurrent-flush defect.Type of Change
Changes Made
HonchoSessionManager._flush_session().How to Test
scripts/run_tests.sh tests/honcho_plugin/test_async_memory.py -k concurrent_flushes_do_not_duplicate_messages -q.scripts/run_tests.sh tests/honcho_plugin -q.ruff check plugins/memory/honcho/session.py tests/honcho_plugin/test_async_memory.py.The focused regression fails on unmodified
mainat the second concurrent upload and passes with this patch. The Honcho plugin suite passes 333 tests.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
N/A — covered by the deterministic concurrency regression test.