multica/server
LinYushen 7df5750979
fix(daemon): update existing worktree to latest remote on reuse (#489)
* fix(daemon): update existing worktree to latest remote on reuse

When an agent receives a new task on the same issue, the execution
environment is reused and the repo worktree already exists on disk.
Previously, `multica repo checkout` would fail because `git worktree add`
cannot create a path that already exists — so the agent worked on stale
code from the prior task.

Now `CreateWorktree` detects existing worktrees and updates them:
fetch origin, reset working tree, then checkout a new branch from the
latest remote default branch. The previous task's branch is preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(daemon): propagate actual branch name and use correct ref in worktree reuse

- Return (string, error) from updateExistingWorktree so collision-retried
  branch name propagates to WorktreeResult
- Use baseRef directly instead of origin/baseRef — bare clone refspec maps
  remote branches to local refs, so remote-tracking refs may not exist
- Remove redundant fetch (worktree shares object store with bare clone)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 14:13:44 +08:00
..
cmd refactor: remove agent triggers config field (#469) 2026-04-07 22:02:28 +08:00
internal fix(daemon): update existing worktree to latest remote on reuse (#489) 2026-04-08 14:13:44 +08:00
migrations refactor: remove agent triggers config field (#469) 2026-04-07 22:02:28 +08:00
pkg Merge pull request #471 from multica-ai/agent/j/959392dd 2026-04-08 12:45:56 +08:00
go.mod fix(attachment): use UUIDv7 as S3 key and link attachments on issue/comment creation 2026-04-05 07:55:17 +08:00
go.sum fix(attachment): use UUIDv7 as S3 key and link attachments on issue/comment creation 2026-04-05 07:55:17 +08:00
sqlc.yaml feat: pivot to AI-native task management platform (#232) 2026-03-20 17:55:49 +08:00