fix(cron): finalize compressed session tips (#67188) - #67221
Closed
webtecnica wants to merge 1 commit into
Closed
Conversation
Resolve a cron run's live compression tip before final title/completion and use that resolved session consistently across success, exception, and inactivity-timeout finalization paths. Preserve the existing first-reason-wins completion contract and title de-duplication. Previously the cron finalization block always used the original _cron_session_id captured before AIAgent started. When compression rotated the live agent onto a continuation session during the run, title/end_session targeted the stale original instead of the active continuation, losing the compressed session's data and violating the first-reason-wins contract. Now the finally block queries SessionDB.get_compression_tip() to resolve the live tip and falls back to agent.session_id on lookup failure. Added concurrent end_session audit test proving one transition wins, and parametrized coverage for compression-tip resolution, title de-duplication, and timeout paths. Closes NousResearch#67188
Collaborator
Duplicate of #67188: the production cron finalization diff is byte-equivalent. |
Contributor
|
Thanks for adapting the cron finalization fix to current main. The premise is verified: Problems
Suggested changes
Automated hermes-sweeper review. |
Contributor
|
Closing as a duplicate of #67188, which @colingreig opened ~100 minutes earlier — the two diffs are byte-identical (same sha256), so there is no salvageable delta here. #67188 is the vehicle moving forward. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Context
This adapts the still-valid preventive portion of Colin Greig's earlier carried cron fix (
4ba5f6077b90e3b67814b8e50b31a8145178ba7c) to current upstream rather than cherry-picking the old patch.The historical age/identifier-regex stale-session reconciler from that patch is intentionally not included: age and identifier shape do not prove that a long-running job is orphaned. The follow-up commit
71d8352ee4aaf6007c7ba8376496f0bbdef864a5is also retired because it only repaired that omitted reconciler.Previously the cron finalization block always used the original
_cron_session_idcaptured before AIAgent started. When compression rotated the live agent onto a continuation session during the run, title/end_session targeted the stale original instead of the active continuation, losing the compressed session's data and violating the first-reason-wins contract.Now the
finallyblock queriesSessionDB.get_compression_tip()to resolve the live tip and falls back toagent.session_idon lookup failure.Changes
cron/scheduler.py_final_cron_session_idin all pathstests/cron/test_scheduler.pytests/test_hermes_state.pyValidation
28 passedintests/cron/test_scheduler.py(TestRunJobSessionPersistence)1 passedintests/test_hermes_state.py(concurrent end_session test)ruff checkpassed on all 3 modified filesCloses #67188