chore: add MERGE-DEBUG traces for project_root lifecycle

Temporary diagnostic logging to track why project_root becomes None
during merge pipeline operations. Tagged with MERGE-DEBUG for easy
grep-and-remove once the root cause is confirmed fixed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-26 17:01:38 +00:00
parent b34335daad
commit ac087f1a58
5 changed files with 36 additions and 3 deletions

View File

@@ -1580,7 +1580,17 @@ async fn tool_merge_agent_work(args: &Value, ctx: &AppContext) -> Result<String,
.ok_or("Missing required argument: story_id")?;
let agent_name = args.get("agent_name").and_then(|v| v.as_str());
// TRACE:MERGE-DEBUG — remove once root cause is found
crate::slog!(
"[MERGE-DEBUG] tool_merge_agent_work called for story_id={:?}, agent_name={:?}",
story_id,
agent_name
);
let project_root = ctx.agents.get_project_root(&ctx.state)?;
crate::slog!(
"[MERGE-DEBUG] tool_merge_agent_work: project_root resolved to {:?}",
project_root
);
let report = ctx.agents.merge_agent_work(&project_root, story_id).await?;
let status_msg = if report.success && report.gates_passed && report.conflicts_resolved {

View File

@@ -49,6 +49,11 @@ impl ProjectApi {
/// Close the current project and clear the stored selection.
#[oai(path = "/project", method = "delete")]
async fn close_project(&self) -> OpenApiResult<Json<bool>> {
// TRACE:MERGE-DEBUG — remove once root cause is found
crate::slog_error!(
"[MERGE-DEBUG] DELETE /project called! \
Backtrace: this is the only code path that clears project_root."
);
fs::close_project(&self.ctx.state, self.ctx.store.as_ref()).map_err(bad_request)?;
Ok(Json(true))
}