From 720ebdac2f64ce18e1de68d070cd3fe46f44547c Mon Sep 17 00:00:00 2001 From: soryu Date: Tue, 17 Feb 2026 19:40:53 +0000 Subject: feat: soryu-co/soryu - makima: Fix PR creation to update base branch and prevent merge conflicts (#71) --- .../src/components/contracts/ContractList.tsx | 4 ++-- makima/frontend/src/routes/contracts.tsx | 2 +- makima/src/daemon/worktree/manager.rs | 26 ++++++++++++++++++++-- makima/src/orchestration/directive.rs | 1 + 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/makima/frontend/src/components/contracts/ContractList.tsx b/makima/frontend/src/components/contracts/ContractList.tsx index 98f8ff6..4388283 100644 --- a/makima/frontend/src/components/contracts/ContractList.tsx +++ b/makima/frontend/src/components/contracts/ContractList.tsx @@ -64,7 +64,7 @@ export function ContractList({ } return ( -
+
{/* Header */}
@@ -101,7 +101,7 @@ export function ContractList({
{/* Contract list */} -
+
{filteredContracts.length === 0 ? (

diff --git a/makima/frontend/src/routes/contracts.tsx b/makima/frontend/src/routes/contracts.tsx index 7046f66..b85d667 100644 --- a/makima/frontend/src/routes/contracts.tsx +++ b/makima/frontend/src/routes/contracts.tsx @@ -522,7 +522,7 @@ function ContractsPageContent() { ); return ( -

+
{/* Left: Contract list */} diff --git a/makima/src/daemon/worktree/manager.rs b/makima/src/daemon/worktree/manager.rs index 5df9a73..c27bcf6 100644 --- a/makima/src/daemon/worktree/manager.rs +++ b/makima/src/daemon/worktree/manager.rs @@ -484,7 +484,29 @@ impl WorktreeManager { "Creating worktree with new branch" ); - // Create the worktree with a new branch based on the local base_branch + // Prefer origin/{base_branch} to get latest remote state + let origin_ref = format!("origin/{}", base_branch); + let has_origin_ref = Command::new("git") + .args(["rev-parse", "--verify", &format!("refs/remotes/{}", origin_ref)]) + .current_dir(source_repo) + .output() + .await + .map(|o| o.status.success()) + .unwrap_or(false); + + let start_point = if has_origin_ref { + origin_ref.as_str() + } else { + base_branch + }; + + tracing::info!( + task_id = %task_id, + start_point = %start_point, + "Using start point for new worktree branch" + ); + + // Create the worktree with a new branch based on the start point let output = Command::new("git") .args([ "worktree", @@ -493,7 +515,7 @@ impl WorktreeManager { &branch_name, ]) .arg(&worktree_path) - .arg(base_branch) + .arg(start_point) .current_dir(source_repo) .output() .await?; diff --git a/makima/src/orchestration/directive.rs b/makima/src/orchestration/directive.rs index 21053f3..a6bb85b 100644 --- a/makima/src/orchestration/directive.rs +++ b/makima/src/orchestration/directive.rs @@ -1414,6 +1414,7 @@ Run these commands: git fetch origin git checkout {directive_branch} git pull origin {directive_branch} +git merge origin/{base_branch} --no-edit {merge_commands} git push origin {directive_branch} ``` -- cgit v1.2.3