feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141) - #191
Conversation
… observability (issue #141) Extends sync.sh with four report-only, offline, self-hosting-safe checks that close the genuine gaps in issue #141 left after #134's decision (stop vendoring, detect stale copies) was already implemented: (1) reads .claude/state/loop-runs.log to tell the operator whether a driver looks active or idle before they re-arm/restart the loop units, (2) verifies .env/GH_BOT_TOKEN presence (never the value) and the installed plugin version against the #136 release floor, printing the live bot-identity advisory for the agent to run via bot-gh.sh, (3) derives expected module:<name> + needs-human labels from the target's adapter and prints the exact bot-gh.sh create commands as advisories, and (4) detects whether worker-tools.jsonl/events.jsonl observability state exists, referencing issue #137 for the gap without attempting to fix it. Extends sync-managed-files.test.sh with offline coverage for every new check plus self-hosting quieting, and documents the paired live steps in SKILL.md. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…bient GATES_FILE (issue #141) Blocking review findings on the sync v2 offline checks: - sync.sh's deploy-lag last_ts parse was unguarded under set -euo pipefail — a loop-runs.log last line with no ts= token made grep exit 1 and pipefail abort the whole script before the "could not parse a ts=" fallback ever ran. Add the missing `|| true`, matching the sibling parses in the same function. - sync-managed-files.test.sh scenarios 12/12b/15 read the target's adapter via sync.sh's default $GATES_FILE resolution without pinning it to their own fixture, so an ambient GATES_FILE (e.g. the real self-hosted test gate exporting GATES_FILE=.claude/self/gates.json before running *.test.sh) leaked in and broke 4 checks. Pin GATES_FILE explicitly per fixture, same convention as gate.test.sh's write_gates_file/run_gate. Also folds in the non-blocking asks: explicit coverage for an above-floor plugin version and a malformed/missing version field in the environment check, and present-but-empty / present-with-activity coverage for events.jsonl (previously only worker-tools.jsonl was exercised beyond the absent case). Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141) (not yet reviewed) |
|
feat(sync): sync v2 — offline env/labels/observability/deploy-lag checks (closes #141) (not yet reviewed) |
…ger alone (issue #141) loop-daemon.sh only appends a loop-runs.log line AFTER a driver exits, so the ledger has zero signal for an in-flight driver -- a stale OR missing OR just- appended entry is equally consistent with a new driver running right now. check_deploy_lag's recent/old-ts branching claimed the opposite ("may still be ACTIVE" / "looks safe to re-arm/restart"), which is exactly backwards. All three branches now report the ledger state plainly and defer to an independent liveness check (systemctl --user status) instead of asserting a verdict the log can't actually support. Also strengthens the s12 "labels are advisory-only" test from a vacuous assertion into a real regression guard (stubs bot-gh.sh/gh both via PATH and via the literal ${CLAUDE_PLUGIN_ROOT}/scripts/bot-gh.sh path the advisory string itself uses), and adds version_ge differing-length-component coverage.
|
Stall-recovery update: this branch had partial work + an already-open PR with green CI, but no GitHub review yet. Ran both reviewer lenses (correctness, tests; consensus=all) fresh against the diff before publishing further. correctness caught a real bug: tests caught a vacuous assertion ( All 93 offline checks pass; build/lint/test gates green ( |
Closes #141
Extends
/orchestrator:syncinto "sync v2" — the sanctioned migration command — by adding four new offline, detect-and-report check functions tosync.sh, in the same defensive style as the existingdetect_stale_vendor_copies.sync.shstays fully offline/non-interactive/bare-runnable; anything needing the network is emitted as an advisory command and documented as an agent step inSKILL.md(live execution viabot-gh.sh).Added in this PR
.claude/state/loop-runs.logand reports whether the last driver run looks active vs idle, reinforcing "re-arm/restart ONLY between drivers"..env/GH_BOT_TOKEN=key presence (never prints the token value) + installed plugin version vs. the0.2.2(Release 0.2.2 — published plugin cache lacks the #131 driver working-directory fix #136 release) floor; prints the livebot-gh.sh api useradvisory.module:<name>(from the target adapter'smodules[]) +needs-humanand prints exactbot-gh.sh label createadvisory commands, matching the setup skill's pattern; quiets in self-hosting mode..claude/state/worker-tools.jsonl/events.jsonlexist / have activity, surfacing the gap tracked by Ship the worker tool-mirror hook in hooks/hooks.json — cockpit live-workers panel is reCode-only #137 — detection only, does not fix Ship the worker tool-mirror hook in hooks/hooks.json — cockpit live-workers panel is reCode-only #137.SKILL.md: Flow section documents the new verdict lines; a new "live steps the agent performs" subsection covers the bot-identity + label create-missing steps viabot-gh.sh.sync-managed-files.test.sh: +19 offline checks (87 total) covering each new check's positive/negative paths, plugin-version at/above/below/malformed/missing, observability absent/empty/active, deploy-lag active/idle/unparseable-ts, token-value-never-leaked, and self-hosting quieting.Already covered by prior #134 work (verified, NOT rewritten)
"Do" items 1 & 5's core: managed-file re-stamp ladder,
detect_stale_vendor_copies, and the systemd-restart migration caveat were already implemented. This PR only added the genuinely-missing loop-runs.log inspection on top.Out of scope (deliberately)
Verification
GATES_FILE=.claude/self/gates.json bash .claude/self/checks.sh test→ PASS (all 87 checks passed,test: harness smoke OK). build + lint gates green. Both review lenses (correctness, tests; consensus=all) APPROVE.🤖 Generated with Claude Code