huskies: merge 591_story_gateway_chat_commands_use_active_project_root_instead_of_gateway_config_dir

This commit is contained in:
dave
2026-04-16 16:09:13 +00:00
parent e734e80da5
commit 4b710b02f2
2 changed files with 153 additions and 6 deletions
@@ -174,13 +174,18 @@ pub(super) async fn on_room_message(
let user_message = body;
slog!("[matrix-bot] Message from {sender}: {user_message}");
// In gateway mode, resolve commands against the active project's root directory.
// The gateway's own project_root is the gateway config dir; each project lives in
// a subdirectory named after the project. Standalone mode is unaffected.
let effective_root = ctx.effective_project_root().await;
// Check for bot-level commands (help, status, ambient, …) before invoking
// the LLM. All commands are registered in commands.rs — no special-casing
// needed here.
let dispatch = super::super::commands::CommandDispatch {
bot_name: &ctx.bot_name,
bot_user_id: ctx.bot_user_id.as_str(),
project_root: &ctx.project_root,
project_root: &effective_root,
agents: &ctx.agents,
ambient_rooms: &ctx.ambient_rooms,
room_id: &room_id_str,
@@ -219,7 +224,7 @@ pub(super) async fn on_room_message(
&ctx.bot_name,
&story_number,
&model,
&ctx.project_root,
&effective_root,
&ctx.agents,
)
.await
@@ -287,7 +292,7 @@ pub(super) async fn on_room_message(
super::super::delete::handle_delete(
&ctx.bot_name,
&story_number,
&ctx.project_root,
&effective_root,
&ctx.agents,
)
.await
@@ -321,7 +326,7 @@ pub(super) async fn on_room_message(
super::super::rmtree::handle_rmtree(
&ctx.bot_name,
&story_number,
&ctx.project_root,
&effective_root,
&ctx.agents,
)
.await
@@ -361,7 +366,7 @@ pub(super) async fn on_room_message(
&ctx.bot_name,
&story_number,
agent_hint.as_deref(),
&ctx.project_root,
&effective_root,
&ctx.agents,
)
.await
@@ -587,7 +592,12 @@ pub(super) async fn handle_message(
let sent_any_chunk = Arc::new(AtomicBool::new(false));
let sent_any_chunk_for_callback = Arc::clone(&sent_any_chunk);
let project_root_str = ctx.project_root.to_string_lossy().to_string();
// In gateway mode, run Claude Code in the active project's directory.
let project_root_str = ctx
.effective_project_root()
.await
.to_string_lossy()
.to_string();
let chat_fut = provider.chat_stream(
&prompt,
&project_root_str,