Skip to content

fix(bin): keep watcher beacon fresh during progressing cycles - #8738

Closed
mehulbhagwani wants to merge 1 commit into
kunchenguid:mainfrom
mehulbhagwani:fm/watcher-beacon-pr
Closed

mehulbhagwani wants to merge 1 commit into
kunchenguid:mainfrom
mehulbhagwani:fm/watcher-beacon-pr

Conversation

@mehulbhagwani

Copy link
Copy Markdown
Contributor

A large fleet can take longer than the watcher grace to finish one poll cycle even while every step returns.
The beacon previously moved only at cycle start, so guards reported a progressing watcher as down.

Refresh the beacon synchronously at step boundaries and between pane scans, state checks, secondmate probes, and selected pending-reply records.
Mid-cycle writes are rate limited to 30 seconds by default (FM_WATCHER_CHECKPOINT_SECS).
A step that stops returning reaches no checkpoint and still goes stale; short cycles retain their cycle-top-only writes.
Correct the existing comments and documentation that claimed a pre-wait touch already existed.

Closes #5408.
Closes #8095.

Validation:

  • The new real-watcher/real-guard regression passes all three cases: slow cycle (maximum beacon age 2s with a 6s grace), stuck step (9s, reported down while the watcher is alive), and short-cycle compatibility.
  • The same regression fails against the upstream watcher: beacon age 19s during a progressing cycle with a 6s grace.
  • Pending-reply, watcher foreground-checkpoint, test-runner, and secondmate-liveness behavior suites passed.
  • Changed-file ShellCheck lint, documentation audience checks, workflow lint, and test coverage guard passed.

This contribution follows an explicitly requested direct-PR delivery path; no no-mistakes pipeline was run and no attestation is claimed.
The SSH connection-timeout change is excluded.

@mehulbhagwani

Copy link
Copy Markdown
Contributor Author

Published head: 30bc0209e8bcad7495aacc2de94a4710f86a33a0. The local replay of the beacon regression passed on this exact revision.

Local follow-up: I tested the recovered Mini patch (d2d1f203) on main in scratch tree 06fe451a128fcd519365b21185b11f2e02230af4. In the real watcher/guard test, a progressing cycle kept the beacon age at 2s with a 6s grace. A genuinely stuck step still triggered the down warning, and the short-cycle check passed. The recovered delta adds the zero-interval fallback and updates its regression test.

The append-only follow-up remains unpublished. The default validation rebase can rewrite this behind-main branch, so the original owner is preserving the branch while confirming a delivery path that keeps history and attests the new head through every required step. The no-mistakes policy check on the published head is still red.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @mehulbhagwani. This is my first look at head 30bc0209 against main 351432a3.

What it does: adds watcher_checkpoint in bin/fm-watch.sh, a rate-limited (FM_WATCHER_CHECKPOINT_SECS, default 30) touch of state/.last-watcher-beat at step boundaries (between pane scans, state checks, secondmate probes, after the process-event reconcile, and per pending-reply record through a new optional argument to fm_pending_reply_tick). A step that stops returning reaches no checkpoint, so a wedged watcher still reads as down. It also corrects comments and docs/turnend-guard.md that claimed a pre-wait touch already existed, and adds tests/fm-watch-beacon-progress.test.sh (real watcher against the real guard).

Diff review (stands in for Greptile while it is out): safe. The only new write is a touch of the existing beacon. No workflow, network or credential changes. The rate limit uses $SECONDS with no fork. Short cycles keep their one touch at the top.

Blocker (waiting on you): the PR is not raised through no-mistakes. "Require no-mistakes" is red, and the body says no attestation is claimed. no-mistakes is blocking here, so the head needs a pipeline run that binds it with every step completed and none skipped. Please send it through git push no-mistakes (the history-preserving delivery path you're confirming is fine as long as the final head is attested). I read your follow-up comment: the unpublished d2d1f203 zero-interval fallback should come in on that same push, so the attested head is the one we review. Please don't push a plain main-sync commit afterwards, because that breaks the attestation.

Contract class: new-default. The beacon's refresh cadence changes for every unconfigured home, and with it when the turn-end guard reports a watcher as down. It fixes #5408 and #8095 (Closes lines look right). VISION, rule by rule: One captain: aligns (no false "watcher down" next to a live watcher) · Authority: n/a · Scripts: aligns (a deterministic touch) · Restart: aligns · Delegation: aligns (stuck-step detection preserved) · Vendor: neutral · Scope: aligns. Security: none.

The red "Full suite" is only the label gate. I'm not adding full-ci until the attestation binds the head. Once it does and Full is green, the merge is Kun's decision.

@mehulbhagwani

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The heartbeat fix serves the VISION.md criterion that the interface must stay honest under load: a progressing watcher stays fresh, but a stuck step still reports down.

  1. Is there a supported way to attest the final head of fix(bin): keep watcher beacon fresh during progressing cycles #8738 through every no-mistakes step while enforcing fast-forward-only publication for the existing fork branch, including CI repairs, without publishing to an evidence branch or creating another PR?
  2. What supported setup runs every validation step for a PR into the fork’s own main, keeps every push fast-forward-only through CI repairs, and never opens an upstream PR?

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @mehulbhagwani. Here are answers to both questions from what no-mistakes documents. Please treat them as pointers, not guarantees, and check them against your installed version.

  1. Fast-forward-only publication of the existing fork branch: set the operator-level rebase.strategy: merge in your global no-mistakes config. Its global config reference says the Rebase step then integrates main with a --no-ff merge whose first parent is the reviewed head, and publication is a fast-forward. The Push step uses a regular push for an append-only update. This repo's trusted .no-mistakes.yaml doesn't set rebase.strategy, so your global value applies. One documented exception: a CI merge-conflict repair rebases whatever the strategy is, so it can still force-push. If you need to rule that out entirely, ci.release_after_checks_pass ends the run at checks-passed, so nothing re-pushes the branch afterwards. Nothing in that path needs an evidence branch or a second PR.
  2. Validating PRs into your fork's own main without opening an upstream PR is configured on your side (your remote, push target and PR base) and is outside this repo's review. The no-mistakes docs and issue tracker are the right place for that. Here I only need the final head of fix(bin): keep watcher beacon fresh during progressing cycles #8738 attested.

Where this stands: unchanged from my last comment. "Require no-mistakes" is red because the head isn't attested. Once a no-mistakes run binds the final head with every step completed (including your d2d1f203 zero-interval fallback), this gets the full suite. Contract class stays new-default (the beacon cadence changes for every unconfigured home), so after a green Full the merge is Kun's decision. Waiting on you for the attested push.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: closing this one with thanks, @mehulbhagwani. Its change (plus the zero-interval fix and the signal-path checkpoints) landed through #8823, which merged as c6122906. Reopen if I've missed something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants