Reboot survival for the Pi orchestrator host: - systemd unit cc-ci-plan/systemd/cc-ci-loops.service (installed + enabled): on boot records the reboot, starts loops+watchdog (RESUME_PHASE=1), and resumes the orchestrator session. - reboot-log.sh: boot_id-gated reboot record -> REBOOTS.md (manual restarts don't count). - launch-orchestrator.sh: injects an AGENTS.md startup nudge so an auto-resumed orchestrator announces itself (PushNotification) + reports reboots. - AGENTS.md: on-startup notify routine documented. Plans/tooling accumulated this session: - plan-phase1d (generic suite), 1e (harness corrections), phase4 (final review), sso-dep-testing, orchestrator-migration (parked), test-e2e-testme-acceptance. - launch.sh: 1d/1e/2/2b/3/4 phase sequence, machine-docs-aware state resolution, limit-stall re-nudge, INBOX side-channel detection. - plan.md §6.1/§7: artifact-layer isolation, INBOX, 5-min long-run polling, DEFERRED. - prompts: isolation discipline + INBOX + pacing. - .gitignore: harden (.sops/, cc-ci-secrets/, .claude/, *.tmp.*). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
1.0 KiB
Bash
Executable File
23 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs as ExecStartPre of cc-ci-loops.service. Appends ONE line to REBOOTS.md per genuine reboot.
|
|
# Uses the kernel boot_id to distinguish a real reboot from a mere `systemctl restart` of the unit:
|
|
# only logs when the current boot_id differs from the last one we recorded.
|
|
set -u
|
|
|
|
REBOOTS="/srv/cc-ci/cc-ci-plan/REBOOTS.md"
|
|
LAST_BOOT_FILE="/srv/cc-ci/.cc-ci-logs/.last-boot-id"
|
|
PHASE_IDX_FILE="/srv/cc-ci/.cc-ci-logs/.phase-idx"
|
|
|
|
cur_boot="$(cat /proc/sys/kernel/random/boot_id 2>/dev/null || echo unknown)"
|
|
last_boot="$(cat "$LAST_BOOT_FILE" 2>/dev/null || echo '')"
|
|
|
|
# Same boot_id => this is a manual service restart, not a reboot => do nothing.
|
|
[ "$cur_boot" = "$last_boot" ] && exit 0
|
|
|
|
idx="$(cat "$PHASE_IDX_FILE" 2>/dev/null || echo '?')"
|
|
ts="$(date '+%Y-%m-%d %H:%M:%S %Z')"
|
|
mkdir -p "$(dirname "$LAST_BOOT_FILE")"
|
|
printf '%s\n' "- $ts — reboot detected; loops auto-started by systemd (resuming phase index $idx). boot_id=$cur_boot" >> "$REBOOTS" 2>/dev/null || true
|
|
echo "$cur_boot" > "$LAST_BOOT_FILE" 2>/dev/null || true
|
|
exit 0
|