Layered polish on top of 593d142f (Tier 2 deterministic dispatchers)
plus the systemd-supervised launcher that realises the SystemExit(2)
restart contract in production.
Code:
- Promote `_opencode_worker.list_sessions(server_url)` to public so the
coexistence guard no longer reaches into private `_request`.
- `assert_no_legacy_supervisor` truncates with `(showing first N)` and
takes `Iterable[str]` for supervisor_tags.
- Collapse `_sanitize_release_detail` to a single `str.replace()`
(substitute has no backticks; second pass was always a no-op).
- Telemetry `_api_cycles` routes through a single `_DISPATCH_TABLES`
dict so the rows query and breakdown query can never drift onto
different tables.
- `dispatch_one` docstring now lists `labels-fetch-failed` alongside
the other terminal states.
- `_loader.load_sibling` raises `ImportError` up front for a missing
file (was bubbling `FileNotFoundError` from `exec_module`).
Operations:
- `scripts/dispatchers-launcher.sh` supervises both dispatchers in one
process, restarts on non-zero exit with backoff, enforces a
per-child crash-loop budget, and forwards SIGTERM cleanly.
- `contrib/systemd/cleveragents-dispatchers.service` wires that into a
systemd unit with hardening defaults and journalctl visibility.
Tests (350 pass, 1 skipped):
- New `tests/auto_agents/test_loader.py` (4 cases).
- New `tests/auto_agents/test_telemetry_server.py` (5 synthetic-row
cases covering both tables, composite breakdown, unknown driver,
table isolation).
- Extended `test_dispatch_runtime.py` with truncation-suffix and
`list_sessions` direct tests; refit existing supervisor-guard tests
to monkeypatch the public helper.
Docs:
- AGENTS.md cross-links the launcher / systemd unit.
- CHANGELOG.md entry under [Unreleased] dated 2026-05-07.
Co-authored-by: Cursor <cursoragent@cursor.com>
systemd units (contrib)
Operator-facing systemd unit files for production deployments of the deterministic pipeline.
cleveragents-dispatchers.service
Supervises scripts/dispatchers-launcher.sh,
which in turn runs the two Tier 2 deterministic dispatchers
(tools/dispatch_review.py and tools/dispatch_implementer.py) and
restarts each child on non-zero exit (including
SystemExit(2) from run_outer_loop when the cycle-failure budget
is exhausted).
Install:
sudo cp contrib/systemd/cleveragents-dispatchers.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now cleveragents-dispatchers
journalctl -u cleveragents-dispatchers -f
Edit WorkingDirectory, EnvironmentFile, and the inline
Environment= block in the unit before installing — the file
shipped here points at /opt/cleveragents-core and uses placeholder
credentials.
The launcher itself enforces crash-loop limits
(DISPATCHERS_RESTART_LIMIT, default 5 within
DISPATCHERS_RESTART_LIMIT_WINDOW_S, default 300 s) so a wedged
dispatcher does not pin a CPU; once that budget is exhausted the
unit transitions to failed and systemctl status will surface the
problem to the operator.