From 7d532d064b105b09e21aa80c8403198bd9f114ff Mon Sep 17 00:00:00 2001 From: secret-mars Date: Wed, 15 Apr 2026 19:37:11 +0000 Subject: [PATCH] fix(phase-0): add MCP version check fail counter with operator-visible warning (fixes #30) On curl failure the Phase 0 check currently skips silently and the cached version drifts without surfacing. Add a fail counter (mcp_version_check_fail_count) that increments on failure, resets to 0 on success, and surfaces a STATE.md warning at >= 3 consecutive failures so the operator notices the drift instead of discovering it weeks later when a breaking MCP update lands. Credit to PixelForge (cycle 9 scout) who reported this in #30 with the exact shape applied here. --- daemon/loop.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/daemon/loop.md b/daemon/loop.md index b80ccac..d8cf08c 100644 --- a/daemon/loop.md +++ b/daemon/loop.md @@ -33,7 +33,11 @@ CACHED=$(python3 -c "import json; print(json.load(open('daemon/health.json')).ge - **Version match**: Set `mcp_update_required` to `false` in health.json (clears the flag after a restart). Continue normally. - **Version mismatch** (`LATEST` != `CACHED`): set `mcp_update_required: true` **and** `mcp_version_cached` to `LATEST` in health.json. Complete the current cycle normally, then in Phase 9 (Sleep), exit instead of sleeping with message: "MCP update detected ({CACHED} -> {LATEST}). Exiting for restart. Run /loop-start to resume with updated version." -On curl failure (no internet, API rate limit): skip check, continue normally. Do not block the cycle on a version check failure. +On curl failure (no internet, API rate limit): do not block the cycle. Instead: + +1. Increment `mcp_version_check_fail_count` in health.json (default 0, reset to 0 on any successful check). +2. Continue the cycle normally. +3. If `mcp_version_check_fail_count >= 3`, append a warning line to `daemon/STATE.md`: `WARNING: MCP version check has failed 3+ consecutive cycles, verify network + GitHub API reachability.` The operator then sees the drift on next STATE.md read instead of it silently bit-rotting. --- @@ -194,6 +198,7 @@ This phase is WRITE-ONLY. No reads. {"cycle":N,"timestamp":"ISO","status":"ok|degraded|error", "phases":{...},"stats":{...},"circuit_breaker":{...}, "mcp_version_cached":"x.y.z", + "mcp_version_check_fail_count":0, "mcp_update_required":false, "next_cycle_at":"ISO"} ```