공개 런타임 워치독 창·복구 결함 3건 수정

재부팅 뒤 워치독이 5분마다 콘솔 창에 실패만 뿌리던 문제의 원인 세 가지를 고친다.

- 워치독이 DB 다운을 감지하고 직접 복구한다. postgres(vignette-dev-db) 기동은
  boot 담당이라 start-public-runtime.ps1 재호출로는 절대 복구되지 않았고, 그 결과
  워치독은 고칠 수 없는 대상에 start를 무한 재시도하며 실패만 기록했다. db를
  health check 항목에 넣고, 재시작 전에 컨테이너를 되살리며, 복구 실패 시에는
  runtime 재시작을 시도하지 않고 종료한다.
- 작업 액션을 wscript 런처(watch-public-runtime-task.vbs) 경유로 등록한다.
  powershell.exe를 직접 등록하면 -WindowStyle Hidden이어도 conhost 창이 매 실행
  번쩍이고, 5분 주기에서는 그것이 곧 화면을 가리는 창이 된다. 런처는 pin 인자를
  해석하지 않고 전달만 하며 provenance 검증은 기존대로 watchdog이 수행한다.
- boot이 web preview 상태를 보고 -SkipWebRestart를 조건부로 붙인다. 무조건 스킵하면
  재부팅 직후처럼 vite가 죽은 상태에서 boot 경로로는 web이 영영 복구되지 않았다.

hidden trigger는 액션이 wscript 런처를 거치는지 함께 검증하도록 맞췄다.
This commit is contained in:
Yun Chan 2026-08-12 21:17:04 +09:00
parent 80bcacc723
commit 5cb530e153
7 changed files with 184 additions and 28 deletions

View file

@ -14,6 +14,7 @@ INSTALLER = SCRIPTS / "install-public-runtime-task.ps1"
BOOT = SCRIPTS / "boot-public-runtime.ps1"
BOOT_REGISTER = SCRIPTS / "register-boot-task.ps1"
HIDDEN_TRIGGER = SCRIPTS / "watch-public-runtime-hidden.vbs"
TASK_LAUNCHER = SCRIPTS / "watch-public-runtime-task.vbs"
START = SCRIPTS / "start-public-runtime.ps1"
VOICE_PROBE = SCRIPTS / "probe-public-voice-sidecars.py"
REPO_ROOT = SCRIPTS.parent
@ -142,8 +143,12 @@ class PublicRuntimeWatchdogProvenanceTest(unittest.TestCase):
BOOT_SOURCE,
)
self.assertGreaterEqual(BOOT_SOURCE.count("Test-VoiceApiHealthy"), 3)
self.assertIn("-WhisperPort $WhisperPort", BOOT_SOURCE)
self.assertIn("-MeloTtsPort $MeloTtsPort", BOOT_SOURCE)
self.assertIn('"-WhisperPort", $WhisperPort', BOOT_SOURCE)
self.assertIn('"-MeloTtsPort", $MeloTtsPort', BOOT_SOURCE)
# web preview는 살아 있을 때만 스킵한다. 무조건 -SkipWebRestart면 재부팅 후
# boot 경로로 web이 복구되지 않는다.
self.assertIn("$webHealthy = Test-WebPreviewHealthy", BOOT_SOURCE)
self.assertIn('if ($webHealthy) {\n $startArgs += "-SkipWebRestart"', BOOT_SOURCE)
self.assertIn("scripts/probe-public-voice-sidecars.py", INSTALLER_SOURCE)
self.assertIn("scripts/probe-public-voice-sidecars.py", BOOT_REGISTER_SOURCE)
@ -400,12 +405,14 @@ if ($result.Detail -ne 'exact readiness probe failed') {
copied_boot_register = scripts / BOOT_REGISTER.name
copied_start = scripts / START.name
copied_voice_probe = scripts / VOICE_PROBE.name
copied_task_launcher = scripts / TASK_LAUNCHER.name
shutil.copy2(WATCHDOG, copied_watchdog)
shutil.copy2(INSTALLER, copied_installer)
shutil.copy2(BOOT, copied_boot)
shutil.copy2(BOOT_REGISTER, copied_boot_register)
shutil.copy2(START, copied_start)
shutil.copy2(VOICE_PROBE, copied_voice_probe)
shutil.copy2(TASK_LAUNCHER, copied_task_launcher)
self._git(root, "init")
self._git(root, "config", "user.name", "Watchdog Contract Test")
@ -419,6 +426,7 @@ if ($result.Detail -ne 'exact readiness probe failed') {
"scripts/register-boot-task.ps1",
"scripts/start-public-runtime.ps1",
"scripts/probe-public-voice-sidecars.py",
"scripts/watch-public-runtime-task.vbs",
)
self._git(root, "commit", "-m", "watchdog fixture")
self._git(root, "checkout", "--detach")
@ -585,7 +593,9 @@ if ($result.Detail -ne 'exact readiness probe failed') {
command = wrapped[len(prefix) : -1].replace('""', '"')
root = r"C:\Pinned Vignette Release"
# 액션은 wscript 런처를 거친다 — powershell.exe 직접 실행은 conhost 창이 번쩍인다.
arguments = (
f'"{root}\\scripts\\watch-public-runtime-task.vbs" '
f'-File "{root}\\scripts\\watch-public-runtime.ps1" '
f'-StableSourceRoot "{root}" '
f"-ExpectedSourceCommit {'a' * 40} "
@ -597,7 +607,7 @@ if ($result.Detail -ne 'exact readiness probe failed') {
"$script:watchdogTriggered=$false;"
"function Get-ScheduledTask { param($TaskName,$ErrorAction) "
"$action=[pscustomobject]@{"
"Execute='C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe';"
"Execute='C:\\Windows\\System32\\wscript.exe';"
f"WorkingDirectory='{root}';Arguments='{arguments}'"
"};[pscustomobject]@{Actions=@($action)}};"
"function Start-ScheduledTask { param($TaskName) "