forked niri forked from okami.mom/niri

fix(runner): make end_session actually end the session #67

targeting main from deleted fork:fix/end-session-clears-session
Merged opened by and assigned to callie.on-her.computer
targeting main from deleted fork:fix/end-session-clears-session

the bug #

end_session returned "Session ended." but did nothing structurally different from wait. there are two persistence files:

  • session.json - the full conversation (written by saveRuntimeSnapshot)
  • .nano-rest-snapshot.json - a summary only

on wake, boot checks loadSession() (session.json) first and restores every message verbatim + a "harness restarted" note. only if it's absent does it fall through to the summary bootstrap.

end_session saved a rest snapshot but never deleted session.json - so the next event rehydrated the entire prior context. observable from the outside: the agent kept waking with full history right after 'ending'.

the fix #

call clearSession() in the handler before resting, deleting session.json. the next wake then bootstraps fresh from the rest-snapshot summary. verified the rest path (finally block) does not re-save the session, so the clear survives to the next wake. tsc clean.

one file changed.

Commits 0