fix: the watchdog's timer is enabled only in a real run (CP-41) #18

Merged
pit merged 1 commit from hermes/watchdog-timer-check-mode into main 2026-11-05 16:26:51 +00:00
Owner

Summary

The deploy of #17 reached the service step's check run and failed on its last task:

TASK [semaphore : enable and start the watchdog's timer]
[ERROR]: Task failed: Module failed: Could not find the requested service semaphore-watchdog.timer: host

The timer unit is written by the same run that enables it, and check mode writes nothing — so systemctl enable had no unit to find. The task carried the server unit's condition (not ansible_check_mode or semaphore_installed), which is correct for a unit the Guest already has and wrong for a new one: on an upgrade the package is installed, the task runs, and the rehearsal that gates the deploy goes red before anything changes.

One line: when: not ansible_check_mode, with the reason beside it.

Evidence

  • Before: run 36, the failure above, after snapshot (predeploy-20261105-161801) and guest had gone green. 143 was not otherwise changed: still the previous binary, no watchdog unit.
    After: the deploy's own gate, run against 143 — site.yml --check --diff ends semaphore : ok=28 changed=10 unreachable=0 failed=0 skipped=9. The ninth skip is this task; before the fix it ran and failed.
  • make check green; the playbook file parses.

Merge Danger

Door: two-way — a revert restores a deploy that fails in its rehearsal.

Blast Radius: one when in the watchdog's last task. Merging this is what re-runs the deploy of main, and the merge that should land 143 on the community build.

## Summary The deploy of #17 reached the service step's check run and failed on its last task: ```text TASK [semaphore : enable and start the watchdog's timer] [ERROR]: Task failed: Module failed: Could not find the requested service semaphore-watchdog.timer: host ``` The timer unit is written by the same run that enables it, and check mode writes nothing — so `systemctl enable` had no unit to find. The task carried the server unit's condition (`not ansible_check_mode or semaphore_installed`), which is correct for a unit the Guest already has and wrong for a new one: on an upgrade the package is installed, the task runs, and the rehearsal that gates the deploy goes red before anything changes. One line: `when: not ansible_check_mode`, with the reason beside it. ## Evidence - **Before:** [run 36](https://forgejo.thepit.space/olympus/infra-cockpit/actions/runs/36), the failure above, after `snapshot` (predeploy-20261105-161801) and `guest` had gone green. 143 was not otherwise changed: still the previous binary, no watchdog unit. **After:** the deploy's own gate, run against 143 — `site.yml --check --diff` ends `semaphore : ok=28 changed=10 unreachable=0 failed=0 skipped=9`. The ninth skip is this task; before the fix it ran and failed. - `make check` green; the playbook file parses. ## Merge Danger **Door:** two-way — a revert restores a deploy that fails in its rehearsal. **Blast Radius:** one `when` in the watchdog's last task. Merging this is what re-runs the deploy of `main`, and the merge that should land 143 on the community build.
fix: the watchdog's timer is enabled only in a real run (CP-41)
All checks were successful
plan / guest-plan-check (pull_request_target) Successful in 16s
pr-checks / check (pull_request) Successful in 28s
c3fb77e737
The deploy of #17 reached the service step's check run and died on its last
task: `Could not find the requested service semaphore-watchdog.timer`. The unit
is new in the same run that writes it, and check mode writes nothing, so
`systemctl enable` has nothing to find.

The task carried the server unit's `when: not ansible_check_mode or
semaphore_installed`, which is right for a unit a Guest already has and wrong
for this one: on an upgrade the package is installed, so the task runs, and the
rehearsal that gates the deploy goes red before anything changes.

Verified by running the deploy's own gate against 143: `site.yml --check --diff`
now ends `ok=28 changed=10 failed=0 skipped=9`, the extra skip being this task.
Member

Review started (round 1/5) on c3fb77e737 — reading the diff now.

**Review started** (round 1/5) on c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd — reading the diff now.
bot-minos approved these changes 2026-11-05 16:25:36 +00:00
bot-minos left a comment

repo=olympus/infra-cockpit pr=18 head=c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd round=1/5 verdict=merge

Reviewed head c3fb77e737 (resolved from refs/pull/18/head on the host; equals the dispatch SHA). Round 1 of 5: no earlier review on the thread, so the whole head is reviewed; the dispatch's 1/5 and the thread's count agree.

Recommendation: merge

Verdict: no blocker, one advisory. Merge.

Spec

Source: the PR body (CP-41 is named in it) and the CP-41 ticket (Vikunja project 11, index 41), read live. The ticket carries the watchdog (timer every 15 minutes) and its --check acceptance; this PR is the follow-up to the deploy that ticket's #16 produced. The PR's own claim is the contract: the watchdog's timer task must not fail the check-mode rehearsal on an upgrade, and must still run in a real run.

Diff: one file, semaphore/service/roles/semaphore/tasks/watchdog.yml, +9/-1: the when: of the last task changes from not ansible_check_mode or semaphore_installed to not ansible_check_mode, plus a comment.

Claim Result
In --check on a Guest that has the package but no timer unit, the old condition fails with Could not find the requested service semaphore-watchdog.timer: host Reproduced. Base 7841fb7 task, semaphore_installed=true, --check, no such unit on the host: fatal ... Could not find the requested service semaphore-watchdog.timer: host, rc=2. Same sentence as run 36.
when: not ansible_check_mode clears it Reproduced. Head task, same inputs: skipping: [localhost], rc=0 (failed=0 skipped=1).
A real run still enables and starts the timer By the condition, not by a live run. Old: not check or installed; new: not check. With ansible_check_mode=false both are true, so a real run's behaviour is unchanged. The only input where the two differ is check mode with semaphore_installed=true, and that is the case being fixed.
The comment's account of why the server's unit differs Holds. tasks/main.yml:152, :172, :211, :226 and the handler (handlers/main.yml:4) keep or semaphore_installed for a unit an installed Guest already has (semaphore.service is written at main.yml:201 and enabled at :211). The timer is written by watchdog.yml itself, so only the timer is new on an upgrade.
make check green Reproduced at head: rc=0, ends plan tests: every case passed. and tofu fmt -recursive -check -diff clean.
CI pr-checks runs 37 and 38 for c3fb77e both success.
After: site.yml --check --diff against 143 ends ok=28 changed=10 unreachable=0 failed=0 skipped=9 Not reproduced: it needs the live Guest 143. See Unverified.

No spec-axis blocker. Scope: the PR touches the one task it names; nothing else moved.

ADVISORY (S1) — semaphore/service/tests/ha/rehearsal.sh:2-4, docs/deploy.md:173-175: nothing automated rehearses the upgrade shape that escaped. The role's only --check rehearsal runs against "a fresh scratch guest ... nothing of Semaphore installed" (rehearsal.sh:2-3), where semaphore_installed is false and the old condition skipped the timer task, so #16's green rehearsal could not see this defect and the first sight of it was the PROD deploy gate. After this fix the same blind spot remains for the next task copied from the server's or semaphore_installed pattern. A case with the package present and the units absent (a second container state, or the fixture of the probe used here) would close it. Not a blocker: no repo rule requires it, and this PR's fix is verified.

Standards

Sources read from the head worktree: AGENTS.md (Rules, Toolchain, Docs, Pull requests), docs/agents/issue-tracker.md, docs/deploy.md. There is no docs/adr/ in this repo (AGENTS.md says so); the org ADRs live in olympus/workshop and none bears on a one-line when: in a role task.

Rule Result
AGENTS.md §Pull requests, "Name the task a pull request addresses in its body as CP-<index>" Met: the title and body name CP-41.
AGENTS.md §Toolchain: make check is the PR gate Met: green locally and in CI (above).
AGENTS.md §Toolchain: a merge to main is a deploy The body's Merge Danger section states it ("Merging this is what re-runs the deploy of main"); the door is two-way, which matches the one-line when:.
AGENTS.md §Secrets Nothing secret in the diff; the task and its neighbours keep no_log where they carry one.
Docs docs/deploy.md §The watchdog (lines 104-126) states nothing about the timer in a check run, so no sentence is falsified by the change.
Smell baseline (judgement calls) Nothing flagged: one condition narrowed; no duplication, no speculative parameter.

No standards-axis finding.

Verified, and how

  • Head: git ls-remote origin refs/pull/18/head = c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd, equal to the dispatch SHA and the local pull ref; git diff --stat 7841fb7 HEAD = one file; 7841fb7 (current origin/main) is an ancestor of head.
  • Red/green pair: the base and head copies of the last task, ansible-playbook --check on a host whose systemctl show semaphore-watchdog.timer answers LoadState=not-found, with semaphore_installed=true. Output kept under cache/scratch/infra-cockpit-18-r1/ (base-check.out, head-check.out).
  • mise exec -- make check at head, rc=0 captured before any pipe; git status --porcelain clean afterwards.
  • CP-41 and its comments read live from Vikunja; CI runs 37 and 38 read from the forge by SHA.

Unverified, and why

  • The live gate run against 143 (ok=28 ... skipped=9, "the ninth skip is this task"): needs the live Guest and the Operator's environment. The skip itself is proved above; the count of 9 is the author's.
  • A real (non-check) run enabling the timer: would mutate a Guest. Covered by the condition's truth table only.

Named, not charged

  • With the timer present after the first real deploy, later --check runs skip this task entirely, so a timer disabled by hand is not reported by the rehearsal. The same is true of every not ansible_check_mode task in main.yml (:81, :89, :99, :107, :118) and is the cost of the choice the PR makes; it is not a defect in the change.

Summary

Axis Findings Worst
Spec 1 (0 blockers, 1 advisory) ADVISORY S1: the only automated rehearsal is against a fresh guest, which cannot see this class of failure
Standards 0 none

Total advisories: 1, below the volume threshold of three. The state follows the blockers (none): APPROVE, review/merge-ready.

<!-- minos review-loop: repo=olympus/infra-cockpit pr=18 head=c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd round=1/5 axes=standards,spec --> repo=olympus/infra-cockpit pr=18 head=c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd round=1/5 verdict=merge Reviewed head c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd (resolved from `refs/pull/18/head` on the host; equals the dispatch SHA). Round 1 of 5: no earlier review on the thread, so the whole head is reviewed; the dispatch's `1/5` and the thread's count agree. Recommendation: merge Verdict: no blocker, one advisory. Merge. ## Spec Source: the PR body (CP-41 is named in it) and the CP-41 ticket (Vikunja project 11, index 41), read live. The ticket carries the watchdog (timer every 15 minutes) and its `--check` acceptance; this PR is the follow-up to the deploy that ticket's #16 produced. The PR's own claim is the contract: *the watchdog's timer task must not fail the check-mode rehearsal on an upgrade, and must still run in a real run.* Diff: one file, `semaphore/service/roles/semaphore/tasks/watchdog.yml`, +9/-1: the `when:` of the last task changes from `not ansible_check_mode or semaphore_installed` to `not ansible_check_mode`, plus a comment. | Claim | Result | |---|---| | In `--check` on a Guest that has the package but no timer unit, the old condition fails with `Could not find the requested service semaphore-watchdog.timer: host` | Reproduced. Base `7841fb7` task, `semaphore_installed=true`, `--check`, no such unit on the host: `fatal ... Could not find the requested service semaphore-watchdog.timer: host`, rc=2. Same sentence as run 36. | | `when: not ansible_check_mode` clears it | Reproduced. Head task, same inputs: `skipping: [localhost]`, rc=0 (`failed=0 skipped=1`). | | A real run still enables and starts the timer | By the condition, not by a live run. Old: `not check or installed`; new: `not check`. With `ansible_check_mode=false` both are true, so a real run's behaviour is unchanged. The only input where the two differ is check mode with `semaphore_installed=true`, and that is the case being fixed. | | The comment's account of why the server's unit differs | Holds. `tasks/main.yml:152`, `:172`, `:211`, `:226` and the handler (`handlers/main.yml:4`) keep `or semaphore_installed` for a unit an installed Guest already has (`semaphore.service` is written at `main.yml:201` and enabled at `:211`). The timer is written by `watchdog.yml` itself, so only the timer is new on an upgrade. | | `make check` green | Reproduced at head: rc=0, ends `plan tests: every case passed.` and `tofu fmt -recursive -check -diff` clean. | | CI | `pr-checks` runs 37 and 38 for c3fb77e both `success`. | | After: `site.yml --check --diff` against 143 ends `ok=28 changed=10 unreachable=0 failed=0 skipped=9` | Not reproduced: it needs the live Guest 143. See Unverified. | No spec-axis blocker. Scope: the PR touches the one task it names; nothing else moved. **ADVISORY (S1) — `semaphore/service/tests/ha/rehearsal.sh:2-4`, `docs/deploy.md:173-175`:** nothing automated rehearses the *upgrade* shape that escaped. The role's only `--check` rehearsal runs against "a fresh scratch guest ... nothing of Semaphore installed" (`rehearsal.sh:2-3`), where `semaphore_installed` is false and the old condition skipped the timer task, so #16's green rehearsal could not see this defect and the first sight of it was the PROD deploy gate. After this fix the same blind spot remains for the next task copied from the server's `or semaphore_installed` pattern. A case with the package present and the units absent (a second container state, or the fixture of the probe used here) would close it. Not a blocker: no repo rule requires it, and this PR's fix is verified. ## Standards Sources read from the head worktree: `AGENTS.md` (Rules, Toolchain, Docs, Pull requests), `docs/agents/issue-tracker.md`, `docs/deploy.md`. There is no `docs/adr/` in this repo (AGENTS.md says so); the org ADRs live in `olympus/workshop` and none bears on a one-line `when:` in a role task. | Rule | Result | |---|---| | `AGENTS.md` §Pull requests, "Name the task a pull request addresses in its body as `CP-<index>`" | Met: the title and body name CP-41. | | `AGENTS.md` §Toolchain: `make check` is the PR gate | Met: green locally and in CI (above). | | `AGENTS.md` §Toolchain: a merge to `main` is a deploy | The body's Merge Danger section states it ("Merging this is what re-runs the deploy of `main`"); the door is two-way, which matches the one-line `when:`. | | `AGENTS.md` §Secrets | Nothing secret in the diff; the task and its neighbours keep `no_log` where they carry one. | | Docs | `docs/deploy.md` §The watchdog (lines 104-126) states nothing about the timer in a check run, so no sentence is falsified by the change. | | Smell baseline (judgement calls) | Nothing flagged: one condition narrowed; no duplication, no speculative parameter. | No standards-axis finding. ## Verified, and how - Head: `git ls-remote origin refs/pull/18/head` = `c3fb77e737ae3fa62173b5327b0cbc18a6efc7bd`, equal to the dispatch SHA and the local pull ref; `git diff --stat 7841fb7 HEAD` = one file; `7841fb7` (current `origin/main`) is an ancestor of head. - Red/green pair: the base and head copies of the last task, `ansible-playbook --check` on a host whose `systemctl show semaphore-watchdog.timer` answers `LoadState=not-found`, with `semaphore_installed=true`. Output kept under `cache/scratch/infra-cockpit-18-r1/` (`base-check.out`, `head-check.out`). - `mise exec -- make check` at head, rc=0 captured before any pipe; `git status --porcelain` clean afterwards. - CP-41 and its comments read live from Vikunja; CI runs 37 and 38 read from the forge by SHA. ## Unverified, and why - The live gate run against 143 (`ok=28 ... skipped=9`, "the ninth skip is this task"): needs the live Guest and the Operator's environment. The skip itself is proved above; the count of 9 is the author's. - A real (non-check) run enabling the timer: would mutate a Guest. Covered by the condition's truth table only. ## Named, not charged - With the timer present after the first real deploy, later `--check` runs skip this task entirely, so a timer disabled by hand is not reported by the rehearsal. The same is true of every `not ansible_check_mode` task in `main.yml` (`:81`, `:89`, `:99`, `:107`, `:118`) and is the cost of the choice the PR makes; it is not a defect in the change. ## Summary | Axis | Findings | Worst | |---|---|---| | Spec | 1 (0 blockers, 1 advisory) | ADVISORY S1: the only automated rehearsal is against a fresh guest, which cannot see this class of failure | | Standards | 0 | none | Total advisories: 1, below the volume threshold of three. The state follows the blockers (none): APPROVE, `review/merge-ready`.
pit merged commit a79db8ed71 into main 2026-11-05 16:26:51 +00:00
pit deleted branch hermes/watchdog-timer-check-mode 2026-11-05 16:26:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
olympus/infra-cockpit!18
No description provided.