feat(RMGR-WP-0003): production pilot dual-run config, bulk, push

Config file dual-run (env override), writeback_push, bulk-status facade
on State Hub, pilot example config, evidence and finished workplan.
This commit is contained in:
tegwick 2026-08-11 02:32:14 +02:00
parent a00a4264da
commit 5921b65c49
6 changed files with 324 additions and 55 deletions

View file

@ -1,50 +1,69 @@
# Dual-run flags (RMGR-WP-0002)
# Dual-run flags (RMGR-WP-0002 / 0003)
State Hub remains the MCP/REST entrypoint. When flags are on, **checkout
State Hub remains the MCP/REST entrypoint. When dual-run is on, **checkout
mutation** is executed by Repo Manager.
## Environment variables
## Config file (preferred for production pilot)
```bash
mkdir -p ~/.repo-manager
cp ~/repo-manager/config/dual-run.pilot.example.yaml ~/.repo-manager/dual-run.yaml
# edit pilot_repos / writeback_push as needed
```
```yaml
writeback: true
reconcile: true
writeback_push: false
pilot_repos:
- repo-manager
meter_path: ~/.repo-manager/mutation-meter.jsonl
```
Optional path override: `RM_DUAL_RUN_CONFIG=/path/to/dual-run.yaml`
**Restart State Hub API** after config changes so the process reloads
(settings are cached per process).
## Environment variables (override config when set)
| Variable | Meaning |
| --- | --- |
| `RM_WRITEBACK=1` | Task file writeback via `rmgr update-task-status` |
| `RM_RECONCILE=1` | `fix-consistency` also runs `rmgr reconcile` for pilots |
| `RM_PILOT_REPOS=repo-manager` | Comma-separated slugs; **unset** = all repos when flags on |
| `RM_METER_PATH` | JSONL meter path (default `~/.repo-manager/mutation-meter.jsonl`) |
| `REPO_MANAGER_SRC` | Optional path to `repo-manager/src` for SH adapter |
| `RMGR_BIN` | Optional override command prefix for `rmgr` |
| `RM_WRITEBACK_PUSH=1` | `git push` after RM writeback commit (best-effort) |
| `RM_PILOT_REPOS=slug1,slug2` | Restrict to slugs; **unset** = all when flags on |
| `RM_METER_PATH` | JSONL meter path |
| `REPO_MANAGER_SRC` | Path to `repo-manager/src` for SH adapter |
| `RMGR_BIN` | Override `rmgr` command |
## Rollback
```bash
unset RM_WRITEBACK RM_RECONCILE RM_PILOT_REPOS
# or
export RM_WRITEBACK=0 RM_RECONCILE=0
# config: set writeback/reconcile false, or:
rm ~/.repo-manager/dual-run.yaml
unset RM_WRITEBACK RM_RECONCILE RM_WRITEBACK_PUSH RM_PILOT_REPOS
# restart SH API
```
State Hub immediately uses native C-15 writeback again.
## Pilot (repo-manager)
```bash
export RM_WRITEBACK=1
export RM_RECONCILE=1
export RM_PILOT_REPOS=repo-manager
export REPO_MANAGER_SRC=$HOME/repo-manager/src
# From API host environment, PATCH a task or:
cd ~/repo-manager
rmgr update-task-status --path . --task-id <canonical-or-uuid> --status progress
cd ~/repo-manager && statehub fix-consistency
rmgr dual-run-status
```
## Meter
## Operator checks
```bash
rmgr dual-run-status
# or
wc -l ~/.repo-manager/mutation-meter.jsonl
grep repo-manager ~/.repo-manager/mutation-meter.jsonl | tail
# or inspect meter
tail -20 ~/.repo-manager/mutation-meter.jsonl
```
## Paths covered
| Entry | Dual-run when flagged |
| --- | --- |
| `PATCH /tasks/{id}` | RM writeback (+ optional push) |
| `POST /tasks/bulk-status-sync` | RM writeback per task |
| C-15 fix-consistency writeback | RM writeback, else native |
| fix-consistency fix_repo | RM reconcile for pilots |
## Pilot expand (STATE-WP-0079)
Add slugs to `pilot_repos`, restart SH, watch meter for `source=repo-manager`
writebacks. Expand only when failures are absent under normal agent load.

View file

@ -0,0 +1,26 @@
# RMGR-WP-0003 completion
**Date:** 2026-08-11
## Delivered
| Item | Location |
| --- | --- |
| Config-file dual-run | `dual_run.py` (RM + SH) |
| Example pilot config | `config/dual-run.pilot.example.yaml` |
| Bulk dual-run | SH `POST /tasks/bulk-status-sync` |
| writeback_push | config/env + facade |
| Runbook | `docs/dual-run.md` |
## Enable production pilot
```bash
mkdir -p ~/.repo-manager
cp ~/repo-manager/config/dual-run.pilot.example.yaml ~/.repo-manager/dual-run.yaml
# restart State Hub API process to load config
rmgr dual-run-status
```
## Expand for STATE-WP-0079
Edit `pilot_repos` list, restart SH, watch `~/.repo-manager/mutation-meter.jsonl`.