mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
fix(cron): mark session as ended after job completes (#2998)
Cron was the only execution path that never called end_session(), leaving ended_at = NULL permanently. This made cron sessions invisible to hermes prune --older-than and indistinguishable from active sessions. Captures session_id in a local variable before agent construction so it's available in the finally block even if AIAgent() fails, then calls end_session(session_id, 'cron_complete') before close(). Cherry-picked from PR #2979 by ygd58. Fixed bug: original PR called end_session() with zero arguments (TypeError — method requires session_id and end_reason). Fixes #2972. Co-authored-by: ygd58 <ygd58@users.noreply.github.com>
This commit is contained in:
parent
61949f0af7
commit
650b400c98
2 changed files with 10 additions and 1 deletions
|
|
@ -254,6 +254,10 @@ class TestRunJobSessionPersistence:
|
|||
assert kwargs["session_db"] is fake_db
|
||||
assert kwargs["platform"] == "cron"
|
||||
assert kwargs["session_id"].startswith("cron_test-job_")
|
||||
fake_db.end_session.assert_called_once()
|
||||
call_args = fake_db.end_session.call_args
|
||||
assert call_args[0][0].startswith("cron_test-job_")
|
||||
assert call_args[0][1] == "cron_complete"
|
||||
fake_db.close.assert_called_once()
|
||||
|
||||
def test_run_job_empty_response_returns_empty_not_placeholder(self, tmp_path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue