supervisor: clear stale status reason on successful start
supervisor: clear stale status reason on successful start On the RUNNING transition in start_service, clear rt.skip_reason so a prior "conflicts with <peer>" or condition-skip message cannot resurface as a false failure reason if the service later exits for an unrelated cause. Also adds a focused integration test that conflict-fails a pair at boot, manually starts one (peer is failed/not-running), and asserts the status row shows "running" with no stale conflict text.
Author:
Chris Tusa <chris.tusa@leafscale.com>
Date:
Jun 13, 2026 17:30
Changeset:
4cac1ef3af7d1e65ec29594a937268451bafc047
Branch:
default
Changed files:
Diff
diff -r e20ca708b5c0 -r 4cac1ef3af7d src/supervisor.reef --- a/src/supervisor.reef Sat Jun 13 17:18:10 2026 -0500 +++ b/src/supervisor.reef Sat Jun 13 17:30:15 2026 -0500 @@ -562,6 +562,7 @@ rt.pid = pid rt.contract_id = ctid rt.last_start_time = time.time_now() + rt.skip_reason = "" // clear any stale conflict/skip reason from a prior failure table.runtimes[idx] = rt // Register contract mapping diff -r e20ca708b5c0 -r 4cac1ef3af7d tests/integration/run_tests.sh --- a/tests/integration/run_tests.sh Sat Jun 13 17:18:10 2026 -0500 +++ b/tests/integration/run_tests.sh Sat Jun 13 17:30:15 2026 -0500 @@ -1024,6 +1024,36 @@ stop_daemon +# --- Stale reason cleared on successful start after conflict-fail. +# conflict-fail both at boot, then start one after the other is gone (already +# failed so not running); the restarted service must show "running", NOT +# "conflicts with". +stop_daemon +rm -rf "$CONFIG_DIR" +mkdir -p "$CONFIG_DIR" "$ENABLED_DIR" + +create_service_with_conflicts "clr-a" "daemon" "$BIN_DIR/sleeper.sh" "\"clr-b\"" +create_service "clr-b" "daemon" "$BIN_DIR/sleeper.sh" +enable_service "clr-a" +enable_service "clr-b" + +start_daemon + +# Both should be failed at boot (mutual conflict) +output=$(zygctl status clr-a) +assert_contains "$output" "failed" "stale-clear: clr-a failed at boot" +output=$(zygctl status clr-b) +assert_contains "$output" "failed" "stale-clear: clr-b failed at boot" + +# Now start clr-a — clr-b is failed (not running), so the start should succeed +output=$(zygctl start clr-a) +sleep 1 +output=$(zygctl status clr-a) +assert_contains "$output" "running" "stale-clear: clr-a running after manual start" +assert_not_contains "$output" "conflicts with" "stale-clear: clr-a status has no stale conflict reason" + +stop_daemon + # --- Symmetry: declare the conflict on ONE side only; both still fail at boot. stop_daemon rm -rf "$CONFIG_DIR"