loopd: a turn's speaker in the log, its number in SessionUpdated

Co-Authored-By: ornith-1.5-35b-a3b <agent@wntrmute.dev>
This commit is contained in:
2026-09-28 10:33:36 -07:00
co-authored by ornith-1.5-35b-a3b
parent c798714af1
commit 4866353ac9
10 changed files with 362 additions and 26 deletions
+20 -13
View File
@@ -178,25 +178,32 @@ pub fn handle(stream: UnixStream, ctx: Arc<Context>) {
}
};
let outcome = run_turn(&mut session, &runtime, &turn.content, &mut |event| {
let _ = write_frame(
&mut stream,
&Envelope {
v: PROTOCOL_VERSION,
id: request.id,
r#final: false,
msg: Message::TurnEvent(event.clone()),
},
);
});
let outcome = run_turn(
&mut session,
&runtime,
&turn.content,
turn.speaker.as_deref(),
&mut |event| {
let _ = write_frame(
&mut stream,
&Envelope {
v: PROTOCOL_VERSION,
id: request.id,
r#final: false,
msg: Message::TurnEvent(event.clone()),
},
);
},
);
// 5. Release the session before the final frame, so the next turn does not find it busy.
drop(held);
// A finished turn's records are for `memoryd` to index; best effort, since `memoryd` catches
// up at its next start.
// up at its next start. The number is this turn's: its `User` record is the last one counted.
// A failed turn is not told, as before, though its logged message still counts.
if outcome.is_ok()
&& let Err(e) = ctx.memory.updated(&turn.session)
&& let Err(e) = ctx.memory.updated(&turn.session, session.turns())
{
eprintln!(
"loopd: memoryd was not told about {}: {e}",