Skip to content

feat: coordinate local watchdog and external recovery lifecycle #44

Closed

Description

@abruption

목적

Dots 내부 watchdog과 외부 복구 요청이 함께 동작할 때의 역할, 재시도 한도, 중복 실행 방지 및 시작·중지 정책을 구현합니다. #20의 같은 부팅 내 복구 실측과 #43의 외부 MCP Events 시험을 연결하는 구현 과제입니다.

배경

  • 내부 watchdog은 같은 VM에서 개별 구성요소가 종료됐을 때 빠르게 복구하는 역할이 있습니다. VM 교체로 watchdog 자체가 사라지면 스스로 시작할 수 없습니다.
  • 외부 경로는 SSH와 Tailscale ping이 모두 실패할 때 Dots에 시작 요청을 전달하는 별도 경로입니다. 이벤트 수신과 실제 실행 사이의 지연이 있으므로 내부 감시를 바로 대체한다고 볼 수 없습니다.
  • start.sh의 작업 잠금은 동시 실행을 직렬화하지만, 두 경로가 순차적으로 반복 시도하는 정책까지 통합하지는 않습니다.
  • 초기 시험에서는 내부 watchdog과 외부 복구가 각각 24시간 최대 3회 한도를 관리했습니다. 2026-10-24 외부 운영 시험은 24시간 최대 12회·최소 1시간 간격으로 조정했고 코드 기본값은 3회·1시간으로 유지합니다. 내부 watchdog은 사용자 요청으로 중지된 상태이며, 두 경로의 예산을 합친 전역 한도는 아직 구현하지 않았습니다.
  • 사용자의 요청으로 2026-10-22에 Dots 내부 시험 watchdog만 정상 종료했습니다. 기존 로그는 보존했고 Tailscale·SSH 및 외부 감시·복구 시험은 유지합니다.

구현 범위

  • 내부 watchdog의 같은 부팅 내 구성요소 복구와 외부의 연결 단절 복구 역할을 명시합니다. SSH만 실패하는 상황도 별도로 분류합니다.
  • 공통 복구 진입점과 잠금, 잠금 획득 후 상태 재확인을 설계합니다. 이미 복구된 상태에서 도착한 지연 이벤트는 실행 없이 종료합니다.
  • 시도 주체·사유·시각·결과를 기록하는 지속 원장을 마련하고, 공유 예산 또는 명시적인 분리 예산을 선택합니다. 실제 총 시도 한도가 문서·상태 출력과 일치해야 합니다.
  • 결과 불명, timeout 및 오래된 요청에 대해 무작정 재시도하지 않습니다. 외부의 새 SSH·ping 확인과 로컬 실행 결과를 구분합니다.
  • 외부 시작 후 watchdog을 다시 시작할지 opt-in 정책을 제공합니다. 같은 부팅에서 중복 생성하지 않고, 새 부팅에서는 파일 존재·무결성·실행 환경을 확인합니다. watchdog 파일이 없을 때 임의 설치하지 않습니다.
  • 의도적으로 중지한 watchdog과 비정상 종료를 구분하고, 네트워크 정상 여부와 watchdog 상태를 별도로 보여줍니다. 명시적 중지 상태가 외부 복구로 조용히 취소되지 않도록 합니다.
  • 기존 Tailscale state와 SSH identity를 유지합니다. 인증 정보·키·필수 파일이 없으면 안전하게 중단하며, 자동 재등록·삭제·로그인을 하지 않습니다.
  • 배포 소스, manifest, updater/rollback 및 문서와 연결합니다. 설치된 정식 start.sh를 임의 패치하는 방식으로 구현하지 않습니다.

검증 및 완료 조건

  • 내부·외부 동시 트리거, 내부 복구 직후 도착한 외부 이벤트, 연속 장애, 프로세스 재시작 후 예산 유지, 결과 불명 및 cooldown을 검증합니다.
  • 의도적 watchdog 중지 중에는 정상 네트워크 관측이 복구 요청을 만들지 않고, 외부 경로도 중지 의사를 존중하는지 확인합니다.
  • 같은 부팅과 새 부팅/VM 교체를 구분하여 watchdog 시작과 외부 접속 회복을 기록합니다. 새 VM 실행은 독립된 실행 경로가 확보된 경우에만 시험합니다.
  • 지원 범위와 미검증 조건, 시작·중지·상태 확인 방법을 문서화합니다. 새 VM 자동 복구나 즉시 실행이 검증됐다고 선행 주장하지 않습니다.

관련 이슈

v0.5.0 후보 구현 과제이며, 연구 결과에 따라 범위는 조정될 수 있습니다. 이 이슈 등록으로 새 배포나 실환경 장애 주입을 수행하지 않습니다.

Activity

  1. added this to the v0.5.0 milestone on Oct 22, 2026
  2. abruption commented on Oct 25, 2026

    @abruption
    OwnerAuthor

    2026-10-25 policy/lifecycle update

    The external trial policy is now explicitly 12 claims per rolling 24 hours, at least 3600 seconds apart, while code defaults remain 3/3600. Existing claim history is retained; success does not refund the budget, and an already-claimed incident cannot run again. This is not a shared global budget with the local watchdog.

    #46 adds eligibility_reason, advisory retry_at, and bounded same-incident notifications when an observed policy block clears. A notification does not grant execution authority; a fresh accepted claim is still mandatory. The saved Dots task instructions were updated accordingly. The current deployment was already eligible under its old limit at cutover, so it did not itself prove the unblock-notification live path.

    External logs confirm three new-boot recovery boundaries on Oct 24–25 while the internal watchdog remained stopped; see #43 for times and evidence limits. The separate Mac monitoring relay needed a restart after its Python runtime was replaced; relay supervision must remain distinct from Dots startup/watchdog behavior. Shared-budget and concurrent internal/external recovery criteria remain open.

  3. modified the milestones: v0.5.0, v0.6.0 on Oct 25, 2026
  4. abruption commented on Oct 25, 2026

    @abruption
    OwnerAuthor

    v0.5.0 scope decision: PR #46 will deliver the current experimental research implementation, operational documentation and validated package metadata/artifacts. This issue remains open; its uncompleted acceptance criteria move to v0.6.0 rather than being marked complete. Repeated boot-change recovery is evidence for the experiment, not a guarantee of arbitrary VM replacement, general-account setup or unattended operation under every monitoring-host failure.

  5. modified the milestones: v0.6.0, v0.7.0 on Oct 26, 2026
  6. abruption commented on Oct 26, 2026

    @abruption
    OwnerAuthor

    v0.6.0에는 #49/#51만 포함하고, 이 이슈의 watchdog·외부 복구 조정은 v0.7.0으로 이월합니다. 공통 예산·중지 의사·지연 이벤트 및 업데이트와 복구의 충돌 처리는 후속 구현 범위이며 이번 릴리스가 구현 완료를 의미하지 않습니다.

  7. modified the milestones: v0.7.0, v0.8.0 on Oct 28, 2026
  8. abruption commented on Oct 29, 2026

    @abruption
    OwnerAuthor

    Development implementation is available in PR #74: #74

    The candidate shares a local ledger, budget and stop/unknown fences between the packaged watchdog and explicitly integrated external tasks. Managed stale-socket cleanup is a separate default-off mode requiring prior healthy ownership evidence and same-context revalidation. Untracked sockets and unknown process visibility remain manual. Local readiness is not external SSH/ping recovery; old tasks are not silently migrated.

    The reviewed runtime candidate passed Linux core CI on Python 3.11/3.13 (541 tests each, zero skipped), plus the scoped independent Claude/Codex review process. Exact revisions, research checks, fixture limits and remaining gates: https://github.com/abruption/dots-tailscale/blob/feat/v080/docs/validation/v0.8.0-development-review.md

    PR-head checks are recorded on #74. No merge, tag/release or operating deployment is included in this development update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: mediumPlanned work after higher-priority prerequisites.

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions