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

@@ -532,6 +532,8 @@ pub async fn open_project(
let _ = worktree_write_mcp_json(&p, port);
{
// TRACE:MERGE-DEBUG — remove once root cause is found
crate::slog!("[MERGE-DEBUG] open_project: setting project_root to {:?}", p);
let mut root = state.project_root.lock().map_err(|e| e.to_string())?;
*root = Some(p);
}
@@ -551,6 +553,8 @@ pub async fn open_project(
pub fn close_project(state: &SessionState, store: &dyn StoreOps) -> Result<(), String> {
{
// TRACE:MERGE-DEBUG — remove once root cause is found
crate::slog!("[MERGE-DEBUG] close_project: setting project_root to None");
let mut root = state.project_root.lock().map_err(|e| e.to_string())?;
*root = None;
}
@@ -579,6 +583,12 @@ pub fn get_current_project(
{
let p = PathBuf::from(path_str);
if p.exists() && p.is_dir() {
// TRACE:MERGE-DEBUG — remove once root cause is found
crate::slog!(
"[MERGE-DEBUG] get_current_project: project_root was None, \
restoring from store to {:?}",
p
);
let mut root = state.project_root.lock().map_err(|e| e.to_string())?;
*root = Some(p);
return Ok(Some(path_str.to_string()));