huskies: merge 855

This commit is contained in:
dave
2026-04-29 21:35:55 +00:00
parent a7b1572693
commit 4d24b5b661
17 changed files with 204 additions and 973 deletions
+43
View File
@@ -45,6 +45,48 @@ impl AgentPool {
agent_name: Option<&str>,
resume_context: Option<&str>,
session_id_to_resume: Option<String>,
) -> Result<AgentInfo, String> {
self.start_agent_inner(
project_root,
story_id,
agent_name,
resume_context,
session_id_to_resume,
None,
)
}
/// Start an agent with an `AppContext` for direct MCP tool dispatch.
///
/// API-based runtimes (Gemini, OpenAI) need the `AppContext` to invoke MCP
/// tools without an HTTP round-trip. CLI-based runtimes (Claude Code) do not.
pub fn start_agent_with_ctx(
&self,
project_root: &Path,
story_id: &str,
agent_name: Option<&str>,
resume_context: Option<&str>,
session_id_to_resume: Option<String>,
app_ctx: Arc<crate::http::context::AppContext>,
) -> Result<AgentInfo, String> {
self.start_agent_inner(
project_root,
story_id,
agent_name,
resume_context,
session_id_to_resume,
Some(app_ctx),
)
}
fn start_agent_inner(
&self,
project_root: &Path,
story_id: &str,
agent_name: Option<&str>,
resume_context: Option<&str>,
session_id_to_resume: Option<String>,
app_ctx: Option<Arc<crate::http::context::AppContext>>,
) -> Result<AgentInfo, String> {
let config = ProjectConfig::load(project_root)?;
@@ -352,6 +394,7 @@ impl AgentPool {
self.watcher_tx.clone(),
inactivity_timeout_secs,
prior_events,
app_ctx,
));
// Store the task handle while the agent is still Pending.
+5 -3
View File
@@ -13,6 +13,7 @@ use tokio::sync::broadcast;
use crate::agent_log::AgentLogWriter;
use crate::config::ProjectConfig;
use crate::http::context::AppContext;
use crate::io::watcher::WatcherEvent;
use crate::slog_error;
@@ -51,6 +52,7 @@ pub(super) async fn run_agent_spawn(
// happened while it was idle (story 736). `None` when there were no
// buffered events.
buffered_events_block: Option<String>,
app_ctx: Option<Arc<AppContext>>,
) {
// Re-bind to the legacy `_clone` / `_owned` names so the body below remains
// a verbatim copy of the original closure (story 157).
@@ -240,7 +242,7 @@ pub(super) async fn run_agent_spawn(
prompt: effective_prompt,
cwd: wt_path_str,
inactivity_timeout_secs,
mcp_port: port_for_task,
app_ctx: app_ctx.clone(),
session_id_to_resume: session_id_to_resume_owned.clone(),
fresh_prompt: fresh_prompt.clone(),
};
@@ -258,7 +260,7 @@ pub(super) async fn run_agent_spawn(
prompt: effective_prompt,
cwd: wt_path_str,
inactivity_timeout_secs,
mcp_port: port_for_task,
app_ctx: app_ctx.clone(),
session_id_to_resume: session_id_to_resume_owned.clone(),
fresh_prompt: fresh_prompt.clone(),
};
@@ -276,7 +278,7 @@ pub(super) async fn run_agent_spawn(
prompt: effective_prompt,
cwd: wt_path_str,
inactivity_timeout_secs,
mcp_port: port_for_task,
app_ctx: app_ctx.clone(),
session_id_to_resume: session_id_to_resume_owned,
fresh_prompt,
};