From 0e1751b4b57d1275dd00ee0be4d9472b9264e64b Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 1 Apr 2026 13:25:14 -0400 Subject: [PATCH] Use INSERT OR REPLACE for archived worktree records The archived_git_worktrees table has a unique index on worktree_path. A plain INSERT would fail if the same path was archived again. Using INSERT OR REPLACE ensures the old record is replaced with the new archive state. --- crates/agent_ui/src/thread_metadata_store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/agent_ui/src/thread_metadata_store.rs b/crates/agent_ui/src/thread_metadata_store.rs index 1ba41cceb04cf9f6bd304ba49b7f87cd4153eab6..dfa60fa2551191ac022ea0394e03c08524546cb0 100644 --- a/crates/agent_ui/src/thread_metadata_store.rs +++ b/crates/agent_ui/src/thread_metadata_store.rs @@ -710,7 +710,7 @@ impl ThreadMetadataDb { self.write(move |conn| { let mut stmt = Statement::prepare( conn, - "INSERT INTO archived_git_worktrees(\ + "INSERT OR REPLACE INTO archived_git_worktrees(\ worktree_path, main_repo_path, branch_name, commit_hash\ ) VALUES (?, ?, ?, ?)", )?;