multica/server/internal
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
..
auth merge: resolve conflicts with main 2026-03-31 16:25:20 +08:00
cli fix(comments): address code review feedback on pagination 2026-04-04 01:01:48 +08:00
daemon fix(daemon): update existing worktree to latest remote on reuse (#489) 2026-04-08 14:13:44 +08:00
events feat(realtime): WS invalidation + refetch pattern, inbox bugfixes, UI polish 2026-03-29 13:49:40 +08:00
handler Merge pull request #471 from multica-ai/agent/j/959392dd 2026-04-08 12:45:56 +08:00
logger feat(logging): add structured logging across server and SDK 2026-03-26 10:57:11 +08:00
mention feat(mentions): support @mentioning issues + server-side auto-expansion (#242) 2026-04-02 13:48:53 +08:00
middleware fix(auth): extend JWT and CloudFront cookie expiration from 72h to 30 days 2026-04-06 21:48:31 +08:00
realtime feat(realtime): route personal events to target user only 2026-03-29 17:42:50 +08:00
service refactor: remove agent triggers config field (#469) 2026-04-07 22:02:28 +08:00
storage fix(upload): clean up S3 objects when attachments are deleted 2026-03-31 16:34:47 +08:00
util feat(mentions): support @mentioning issues + server-side auto-expansion (#242) 2026-04-02 13:48:53 +08:00