storkit: merge 366_story_bot_sends_shutdown_message_on_server_stop_or_rebuild
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::agents::{AgentPool, ReconciliationEvent};
|
||||
use crate::io::watcher::WatcherEvent;
|
||||
use crate::rebuild::{BotShutdownNotifier, ShutdownReason};
|
||||
use crate::state::SessionState;
|
||||
use crate::store::JsonFileStore;
|
||||
use crate::workflow::WorkflowState;
|
||||
@@ -52,6 +53,20 @@ pub struct AppContext {
|
||||
/// Child process of the QA app launched for manual testing.
|
||||
/// Only one instance runs at a time.
|
||||
pub qa_app_process: Arc<std::sync::Mutex<Option<std::process::Child>>>,
|
||||
/// Best-effort shutdown notifier for active bot channels (Slack / WhatsApp).
|
||||
///
|
||||
/// When set, the MCP `rebuild_and_restart` tool uses this to announce the
|
||||
/// shutdown to configured channels before re-execing the server binary.
|
||||
/// `None` when no webhook-based bot transport is configured.
|
||||
pub bot_shutdown: Option<Arc<BotShutdownNotifier>>,
|
||||
/// Watch sender used to signal the Matrix bot task that the server is
|
||||
/// shutting down (rebuild path). The bot task listens for this signal and
|
||||
/// sends a shutdown announcement to all configured rooms.
|
||||
///
|
||||
/// Wrapped in `Arc` so `AppContext` can implement `Clone`.
|
||||
/// `None` when no Matrix bot is configured.
|
||||
pub matrix_shutdown_tx:
|
||||
Option<Arc<tokio::sync::watch::Sender<Option<ShutdownReason>>>>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -73,6 +88,8 @@ impl AppContext {
|
||||
perm_tx,
|
||||
perm_rx: Arc::new(tokio::sync::Mutex::new(perm_rx)),
|
||||
qa_app_process: Arc::new(std::sync::Mutex::new(None)),
|
||||
bot_shutdown: None,
|
||||
matrix_shutdown_tx: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user