AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-272
  5. plan
  6. prd.json
prd.json(2.1 KB)ยท Apr 3, 2026
{
  "issueNumber": 272,
  "branchName": "feat/272-persist-worktree-across-phases",
  "generatedAt": "2026-04-03T12:00:00Z",
  "stories": [
    {
      "id": "S1",
      "title": "Refactor WorktreeService: replace createWorktree with idempotent getOrCreateWorktree and remove aggressive pre-cleanup",
      "priority": 1,
      "dependsOn": [],
      "acceptanceCriteria": [
        "getOrCreateWorktree() exists and is exported",
        "If worktree dir exists and is valid, returns existing path without recreation",
        "If branch exists but no worktree, creates worktree with existing branch (no -b flag)",
        "If neither exists, creates fresh worktree + branch from origin/master",
        "Aggressive git branch -D and git worktree remove --force pre-cleanup removed",
        "Unit tests cover all three paths plus invalid-worktree-dir edge case"
      ],
      "passes": false,
      "completedAt": null
    },
    {
      "id": "S2",
      "title": "Update PhaseRouterService to use getOrCreateWorktree and remove per-phase cleanup",
      "priority": 2,
      "dependsOn": [
        "S1"
      ],
      "acceptanceCriteria": [
        "executePhase() calls getOrCreateWorktree() instead of createWorktree()",
        "finally block no longer calls cleanupWorktree()",
        "Existing phase-router unit tests updated and passing",
        "New test asserts cleanupWorktree is NOT called after phase execution"
      ],
      "passes": false,
      "completedAt": null
    },
    {
      "id": "S3",
      "title": "Add terminal-state worktree cleanup in InternalAdapterService",
      "priority": 3,
      "dependsOn": [
        "S1"
      ],
      "acceptanceCriteria": [
        "WorktreeModule imported in internal-adapter.module.ts",
        "WorktreeService injected in InternalAdapterService constructor",
        "cleanupWorktree() called when task reaches complete status in advanceAndEnqueue()",
        "Cleanup is wrapped in try/catch (idempotent, does not fail the pipeline)",
        "Unit test: cleanup called on terminal state",
        "Unit test: cleanup NOT called on normal phase advancement"
      ],
      "passes": false,
      "completedAt": null
    }
  ]
}
PlanPr description