Why
The daemon runs every tick script from the LOCAL main checkout's working tree. When main falls behind origin — which happens whenever PRs merge via the GitHub UI instead of merge-ready's local_sync — the daemon executes stale code and reasons from stale state. This starved the loop from 2026-07-21 to 2026-07-24: local main sat behind while merged census improvements (and everything else) never took effect, and every tick quietly recorded action=none. The failure was invisible: main_dirty said no, ticks looked healthy, nothing pointed at staleness.
Proposal
- loop-census.sh: alongside main_dirty/main_head, emit
main_behind_origin=<n|no> (commits behind, via git fetch origin main --quiet + rev-list --count main..origin/main — or, to keep census network-lean, compare against the fetch already implied by the gh calls / make the fetch conditional on a config knob).
- Cockpit: surface it on the loop-health panel (yellow at ≥1, like main_dirty).
- Optional follow-up (separate decision): a tick step that fast-forwards a CLEAN, on-main checkout automatically — extending merge-ready's local_sync to cover UI merges — so the signal is usually a no-op rather than a recurring chore.
Acceptance
- Census emits the line; loop-census.test.sh covers behind/at-par fixtures (stub the git plumbing).
- Cockpit shows the indicator.
- docs/USAGE.md notes the UI-merge staleness trap.
Context: 2026-07-24 incident diagnosis (issue #187's corrected root cause), [[event-driven-pr-loop]] operational notes.
🤖 Generated with Claude Code
Why
The daemon runs every tick script from the LOCAL main checkout's working tree. When main falls behind origin — which happens whenever PRs merge via the GitHub UI instead of merge-ready's local_sync — the daemon executes stale code and reasons from stale state. This starved the loop from 2026-07-21 to 2026-07-24: local main sat behind while merged census improvements (and everything else) never took effect, and every tick quietly recorded action=none. The failure was invisible: main_dirty said no, ticks looked healthy, nothing pointed at staleness.
Proposal
main_behind_origin=<n|no>(commits behind, viagit fetch origin main --quiet+rev-list --count main..origin/main— or, to keep census network-lean, compare against the fetch already implied by the gh calls / make the fetch conditional on a config knob).Acceptance
Context: 2026-07-24 incident diagnosis (issue #187's corrected root cause), [[event-driven-pr-loop]] operational notes.
🤖 Generated with Claude Code