huskies: merge 774

This commit is contained in:
dave
2026-04-28 10:45:23 +00:00
parent 7faacb6664
commit 01169332b3
4 changed files with 199 additions and 237 deletions
+3 -32
View File
@@ -8,36 +8,9 @@ use crate::state::SessionState;
use crate::store::JsonFileStore;
use crate::workflow::WorkflowState;
use poem::http::StatusCode;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::{broadcast, mpsc, oneshot};
/// A running or completed test job spawned by the `run_tests` MCP tool.
pub struct TestJob {
/// The child process handle. `None` once the process has exited and results
/// have been collected.
pub child: Option<std::process::Child>,
/// Populated once the child exits.
pub result: Option<TestJobResult>,
/// When the job was started.
pub started_at: std::time::Instant,
}
/// The result of a completed test job.
#[derive(Clone)]
pub struct TestJobResult {
pub passed: bool,
pub exit_code: i32,
pub tests_passed: u64,
pub tests_failed: u64,
pub output: String,
}
/// Shared registry of in-flight and recently completed test jobs, keyed by
/// worktree path.
pub type TestJobRegistry = Arc<std::sync::Mutex<HashMap<PathBuf, TestJob>>>;
/// The user's decision when responding to a permission dialog.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PermissionDecision {
@@ -101,9 +74,6 @@ pub struct AppContext {
/// spawned by the bot so that cancellations take effect in-memory rather
/// than only on disk.
pub timer_store: Arc<TimerStore>,
/// Registry of running/completed test jobs spawned by the `run_tests` MCP
/// tool. Keyed by worktree path so each worktree has at most one active job.
pub test_jobs: TestJobRegistry,
}
#[cfg(test)]
@@ -127,7 +97,9 @@ impl AppContext {
bot_user_id: String::new(),
ambient_rooms: Arc::new(std::sync::Mutex::new(std::collections::HashSet::new())),
perm_rx: Arc::new(tokio::sync::Mutex::new(perm_rx)),
pending_perm_replies: Arc::new(tokio::sync::Mutex::new(HashMap::new())),
pending_perm_replies: Arc::new(tokio::sync::Mutex::new(
std::collections::HashMap::new(),
)),
permission_timeout_secs: 120,
status: agents.status_broadcaster(),
});
@@ -143,7 +115,6 @@ impl AppContext {
bot_shutdown: None,
matrix_shutdown_tx: None,
timer_store,
test_jobs: Arc::new(std::sync::Mutex::new(HashMap::new())),
}
}
}