fix: Prevent features from getting stuck in in_progress after server restart

- Add graceful shutdown handler that marks running features as 'interrupted'
  before server exit (SIGTERM/SIGINT)
- Add 30-second shutdown timeout to prevent hanging on exit
- Add orphan detection to identify features with missing branches
- Add isFeatureRunning() for idempotent resume checks
- Improve resumeInterruptedFeatures() to handle features without saved context
- Add 'interrupted' status to FeatureStatusWithPipeline type
- Replace console.log with proper logger in auto-mode-service
- Add comprehensive unit tests for all new functionality (15 new tests)

Fixes #696

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shirone
2026-01-25 14:38:39 +01:00
parent ebf2fcadd6
commit 011ac404bb
6 changed files with 779 additions and 43 deletions

View File

@@ -22,6 +22,7 @@ export type PipelineStatus = `pipeline_${string}`;
export type FeatureStatusWithPipeline =
| 'backlog'
| 'in_progress'
| 'interrupted'
| 'waiting_approval'
| 'verified'
| 'completed'