feat(story-200): auto-prune worktrees when stories are archived

- Add `prune_worktree_sync` to worktree.rs: removes a story's worktree
  if it exists, delegating to `remove_worktree_sync` (best-effort,
  failures logged internally)
- Update `sweep_done_to_archived` to accept `git_root` and call
  `prune_worktree_sync` after promoting a story from 5_done to 6_archived
- Add Part 2 to the sweep: scan 6_archived and prune any stale worktrees
  for stories already there (catches items archived before this feature)
- All worktree removal failures are logged but never block file moves
- Add 5 new tests: prune noop, prune real worktree, sweep-on-promote,
  sweep-stale-archived, sweep-not-blocked-by-removal-failure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-26 14:58:52 +00:00
parent 4e535dff18
commit 40d96008c9
11 changed files with 252 additions and 48 deletions

View File

@@ -1,20 +0,0 @@
---
name: "Auto-prune worktrees for archived stories in watcher sweep"
---
# Story 200: Auto-prune worktrees for archived stories in watcher sweep
## User Story
As a developer, I want stale worktrees to be automatically cleaned up when their story is promoted to archived, so that disk space doesn't silently fill up over time.
## Acceptance Criteria
- [ ] When sweep_done_to_archived moves a story to 6_archived, its worktree (if any) is removed via remove_worktree_sync
- [ ] Worktrees for stories already in 6_archived at sweep time are also cleaned up (catches previously missed items)
- [ ] Worktree removal failures are logged but do not block the story file move or other cleanup
- [ ] Existing tests pass and new unit tests cover the worktree pruning logic
## Out of Scope
- TBD

View File

@@ -1,20 +0,0 @@
---
name: "Make watcher sweep interval configurable via project.toml"
---
# Story 201: Make watcher sweep interval configurable via project.toml
## User Story
As a developer, I want to configure the watcher sweep interval and done-retention period in project.toml, so that I can tune how quickly stories are promoted to archived based on my team's workflow.
## Acceptance Criteria
- [ ] project.toml supports optional sweep_interval_secs and done_retention_secs fields (with sensible defaults matching current hardcoded values: 60s and 4h)
- [ ] The watcher reads these values at startup and uses them for SWEEP_INTERVAL and DONE_RETENTION
- [ ] Changing project.toml hot-reloads the sweep config without restarting the server
- [ ] Existing tests pass and new unit tests cover default and custom config values
## Out of Scope
- TBD

View File

@@ -1,19 +0,0 @@
---
name: "Make agent watchdog interval configurable via project.toml"
---
# Story 202: Make agent watchdog interval configurable via project.toml
## User Story
As a developer, I want to configure the agent watchdog polling interval in project.toml, so that I can tune the orphan-detection frequency for my environment.
## Acceptance Criteria
- [ ] project.toml supports an optional watchdog_interval_secs field (default 30s matching current hardcoded value)
- [ ] AgentPool::spawn_watchdog reads the configured interval instead of using a hardcoded constant
- [ ] Existing tests pass and new unit tests cover default and custom config values
## Out of Scope
- TBD

View File

@@ -1,21 +0,0 @@
---
name: "Move story to current before checking agent availability in start_agent"
---
# Story 203: Move story to current before checking agent availability in start_agent
## User Story
As an agent operator, I want start_agent to move a story to 2_current/ even when all coders are busy, so that auto-assign picks it up when one becomes available — matching the promise in the error message.
## Acceptance Criteria
- [ ] start_agent moves the story from 1_upcoming/ to 2_current/ before checking agent availability
- [ ] When all coders are busy, start_agent returns a message indicating the story is queued in current and will be auto-assigned
- [ ] auto_assign_available_work picks up the story when a coder finishes
- [ ] If the story is already in 2_current/ or later, the move is a no-op (no error)
- [ ] Existing tests pass and new tests cover the queued-in-current scenario
## Out of Scope
- TBD

View File

@@ -1,19 +0,0 @@
---
name: "Rename StorkIt branding to Story Kit"
---
# Story 204: Rename StorkIt branding to Story Kit
## User Story
As a user, I want the application branding to say "Story Kit" instead of "StorkIt", so that the product name is displayed correctly.
## Acceptance Criteria
- [ ] ChatHeader displays "Story Kit" instead of "StorkIt"
- [ ] SelectionScreen heading displays "Story Kit" instead of "StorkIt"
- [ ] All corresponding tests (unit and e2e) are updated to match
## Out of Scope
- TBD

View File

@@ -0,0 +1,19 @@
---
name: "claude-pty should be selected by default on first use"
---
# Story 206: claude-pty should be selected by default on first use
## User Story
As a user setting up a new project, I want claude-pty to be the default LLM provider on first use, so that I don't accidentally end up waiting on a slow local model like ollama.
## Acceptance Criteria
- [ ] claude-pty is the default provider when no project.toml exists yet
- [ ] If ollama or other providers are available, claude-pty still takes priority as the default
- [ ] Existing projects with a configured provider are not affected
## Out of Scope
- TBD

View File

@@ -0,0 +1,19 @@
---
name: "Rename LLM provider labels: claude-pty to Claude Code, Anthropic to Anthropic API"
---
# Story 207: Rename LLM provider labels: claude-pty to Claude Code, Anthropic to Anthropic API
## User Story
As a user, I want the LLM provider dropdown to show "Claude Code" for the claude-pty provider and "Anthropic API" for the Anthropic API-key provider, so that the names are clear and recognizable.
## Acceptance Criteria
- [ ] The claude-pty provider is labeled "Claude Code" in the UI dropdown
- [ ] The Anthropic API-key provider is labeled "Anthropic API" in the UI dropdown
- [ ] No functional changes to the providers themselves
## Out of Scope
- TBD