이랑이 30e782a32d feat(sprint-005): Resilience — retry + backoff + escalation + xhigh 금지
Sprint 005 전체 구현 — F5 (중간 끊김/타임아웃 무한대기) 해결:

Resilience core:
- src/resilience/backoff.ts — exponential backoff + jitter (base 1s, cap 30s)
  + cancellable sleep
- src/resilience/classifier.ts — error → {retryable, reason}
  retryable: timeout, network, rate_limit, transient
  non-retryable: permission, config, invariant(ZodError)
  휴리스틱: ETIMEDOUT/ECONNREFUSED/429 등 메시지 패턴 감지
  + assertAllowedThinkingTier('xhigh' 금지)
- src/resilience/retry.ts — withRetry 래퍼
  non-retryable은 즉시 중단, max retries 초과시 classification 반환
- src/resilience/kill.ts — child process SIGTERM→SIGKILL grace 처리
  + 전역 cleanup handler (SIGINT/SIGTERM)
- src/resilience/escalate.ts — recordEscalation + EscalationNotifier
  + listEscalations / resolveEscalation

Prisma:
- Escalation 모델 추가 (pipelineId, reason, errorCategory, attempts, contextSnapshot)
- Pipeline.escalations 역참조

Runner 통합:
- transport.invoke 를 withRetry 로 래핑
- 실패시 classification 기반으로 자동 escalation 기록 (non-retryable만)
- RunOptions 에 maxRetries / notifier 추가

CLI:
- rails resume <pipeline-id> — escalated → idle 전이
- rails abort <pipeline-id> [-r reason] — 강제 종료

Tests (25 신규, 82 total pass):
- backoff: 기본값/지수/캡/jitter 범위/abort
- classifier: 6 error 클래스 + 3 휴리스틱 + xhigh 금지
- withRetry: 성공/재시도 후 성공/non-retryable 즉시 중단/max 초과/abort

검증: tsc --noEmit ✓ | vitest 82/82 ✓ | build ✓ | CLI ✓

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 15:40:50 +09:00

hanarang-rails

4자매가 달릴 결정론적 레일 — HaNaRang Rails

hanarang-harness의 후계작. 기존 하네스가 "권고 기반 파이프라인"이라 자매들이 레일을 벗어나 끊기고 엇갈리던 문제를 강제 기반 결정론 파이프라인으로 재설계한다.

왜 다시?

hanarang-harness에서 발견된 6가지 실패 모드:

코드 증상 원인
F1 하네스 skill bypass — 자매가 worker 혼자 스폰하고 처리 skill 진입 강제 없음
F2 DoD 자동 강제 실패 — build 통과 = 완료로 간주 sprint contract / validator 없음
F3 QA 단계 누락 — 사용자가 수동으로 다랑이 호출 자동 라우팅 없음
F4 핸드오프 멘션 불안정 — 잘못된 자매 호출 Lobster 분기가 LLM에 의존
F5 중간 끊김 — request-timed-out 반복, xhigh 무한대기 재시도/fallback 정책 없음
F6 환경 검증 누락 — "서버에 Docker 없음" 으로 skip 용인 환경 전제 검사 없음

6가지 원칙

  1. 결정론적 라우터 — LLM 판단이 아니라 XState FSM으로 자매 간 전이
  2. Sprint Contract 강제 — DoD를 Zod 스키마로 정의, validator가 pass/fail 판정
  3. Skill 강제 진입 — skill bypass를 hook으로 감지해 차단
  4. 상태 전이 기반 핸드오프 — 멘션은 사용자 알림 전용, 자매 간 통신은 FSM 상태
  5. 재시도/에스컬레이션 — timeout 자동 재시도, N회 실패 시 사용자 에스컬레이션
  6. QA 체크리스트 강제 — 스프린트 타입별 템플릿, 다랑이가 체크박스 다 채워야 pass

아키텍처 개요

사용자 (디스코드)
    │
    ▼
┌────────────────────────────────────┐
│     hanarang-rails orchestrator    │
│  (XState FSM + SQLite + validator) │
└──────────────────┬─────────────────┘
                   │
       ┌───────────┼───────────┬───────────┐
       ▼           ▼           ▼           ▼
   ┌──────┐   ┌──────┐   ┌──────┐   ┌──────┐
   │ 하랑  │   │ 나랑  │   │ 다랑  │   │ 이랑  │
   │Planner│   │ Impl │   │  QA  │   │Deploy│
   └──────┘   └──────┘   └──────┘   └──────┘
       │           │           │           │
       └───────────┴─ OpenClaw spawn ──────┘
                   │
                   ▼
            ┌────────────┐
            │ Discord 알림│ ← 사용자 알림 전용
            └────────────┘

기술 스택

레이어 선택
런타임 Node 22 + TypeScript (strict)
상태 머신 XState v5
스키마 Zod
영속화 SQLite (better-sqlite3)
프로세스 execa + AbortController
CLI citty
로그 pino
디스코드 discord.js v14
테스트 Vitest

상태

🚧 기획 단계.plans/ 디렉토리 참조.

자세한 내용:

라이선스

MIT

Description
HaNaRang Rails — 결정론적 4자매 파이프라인 하네스 (FSM + Sprint Contract + 강제 핸드오프)
Readme MIT 1.2 MiB
Languages
TypeScript 95.7%
Shell 3.3%
Dockerfile 0.7%
JavaScript 0.3%