huskies: merge 655_bug_matrix_bot_spawns_its_own_timerstore_instead_of_using_shared_appcontext_timer_store

This commit is contained in:
dave
2026-04-27 11:28:21 +00:00
parent ac85cfce5d
commit 65d2fb210c
4 changed files with 14 additions and 10 deletions
+5 -7
View File
@@ -629,14 +629,10 @@ async fn main() -> Result<(), std::io::Error> {
let matrix_shutdown_tx = Arc::new(matrix_shutdown_tx);
let matrix_shutdown_tx_for_rebuild = Arc::clone(&matrix_shutdown_tx);
// Bug 501: shared rate-limit retry timer store, accessible from MCP tools
// via AppContext so manual interventions (move_story → backlog, stop_agent)
// Shared rate-limit retry timer store, accessible from MCP tools via
// AppContext so manual interventions (move_story → backlog, stop_agent)
// can cancel pending timers in-memory rather than only on disk.
//
// TODO(bug 501): the matrix bot currently spawns its own TimerStore instance
// in `chat::transport::matrix::bot::run::spawn_bot`. Refactor to consume this
// shared instance via `AppContext.timer_store` so cancellations from MCP
// tools and the bot's tick loop see the same in-memory state.
// Also shared with the Matrix bot tick loop (bug 655).
let timer_store = std::sync::Arc::new(crate::service::timer::TimerStore::load(
startup_root
.as_ref()
@@ -645,6 +641,7 @@ async fn main() -> Result<(), std::io::Error> {
));
let timer_store_for_tick = Arc::clone(&timer_store);
let timer_store_for_bot = Arc::clone(&timer_store);
let ctx = AppContext {
state: app_state,
@@ -738,6 +735,7 @@ async fn main() -> Result<(), std::io::Error> {
None,
vec![],
std::collections::BTreeMap::new(),
timer_store_for_bot,
);
} else {
// Keep the receiver alive (drop it) so the sender never errors.