monitoring: a service that JUST went live reads "down" on its machine card for up to 30 s — go-active drops the cached verdict but waits for the next tick instead of re-aggregating now #1685

Closed
opened 2026-09-21 05:53:27 +00:00 by ben · 2 comments
Owner

What's true today (verified on main @ 56445548)

A service that has just finished installing, and passed its deploy-time health check, can still wear a red down chip — and its machine card a "▲ down" alert — for up to one monitoring tick (30 s).

Seen live: brand-reach on bens-mac-04, run 20260920T213503Z. deploy-archive settled and service health probe … service=archive … verdict=healthy logged at 21:56:50; ~3 s later the drive opened the Services-tab Uninstall dialog and its machine card read "▲ community archive down" with a DOWN pill beside the archive (frame artifacts/legs/uninstall-from-card-archive-dialog.png). Nothing on the box was wrong.

Cause

Two health truths, converging a tick late:

  • Provisioning's deploy-time check decides go-active. On success it calls healthCache.InvalidateCheck(device, service) (internal/provision/health.go:345, and :594) — #1478's fix, which stopped the stale verdict living a whole check cadence (minutes).
  • Monitoring (internal/monitor) cached "down" while the service was mid-install. InvalidateCheck (monitor.go:641) only deletes the cache entry; the verdict the fleet read and the cards draw from is whatever the LAST aggregation produced, and the next one is Run's ticker — aggregationInterval = 30 * time.Second (control-plane/cmd/control-plane/main.go:94). #1478's own comment says so: "makes the next 30 s aggregation tick re-probe".

So the residue of #1478 is one tick: up to 30 s of a red "down" on a service that is up.

What to build

At go-active, re-aggregate now rather than at the next tick. The door already exists: Orchestrator.Tick(ctx) is safe to call concurrently with the Run loop (monitor.go:253-256 — "the Run loop every interval and Apply's verify-the-fix re-aggregation both call it", ADR 0069), and the respond ladder already does exactly this after a fix (respond.go:307).

  • Grow the narrow seam provisioning holds (internal/provision/provision.go:223-228, today just InvalidateCheck) with a re-aggregate-now verb — or have InvalidateCheck's composition-root wiring follow the invalidate with an async Tick — so go-active = invalidate + tick.
  • Asynchronous and bounded: a deploy's go-active must never block on, or fail because of, a monitoring pass (its own context + timeout; a failed/late tick is logged, the 30 s loop still converges it).
  • Coalesced: a seven-service install must not fan out seven concurrent full aggregations — one in flight, at most one queued.
  • Same treatment at the removal path's invalidate (health.go:594) so a removed service's chip does not linger either.

Acceptance

  • Seam test on a real clock: a service cached "down" mid-install reads "up" on the fleet read within ~1–2 s of go-active, not after a 30 s tick
  • Go-active neither blocks on nor fails with the monitoring pass (tick made to hang/err → deploy still green, loop converges later)
  • N services going active together produce a bounded number of aggregations
  • #1478's comment in health.go updated to the new truth; STATUS.md in the same commit

Two-way, seam-provable — no live drive needed to close; the brand-reach dialog frame will show it for free on its next fire.

Related: #1478, ADR 0069, ADR 0161 (cadence paces steady-state watching, not verification of a change), DDR 0072.

## What's true today (verified on `main` @ `56445548`) A service that has just finished installing, and passed its deploy-time health check, can still wear a red **down** chip — and its machine card a "▲ <service> down" alert — for up to one monitoring tick (30 s). **Seen live:** brand-reach on bens-mac-04, run `20260920T213503Z`. `deploy-archive` settled and `service health probe … service=archive … verdict=healthy` logged at 21:56:50; ~3 s later the drive opened the Services-tab Uninstall dialog and its machine card read **"▲ community archive down"** with a DOWN pill beside the archive (frame `artifacts/legs/uninstall-from-card-archive-dialog.png`). Nothing on the box was wrong. ## Cause Two health truths, converging a tick late: - **Provisioning's deploy-time check** decides go-active. On success it calls `healthCache.InvalidateCheck(device, service)` (`internal/provision/health.go:345`, and `:594`) — #1478's fix, which stopped the stale verdict living a whole *check cadence* (minutes). - **Monitoring** (`internal/monitor`) cached "down" while the service was mid-install. `InvalidateCheck` (`monitor.go:641`) only **deletes the cache entry**; the verdict the fleet read and the cards draw from is whatever the LAST aggregation produced, and the next one is `Run`'s ticker — `aggregationInterval = 30 * time.Second` (`control-plane/cmd/control-plane/main.go:94`). #1478's own comment says so: "makes the next 30 s aggregation tick re-probe". So the residue of #1478 is one tick: up to 30 s of a red "down" on a service that is up. ## What to build At go-active, re-aggregate **now** rather than at the next tick. The door already exists: `Orchestrator.Tick(ctx)` is safe to call concurrently with the `Run` loop (`monitor.go:253-256` — "the Run loop every interval and Apply's verify-the-fix re-aggregation both call it", ADR 0069), and the respond ladder already does exactly this after a fix (`respond.go:307`). - Grow the narrow seam provisioning holds (`internal/provision/provision.go:223-228`, today just `InvalidateCheck`) with a re-aggregate-now verb — or have `InvalidateCheck`'s composition-root wiring follow the invalidate with an async `Tick` — so go-active = invalidate + tick. - **Asynchronous and bounded:** a deploy's go-active must never block on, or fail because of, a monitoring pass (its own context + timeout; a failed/late tick is logged, the 30 s loop still converges it). - **Coalesced:** a seven-service install must not fan out seven concurrent full aggregations — one in flight, at most one queued. - Same treatment at the removal path's invalidate (`health.go:594`) so a removed service's chip does not linger either. ## Acceptance - [ ] Seam test on a real clock: a service cached "down" mid-install reads "up" on the fleet read within ~1–2 s of go-active, not after a 30 s tick - [ ] Go-active neither blocks on nor fails with the monitoring pass (tick made to hang/err → deploy still green, loop converges later) - [ ] N services going active together produce a bounded number of aggregations - [ ] #1478's comment in `health.go` updated to the new truth; STATUS.md in the same commit Two-way, seam-provable — no live drive needed to close; the brand-reach dialog frame will show it for free on its next fire. **Related:** #1478, ADR 0069, ADR 0161 (cadence paces steady-state watching, not verification of a change), DDR 0072.

swarm-claim host=bens-mac-04 run=29015
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=29015 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #1685 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1685,
  "status": "success",
  "commits": [
    "99d80277"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/monitor/monitor.go",
    "internal/monitor/monitor_test.go",
    "internal/provision/health.go",
    "internal/provision/health_test.go",
    "internal/provision/provision.go"
  ],
  "tests": [
    {
      "command": "CGO_ENABLED=1 go test ./internal/monitor/ ./internal/provision/ -race -count=1",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/monitor/ ./internal/provision/",
      "exit_code": 0
    },
    {
      "command": "gofmt -l (changed files)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Seam test on a real clock: a service cached down mid-install reads up on the fleet read within ~1-2 s of go-active, not after a 30 s tick": "internal/monitor/monitor_test.go TestReaggregateSoon_GoActiveClearsAStaleDownWithoutWaitingATick — no manual Tick, no clock advance; polls the fleet read until the critical clears within a 2 s deadline",
    "Go-active neither blocks on nor fails with the monitoring pass (tick made to hang/err -> deploy still green, loop converges later)": "ReaggregateSoon spawns a goroutine and returns immediately (internal/monitor/monitor.go); TestReaggregateSoon_CoalescesConcurrentGoActives asserts the calls return in <500ms while a pass is hung in its probe (gate channel); the drain runs Tick under a 25s reaggregateTimeout context",
    "N services going active together produce a bounded number of aggregations": "internal/monitor/monitor.go coalescing (one in flight, at most one queued); TestReaggregateSoon_CoalescesConcurrentGoActives asserts 10 go-actives -> exactly 2 passes; internal/provision/health.go deploy path calls ReaggregateSoon once per deploy",
    "#1478's comment in health.go updated to the new truth; STATUS.md in the same commit": "internal/provision/health.go comments at both go-active call sites updated to describe invalidate + ReaggregateSoon (#1685); STATUS.md milestone entry in commit 99d80277"
  },
  "summary": "go-active now re-aggregates monitoring immediately (async, bounded, coalesced) instead of waiting for the next 30 s tick, so a just-live service no longer reads down.",
  "reason": "",
  "blockers": []
}
**close-report** for #1685 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1685, "status": "success", "commits": [ "99d80277" ], "changed_files": [ "STATUS.md", "internal/monitor/monitor.go", "internal/monitor/monitor_test.go", "internal/provision/health.go", "internal/provision/health_test.go", "internal/provision/provision.go" ], "tests": [ { "command": "CGO_ENABLED=1 go test ./internal/monitor/ ./internal/provision/ -race -count=1", "exit_code": 0 }, { "command": "go vet ./internal/monitor/ ./internal/provision/", "exit_code": 0 }, { "command": "gofmt -l (changed files)", "exit_code": 0 } ], "criteria": { "Seam test on a real clock: a service cached down mid-install reads up on the fleet read within ~1-2 s of go-active, not after a 30 s tick": "internal/monitor/monitor_test.go TestReaggregateSoon_GoActiveClearsAStaleDownWithoutWaitingATick — no manual Tick, no clock advance; polls the fleet read until the critical clears within a 2 s deadline", "Go-active neither blocks on nor fails with the monitoring pass (tick made to hang/err -> deploy still green, loop converges later)": "ReaggregateSoon spawns a goroutine and returns immediately (internal/monitor/monitor.go); TestReaggregateSoon_CoalescesConcurrentGoActives asserts the calls return in <500ms while a pass is hung in its probe (gate channel); the drain runs Tick under a 25s reaggregateTimeout context", "N services going active together produce a bounded number of aggregations": "internal/monitor/monitor.go coalescing (one in flight, at most one queued); TestReaggregateSoon_CoalescesConcurrentGoActives asserts 10 go-actives -> exactly 2 passes; internal/provision/health.go deploy path calls ReaggregateSoon once per deploy", "#1478's comment in health.go updated to the new truth; STATUS.md in the same commit": "internal/provision/health.go comments at both go-active call sites updated to describe invalidate + ReaggregateSoon (#1685); STATUS.md milestone entry in commit 99d80277" }, "summary": "go-active now re-aggregates monitoring immediately (async, bounded, coalesced) instead of waiting for the next 30 s tick, so a just-live service no longer reads down.", "reason": "", "blockers": [] } ``` </details>
Sign in to join this conversation.
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
Matou/idss#1685
No description provided.