fix(state-hub): STATE-WP-0063 T01/T02/T04 — restore local consistency sync

Point custodian-sync systemd units at /home/worsch/state-hub and uv run;
add infra/systemd templates and README interim guidance. Document T02
diagnosis (activity-core schedules fire; ops-bridge tunnel gaps cause State
Hub connection refused). T04 crontab path fixed locally; T03/T05 remain open.
This commit is contained in:
2026-06-21 18:06:34 +02:00
parent 661eb01e45
commit 1b33a27a56
4 changed files with 98 additions and 16 deletions

View File

@@ -17,9 +17,16 @@ The compose file is `infra/docker-compose.yml`. Copy `.env.example` to `.env` an
## Periodic Repo Sync — systemd user timer
The custodian sync timer runs `consistency_check.py --remote --all` every 15
minutes, keeping workplan file state in sync with the state-hub DB automatically
(belt-and-suspenders alongside the per-repo git post-commit hooks).
The **State Hub consistency sync** timer (legacy unit name `custodian-sync`)
runs `consistency_check.py --remote --all` every 15 minutes, keeping workplan
file state in sync with the state-hub DB automatically (belt-and-suspenders
alongside the per-repo git post-commit hooks).
> **Interim local runner (STATE-WP-0063):** units must target the standalone
> repo at `/home/worsch/state-hub` and invoke consistency via
> `/home/worsch/.local/bin/uv run python …`. The pre-extraction path
> `/home/worsch/the-custodian/state-hub` is obsolete. Scheduling moves to
> Railiance01 activity-core in `STATE-WP-0064`.
The all-repo remote sweep has two built-in load guards:
@@ -31,12 +38,22 @@ The all-repo remote sweep has two built-in load guards:
- Warn-only sweeps exit 0 in `--remote --all` mode so the systemd unit only
goes failed for hard consistency failures.
### Installed unit files
### Unit files
| File | Location |
|------|----------|
| `custodian-sync.service` | `~/.config/systemd/user/custodian-sync.service` |
| `custodian-sync.timer` | `~/.config/systemd/user/custodian-sync.timer` |
| File | Repo template | Installed copy |
|------|---------------|----------------|
| `custodian-sync.service` | `infra/systemd/custodian-sync.service` | `~/.config/systemd/user/custodian-sync.service` |
| `custodian-sync.timer` | `infra/systemd/custodian-sync.timer` | `~/.config/systemd/user/custodian-sync.timer` |
Install or refresh from the repo templates:
```bash
mkdir -p ~/.config/systemd/user
cp ~/state-hub/infra/systemd/custodian-sync.service ~/.config/systemd/user/
cp ~/state-hub/infra/systemd/custodian-sync.timer ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now custodian-sync.timer
```
### Management commands
@@ -74,7 +91,7 @@ If systemd is not available, fall back to crontab:
```bash
# Crontab fallback (run crontab -e and add):
*/15 * * * * curl -sf http://127.0.0.1:8000/state/health && cd ~/state-hub && .venv/bin/python scripts/consistency_check.py --remote --all >> /tmp/custodian-sync.log 2>&1
*/15 * * * * curl -sf http://127.0.0.1:8000/state/health && cd ~/state-hub && /home/worsch/.local/bin/uv run python scripts/consistency_check.py --remote --all >> /tmp/custodian-sync.log 2>&1
```
---