fix: skip oneshot memory prefetch - #50217
Conversation
83c3d74 to
b457b15
Compare
# Conflicts: # hermes_cli/oneshot.py # tests/hermes_cli/test_tui_resume_flow.py
|
Resolved the conflict by keeping the newer oneshot flow from So the intent stays the same: oneshot still syncs the completed turn, but it does not queue prefetch for a next turn that will never happen, and it now drains the memory shutdown path before the short-lived CLI process exits. I also kept the newer exit-code tests from Verified with: python -m pytest tests/run_agent/test_memory_sync_interrupted.py tests/hermes_cli/test_tui_resume_flow.py -q
# 71 passed in 1.34s |
|
quick recheck since main moved a bunch again tried this on current same focused tests still pass: scripts/run_tests.sh tests/run_agent/test_memory_sync_interrupted.py tests/hermes_cli/test_tui_resume_flow.py
# 71 passed, 0 failedsome upstream commits touch the same files, but not really the behavior this PR changes. I don't think this needs a rebase unless you'd rather have the branch fresh. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for targeting the short-lived oneshot memory lifecycle. The current-head premise is valid: run_agent.py:3421 always queues next-turn prefetch, and hermes_cli/main.py:14731-14744 exits through run_oneshot() rather than the normal CLI cleanup path.
Problems
hermes_cli/oneshot.py:376in this PR passesgetattr(agent, "messages", [])toshutdown_memory_provider(). CurrentAIAgentpersists its live transcript as_session_messagesinrun_agent.py:1693;shutdown_memory_provider()forwards the supplied list intoMemoryManager.on_session_end()atrun_agent.py:3325. Thus a normal agent takes the empty-list fallback and transcript-dependent end-of-session extraction loses its conversation input.
Suggested changes
- Use the
_session_messageslist when available, with the no-argument shutdown fallback used bycli.py:1134-1147. - Adjust the focused test double to expose
_session_messagesand assert that exact list reaches shutdown.
Automated hermes-sweeper review.
| return (result.get("final_response") or "", result) | ||
| try: | ||
| result = agent.run_conversation(prompt) | ||
| return (result.get("final_response") or "", result) |
There was a problem hiding this comment.
AIAgent does not retain its conversation on messages; _persist_session() stores it as _session_messages (run_agent.py:1693). Passing this fallback empty list reaches MemoryManager.on_session_end() and drops the transcript for providers that perform end-of-session extraction. Please mirror the _session_messages/no-argument fallback used by CLI cleanup.
small oneshot memory cleanup.
hermes -zwas still doing the normal chat thing where it syncs memory and then warms memory for the next turn.but with oneshot there is no next turn, the process is about to exit. so this keeps the sync, skips only that prefetch, and also shuts the memory provider down before the CLI exits.
main thing I was seeing here was Honcho/hybrid mode having background memory work still alive at process exit.
tested with:
scripts/run_tests.sh tests/run_agent/test_memory_sync_interrupted.py tests/hermes_cli/test_tui_resume_flow.py