fix shutdown hang and slow startup

Mind::run() breaks when input_rx channel closes (UI shut down).
Previously the DMN timer kept the loop alive forever.

UI renders immediately without blocking on agent lock. Conversation
replay happens lazily on the render tick via try_lock — the UI
shows "consciousness v0.3" instantly, fills in model info and
conversation history once Mind init completes.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2026-04-05 16:18:10 -04:00
parent 71351574be
commit 2b9aba0e5d
2 changed files with 26 additions and 15 deletions

View file

@ -361,8 +361,11 @@ impl Mind {
tokio::select! {
biased;
Some(cmd) = input_rx.recv() => {
cmds.push(cmd);
cmd = input_rx.recv() => {
match cmd {
Some(cmd) => cmds.push(cmd),
None => break, // UI shut down
}
}
Some(bg) = bg_rx.recv() => {