Missing on_session_end hook — no cleanup on session end #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The plugin registers three hooks (
pre_llm_call,post_tool_call,on_session_start) but does not registeron_session_end.When a session ends (user closes chat, timeout, disconnect), the agenda state remains in Sibyl's
state_documentstable withstatus: "active". Next session start detects the stale state and logs "Active agenda detected on session start" but there's no way to distinguish a fresh continuation from stale garbage.Suggested fix
Add an
on_session_endhook that checks the agenda status. If the status is still "active" and the session ending is not a clean handoff (e.g. user disconnected), mark it asstatus: "paused"or clear it entirely.A safer approach: only clear if the agenda's
session_idmatches the ending session, to avoid stealing an agenda from a concurrent session.