fix(goals): keep gateway goals alive across streaming and compression - #49743
MohamedRed wants to merge 2 commits into
Conversation
Copy active or paused /goal state when context compression rotates the physical session id, so the continuation session keeps the standing goal. Guard against overwriting an existing destination goal and add regression coverage for migration no-op cases.
|
Duplicate of #29955 — same mechanism (a conservative Note: the original fix #23530 was merged then reverted by #23813, so this bug is genuinely still live on |
Streamed gateway turns return None after final delivery to avoid duplicate sends. Run the post-turn goal continuation hook before that return so standing goals are judged and continuations are enqueued for streamed Telegram sessions.
|
Thanks for this — the diagnosis and fix are correct for the rotation path. Context on why we're closing it: as of #52658 (#38763), Rotation now only runs as an explicit opt-out ( |
Summary
migrate_goal(old_session_id, new_session_id)helper for active/paused/goalstate0/N turnsFixes #33618. Related to #48956, #45059, and #18467.
Test plan
PYTHONPATH=. /opt/homebrew/bin/pytest tests/hermes_cli/test_goals.py::TestGoalManager::test_migrate_goal_preserves_unfinished_goal_after_compression_split tests/hermes_cli/test_goals.py::TestGoalManager::test_migrate_goal_noops_for_terminal_or_existing_destination -q -o 'addopts='PYTHONPATH=. /opt/homebrew/bin/pytest tests/hermes_cli/test_goals.py -q -o 'addopts='PYTHONPATH=. /opt/homebrew/bin/pytest tests/run_agent/test_compression_persistence.py tests/run_agent/test_compression_boundary.py tests/gateway/test_compression_session_id_persistence.py -q -o 'addopts='PYTHONPATH=. python -m py_compile gateway/run.pyPYTHONPATH=. /opt/homebrew/bin/pytest tests/hermes_cli/test_goals.py tests/gateway/test_goal_verdict_send.py tests/gateway/test_goal_max_turns_config.py -q -o 'addopts='(async gateway tests skipped locally because pytest-asyncio is not installed)