AI Agents SDE Task Viewer
      • Pr description
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-276
  5. changes
  6. pr_description.md
pr_description.md(977 B)· Apr 3, 2026· 1 min read
  • Problem
  • Task / Link
  • Changes
  • Notes
  • Testing

fix(#276): remove reset --hard from worktree reuse path

Problem#

WorktreeService.createWorktree() called git reset --hard origin/master in the worktree reuse path, silently destroying any agent commits already on the branch from prior phases (e.g., execute → address_review).

Task / Link#

Closes #276

Changes#

  • Remove git reset --hard origin/master from the worktreeReused code path
  • Keep git fetch origin to update remote refs while preserving the branch HEAD
  • Update invariant comment to reflect that the branch may contain agent work
  • Update unit test to assert that reset --hard is NOT called on worktree reuse

Notes#

The fresh-create and branch-attach paths are unaffected by this change.

Testing#

  • Unit test 'reuses an existing valid worktree without removal, runs fetch only (no reset)' explicitly asserts resetCall is undefined
  • All existing worktree tests continue to pass
  • CI: Lint + Test + Build ✅, E2E Tests ✅
PrdAgent-runner