mind: keep supervisor alive on Mind struct
The channel daemon supervisor was created in init() and immediately dropped. Keep it on Mind so it can restart crashed daemons. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
57b0f94b54
commit
d5a706147a
1 changed files with 7 additions and 6 deletions
|
|
@ -177,6 +177,7 @@ pub struct Mind {
|
||||||
turn_tx: mpsc::Sender<(Result<TurnResult>, StreamTarget)>,
|
turn_tx: mpsc::Sender<(Result<TurnResult>, StreamTarget)>,
|
||||||
turn_handle: Option<tokio::task::JoinHandle<()>>,
|
turn_handle: Option<tokio::task::JoinHandle<()>>,
|
||||||
turn_watch: tokio::sync::watch::Sender<bool>,
|
turn_watch: tokio::sync::watch::Sender<bool>,
|
||||||
|
_supervisor: crate::thalamus::supervisor::Supervisor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Mind {
|
impl Mind {
|
||||||
|
|
@ -206,7 +207,12 @@ impl Mind {
|
||||||
|
|
||||||
let shared = shared_mind_state(config.app.dmn.max_turns);
|
let shared = shared_mind_state(config.app.dmn.max_turns);
|
||||||
let (turn_watch, _) = tokio::sync::watch::channel(false);
|
let (turn_watch, _) = tokio::sync::watch::channel(false);
|
||||||
Self { agent, shared, config, ui_tx, turn_tx, turn_handle: None, turn_watch }
|
|
||||||
|
let mut sup = crate::thalamus::supervisor::Supervisor::new();
|
||||||
|
sup.load_config();
|
||||||
|
sup.ensure_running();
|
||||||
|
|
||||||
|
Self { agent, shared, config, ui_tx, turn_tx, turn_handle: None, turn_watch, _supervisor: sup }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize — restore log, start daemons and background agents.
|
/// Initialize — restore log, start daemons and background agents.
|
||||||
|
|
@ -216,11 +222,6 @@ impl Mind {
|
||||||
ag.restore_from_log();
|
ag.restore_from_log();
|
||||||
drop(ag);
|
drop(ag);
|
||||||
|
|
||||||
// Start channel daemons
|
|
||||||
let mut sup = crate::thalamus::supervisor::Supervisor::new();
|
|
||||||
sup.load_config();
|
|
||||||
sup.ensure_running();
|
|
||||||
|
|
||||||
// Start observation socket
|
// Start observation socket
|
||||||
if !self.config.no_agents {
|
if !self.config.no_agents {
|
||||||
let socket_path = self.config.session_dir.join("agent.sock");
|
let socket_path = self.config.session_dir.join("agent.sock");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue