Skip to content

The agent that grows with you

docs(cron): point the disarm comment at _teardown_cron_agent after the helper extraction

kshitijk4poorfa646582ae80
diff --git a/cron/scheduler.py b/cron/scheduler.py
index 4233710b651..c94562fe244 100644
--- a/cron/scheduler.py
+++ b/cron/scheduler.py
@@ -1979,13 +1979,12 @@ def _finalize_cron_session(session_db, agent, job_id: str, job_name: str, cron_s
logger.debug("Job '%s': session lifecycle classification failed: %s", job_id, e)
try:
_session_db.end_session(_final_cron_session_id, _end_reason)
- # run_job owns cron-session finalization. AIAgent.close() also
- # finalizes owned session rows by default; if we release the
- # shared SessionDB first and then call agent.close(), that second
- # end_session() reopens the just-closed SQLite handle (#94736).
- # Once the scheduler has durably booked this terminal reason,
- # disarm only the agent's redundant row-finalization step. Its
- # remaining resource teardown still runs normally below.
+ # The scheduler owns cron-session finalization. AIAgent.close() also
+ # finalizes owned session rows by default; once the shared SessionDB is
+ # released below, that second end_session() would reopen the just-closed
+ # SQLite handle (#94736). The reason is durably booked, so disarm only the
+ # agent's redundant row-finalization; its resource teardown still runs in
+ # _teardown_cron_agent.
if agent is not None:
agent._end_session_on_close = False
except (Exception, KeyboardInterrupt) as e: