SessionRunner
The door host's runner: it starts sessions, holds their live drivers and records every event in the session store (trove-parts §TPN-4, §TPN-5, §TPN-6).
| Inherits | QObject |
| Group | libllmsession |
In the namespace octomy::llmsession. Declared in src/libs/libllmsession/llmsession/SessionRunner.hpp.
Detailed description
The session.* tasks call the runner. It does four things:
- start() makes the record, gives the session its folder and profile (§TPN-5), and gets a driver with the Session facet from the DriverManager. For
claude-codeit asks for StructuredUsage, which only the stream transport has. The driver refuses a missing program before the record exists. Below the version floor, the session exists and its first turn fails with a message that names both versions: the version read never holds the thread of the runner. - send() records the prompt and gives it to the driver. A message during a turn starts the next turn, in order (TPX-29). A session with no live driver, for example after a change of door host, gets a new driver that resumes the provider session (TPX-31).
- Each event of the driver goes into the store with its turn. The runner counts the turns, so that the store's turn numbers do not depend on the transport. A transport with no event stream of its own has its ISession signals mapped to events.
- The lease of §TPN-6: send(), interrupt() and close() need the caller's lease, or no live lease on the session.
adopt() takes a Claude Code session of a terminal into the store, and exportSession() hands a session back to a terminal (§TPN-7, through SessionAdoption).
One runner holds every live session
A Trove lane is a composition of the parts (trove-parts §TPA-4). Its session is a session of this runner: SessionManager gets the driver with the lane's own request, the transport, the node and the worktree, and host() runs it. So an external client follows a lane's session with `session.events`, and a lane's send, interrupt and stop are the same code as session.send and session.interrupt, under the lane's lease `lane:<X>`. stopProcess() ends the process and keeps the session, for a lane that ends its cycle. note() records a step of the cycle. processEnded() tells the lane when a process ends for another reason.
stop() is the handover: each process ends its current turns, closes standard input and exits, and stopped() follows. The runner then starts nothing.
The runner owns processes, so it works on its own thread. A call from another thread, for example an OPAL plan thread, blocks until the runner's thread has done it. The runner's thread must not wait for such a call.
See also octomy::llmsession::SessionStore, octomy::llmsession::StreamDriver, octomy::llmsession::SessionProfile.