feat(autoheal): policy-driven repair classes via TOML (slice B) #78

Merged
pdurlej merged 1 commit from gemini/autoheal-slice-B into main 2026-06-08 20:00:14 +02:00
Collaborator

Authored by gemini (Gemini 3.1 Pro via Antigravity), Swarmheart worker under claude's arbitration. claude read the TOML loader + fail-safe paths line-by-line and verified every fail-closed invariant.

What

Auto-heal roadmap slice B: repair classes become operator-tunable via TOML instead of a hardcoded dict, so a new read-only class can be added without a code commit — while the hardcoded set stays as the canonical default + fallback. Applies the "hardcoded policy" weakness from the Opus 4.6 review.

patchwarden runtime-repair-check --evidence-file ... [--repair-policy-file policies/iskra-openclaw.v0.toml]

claude's review (every fail-closed invariant held)

  • Fallback: no --repair-policy-file (or no [repair_classes] section) → uses hardcoded REPAIR_CLASS_POLICIES. Existing callers unchanged.
  • Fail-safe parsing: malformed TOML, non-table section, non-list required_evidence, or non-bool mutationValueError (CLI exit 2). Never degrades into a permissive policy. This is the critical property for a security tool.
  • Mutation honored from TOML: a mutation = true class loaded from TOML still can NEVER reach eligible_repair_dry_run — the flag flows into RepairClassPolicy and the unchanged verdict logic gates it (needs_human at most).
  • Unknown class still blocked (unknown_repair_class).
  • Uses stdlib tomllib (same as policy_bundle.py) — no third-party toml/yaml.
  • 🔸 Design note (intentional): when [repair_classes] is present it is authoritative-replace, not merge — the operator's TOML is the full truth; a class omitted there becomes unknown→blocked (fail-closed). The shipped TOML reproduces all 5 current classes exactly (with a test asserting TOML-loaded == hardcoded).

Arbiter verification (claude)

  • PYTHONPATH=src python3 -m unittest discover tests220/220 OK (208 baseline + 12).
  • Tests: TOML load == hardcoded for the 5 classes; a new TOML-only read-only class works; a TOML mutation class can't reach eligible; malformed → ValueError; fallback when no file; unknown still blocked.
  • D20 boundary passes; no third-party deps; plan (slice A) + evidence handling untouched.

Files

policies/iskra-openclaw.v0.toml (+20, new [repair_classes]), src/patchwarden/runtime_repair.py (+32 loader), src/patchwarden/cli.py (+2 flag), tests/test_runtime_repair.py (+116).

Roadmap slice B (docs/operations/autoheal-roadmap.md). Refs #68, #70. Completes the A+B+D AGY-able trio; C (wire to iskra-openclaw) is the cross-repo codex next step.

> **Authored by gemini** (Gemini 3.1 Pro via Antigravity), Swarmheart worker under claude's arbitration. claude read the TOML loader + fail-safe paths line-by-line and verified every fail-closed invariant. ## What Auto-heal roadmap **slice B**: repair classes become **operator-tunable via TOML** instead of a hardcoded dict, so a new read-only class can be added without a code commit — while the hardcoded set stays as the canonical default + fallback. Applies the "hardcoded policy" weakness from the Opus 4.6 review. `patchwarden runtime-repair-check --evidence-file ... [--repair-policy-file policies/iskra-openclaw.v0.toml]` ## claude's review (every fail-closed invariant held) - ✅ **Fallback:** no `--repair-policy-file` (or no `[repair_classes]` section) → uses hardcoded `REPAIR_CLASS_POLICIES`. Existing callers unchanged. - ✅ **Fail-safe parsing:** malformed TOML, non-table section, non-list `required_evidence`, or non-bool `mutation` → **`ValueError`** (CLI exit 2). Never degrades into a permissive policy. This is the critical property for a security tool. - ✅ **Mutation honored from TOML:** a `mutation = true` class loaded from TOML still can NEVER reach `eligible_repair_dry_run` — the flag flows into `RepairClassPolicy` and the unchanged verdict logic gates it (`needs_human` at most). - ✅ **Unknown class still `blocked`** (`unknown_repair_class`). - ✅ Uses stdlib **`tomllib`** (same as `policy_bundle.py`) — no third-party toml/yaml. - 🔸 **Design note (intentional):** when `[repair_classes]` is present it is **authoritative-replace**, not merge — the operator's TOML is the full truth; a class omitted there becomes unknown→blocked (fail-closed). The shipped TOML reproduces all 5 current classes exactly (with a test asserting TOML-loaded == hardcoded). ## Arbiter verification (claude) - `PYTHONPATH=src python3 -m unittest discover tests` → **220/220 OK** (208 baseline + 12). - Tests: TOML load == hardcoded for the 5 classes; a new TOML-only read-only class works; a TOML mutation class can't reach eligible; malformed → ValueError; fallback when no file; unknown still blocked. - D20 boundary passes; no third-party deps; `plan` (slice A) + evidence handling untouched. ## Files `policies/iskra-openclaw.v0.toml` (+20, new `[repair_classes]`), `src/patchwarden/runtime_repair.py` (+32 loader), `src/patchwarden/cli.py` (+2 flag), `tests/test_runtime_repair.py` (+116). Roadmap slice B (`docs/operations/autoheal-roadmap.md`). Refs #68, #70. Completes the A+B+D AGY-able trio; C (wire to iskra-openclaw) is the cross-repo codex next step.
Added `[repair_classes]` section to `policies/iskra-openclaw.v0.toml` mirroring the current 5 classes exactly.
Added an optional `--repair-policy-file` flag to `runtime-repair-check` allowing `runtime_repair.py` to parse policies from TOML using standard library `tomllib`.
Maintained hardcoded `REPAIR_CLASS_POLICIES` as a fallback.
Preserved all fail-closed invariants: unknown classes stay blocked, `mutation=true` classes never reach eligible, and malformed TOML raises `ValueError`.
Final test count: 220.

Co-Authored-By: Gemini 3.1 Pro (Antigravity) <noreply@antigravity.google>
pdurlej deleted branch gemini/autoheal-slice-B 2026-06-08 20:00:15 +02:00
Sign in to join this conversation.
No reviewers
No labels
agent/claude-code
agent/codex
agent/gemini
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
area:business-model
area:competitive
area:discovery
area:forgejo
area:metrics
area:product-strategy
area:v0-core
cagan-grade-approved
client:platform
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
kind:artifact
kind:decision
kind:dogfood
kind:epic
kind:implementation
kind:research
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
priority:p0
priority:p1
priority:p2
priority:p3
ready-for-agent
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:blocked-on-discovery
status:cagan-grade-review-pending
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:needs-operator-decision
status:operator-needed
status:parked
tier:0-anchor
tier:0-platform-substrate
tier:1-core
tier:1-iskra-value-layer
tier:2-supporting
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
wave:1-foundation
wave:2-positioning
wave:3-validation
wave:4-economics
wave:5-operating
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pdurlej/patchwarden!78
No description provided.