huskies: merge 910
This commit is contained in:
@@ -199,6 +199,48 @@ impl AgentPool {
|
||||
.and_then(|a| a.status_buffer.as_ref().map(|b| b.drain()))
|
||||
}
|
||||
|
||||
/// Test helper: inject an agent with a project root AND a worktree path.
|
||||
///
|
||||
/// Use this when the full server-owned completion path needs both a
|
||||
/// `project_root` (so `run_pipeline_advance` can load config and advance
|
||||
/// the story) and a `worktree_info` (so gate checks can inspect the branch).
|
||||
pub fn inject_test_agent_with_root_and_path(
|
||||
&self,
|
||||
story_id: &str,
|
||||
agent_name: &str,
|
||||
status: AgentStatus,
|
||||
project_root: PathBuf,
|
||||
worktree_path: PathBuf,
|
||||
) -> broadcast::Sender<AgentEvent> {
|
||||
let (tx, _) = broadcast::channel::<AgentEvent>(64);
|
||||
let key = composite_key(story_id, agent_name);
|
||||
let mut agents = self.agents.lock().unwrap();
|
||||
agents.insert(
|
||||
key,
|
||||
StoryAgent {
|
||||
agent_name: agent_name.to_string(),
|
||||
status,
|
||||
worktree_info: Some(WorktreeInfo {
|
||||
path: worktree_path,
|
||||
branch: format!("feature/story-{story_id}"),
|
||||
base_branch: "master".to_string(),
|
||||
}),
|
||||
session_id: None,
|
||||
tx: tx.clone(),
|
||||
task_handle: None,
|
||||
event_log: Arc::new(Mutex::new(Vec::new())),
|
||||
completion: None,
|
||||
project_root: Some(project_root),
|
||||
log_session_id: None,
|
||||
merge_failure_reported: false,
|
||||
throttled: false,
|
||||
termination_reason: None,
|
||||
status_buffer: None,
|
||||
},
|
||||
);
|
||||
tx
|
||||
}
|
||||
|
||||
/// Inject a Running agent with a pre-built (possibly finished) task handle.
|
||||
/// Used by watchdog tests to simulate an orphaned agent.
|
||||
pub fn inject_test_agent_with_handle(
|
||||
|
||||
Reference in New Issue
Block a user