huskies: merge 650_bug_watchdog_turns_used_and_budget_used_usd_accumulate_across_all_sessions_restart_counts_against_limits_from_prior_runs
This commit is contained in:
@@ -112,6 +112,39 @@ impl AgentPool {
|
||||
tx
|
||||
}
|
||||
|
||||
/// Test helper: inject an agent with a specific log session ID.
|
||||
/// Used by watchdog tests to simulate per-session counting.
|
||||
pub fn inject_test_agent_with_session(
|
||||
&self,
|
||||
story_id: &str,
|
||||
agent_name: &str,
|
||||
status: AgentStatus,
|
||||
log_session_id: &str,
|
||||
) -> 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: None,
|
||||
session_id: None,
|
||||
tx: tx.clone(),
|
||||
task_handle: None,
|
||||
event_log: Arc::new(Mutex::new(Vec::new())),
|
||||
completion: None,
|
||||
project_root: None,
|
||||
log_session_id: Some(log_session_id.to_string()),
|
||||
merge_failure_reported: false,
|
||||
throttled: false,
|
||||
termination_reason: 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