repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

Frame provider fallback as the ADW simplifier

1790b8684b22e5d03f8b38163b68c47e5b2e3287

HallucyGenie Agent <agent@hallucygenie.local> ·

SSH signature · not checked

Browse filesCompare with HEAD

A single provider outage exposed that the ADW still treats model families as fixed lanes, while the open ADW backlog points to the same failure mode: copied workflow logic and missing deterministic artifact checks.

The design records a provider matrix plus runner/reducer/reconciler shape instead of adding per-issue patches, so reviews, builders, and maintenance roles can share fallback and proof semantics.

Surface touched: docs/super/specs/2026-07-26-adw-provider-resilience-design.md.

Changed files (1)

+158 / −0 text lines

Diff layout

docs/super/specs/2026-07-26-adw-provider-resilience-design.md

Added
new file mode 100644

+158 / −0 text lines

1# ADW Provider Resilience Design
2
3## Decision
4
5ADW treats Claude and Codex as equal provider families. No role is owned by one provider forever: every role has a primary, a fallback, and optional multi-provider quorum rules.
6
7The goal is autarky: a weekly limit, auth expiry, provider outage, or no-verdict run must not stop issue triage, build, review, sweep, or merge gating when the other provider is healthy.
8
9## Scope
11In scope:
13- ADW GitHub workflows under `.github/workflows/`.
14- Role-to-provider routing for planner, surveyor, triager, builders, reviewers, security reviewer, sweeper, docs writer, dependency manager, release manager, pioneer, and adw-doctor.
15- Merge-gate semantics for provider fallback and multi-provider verdicts.
16- Documentation in `docs/plans/AGENTIC-DEVELOPMENT.md`.
18Out of scope:
20- New model providers beyond Claude and Codex.
21- Replacing GitHub Actions.
22- Changing CODEOWNERS, branch rulesets, or the human-owned spec gate.
23- Loosening security boundaries around secrets or fork PRs.
25## Architecture
27Add an ADW provider matrix as the single source for role routing. The matrix records each role's Claude runner, Codex runner, effort, mode, and whether it normally runs one provider or both.
29Workflows consume that matrix instead of hard-coding “Claude role” and “Codex role” as permanent ownership. Existing workflows may stay split if that is the smallest change, but their behavior must match the matrix.
31Role modes:
33- `single`: run the preferred provider; if it cannot produce the required artifact, run fallback.
34- `quorum`: run both providers when available; one healthy provider may satisfy the role during outage.
35- `advisory`: best-effort extra signal; never required for merge.
37## Role matrix
39| Role | Normal mode | Preferred | Fallback | Notes |
40|---|---|---|---|---|
41| planner | single | Claude fable | Codex sol | High-context planning; fallback must open/update the same issue/plan artifacts. |
42| surveyor | single | Claude fable | Codex sol | Opens at most one work-order per tick. |
43| triager | single | Codex luna | Claude opus | Cheap classification first, Claude fallback if Codex auth/limit fails. |
44| builder-ui | single | Claude opus | Codex terra | UI/UX issue labels route here, but fallback may still build. |
45| builder-backend | single | Codex terra | Claude opus | Backend issue labels route here, but fallback may still build. |
46| reviewer | quorum | Claude opus + Codex sol | either healthy provider | Correctness verdict is required; conflicting provider verdicts block. |
47| security-reviewer | quorum | Claude opus + Codex sol | either healthy provider | Security verdict is required; any high-risk verdict blocks. |
48| sweeper | single | Codex luna | Claude opus | Must keep queues moving even when one provider is down. |
49| docs-writer | single | Codex terra | Claude opus | Same artifact contract: doc PR or explicit no-op comment. |
50| dependency-manager | single | Codex terra | Claude opus | Same escalation rules for risky bumps. |
51| release-manager | single | Codex terra | Claude opus | Release still requires owner tag touchpoint. |
52| pioneer | single | Claude opus | Codex sol | Prototype evidence contract unchanged. |
53| adw-doctor | quorum | Codex sol + Claude fable | either healthy provider | Multi-provider preferred for systemic ADW fixes. |
55## Data flow
571. Workflow starts for an ADW role.
582. Deterministic setup mints the GitHub App token and prepares provider auth.
593. Primary provider runs with the role charter and exact artifact contract.
604. A probe checks the artifact, not just process exit:
61 - issue labels/comments for triage;
62 - branch + PR for build;
63 - verdict label + head-SHA marker comment for review;
64 - issue/PR/comment for sweeper and doctor;
65 - release artifact for release.
665. If the artifact is missing and fallback is configured, fallback runs once.
676. The final assert succeeds only when the required artifact exists for the current head/event.
69## Review and merge semantics
71`reviewer` and `security-reviewer` become provider-family-aware gates.
73Correctness review:
75- Claude pass alone may apply `reviewed` when Codex is unavailable.
76- Codex pass alone may apply `reviewed` when Claude is unavailable.
77- Any provider requesting changes applies or preserves `changes-requested`.
78- If providers disagree, `changes-requested` wins until a later run resolves it.
80Security review:
82- One healthy provider may apply `security-cleared`.
83- Any provider finding high risk applies `risk:high` and removes `security-cleared`.
84- `risk:high` remains sticky and owner-cleared only.
86Advisory comments may remain, but required verdict labels must come from provider-family-aware review workflows, not a forever-Claude path.
88## Error handling
90Provider failure classes that trigger fallback:
92- missing/expired auth;
93- weekly/monthly limit hit;
94- provider API outage;
95- action/CLI exits non-zero;
96- silent no-op: exit 0 but missing artifact;
97- timeout before artifact.
99Fallback does not trigger on a valid negative verdict. “Changes requested” and `risk:high` are successful artifacts, not provider failures.
101If both providers fail to produce the required artifact, the workflow fails loudly and leaves the existing deterministic gate red. Sweeper/adw-doctor then diagnose the stall.
103## Tests and validation
105Implementation must include cheap deterministic checks:
107- Matrix parsing/validation if stored as data.
108- Shell tests for provider-result reduction: primary pass, primary fail fallback pass, both fail, conflicting review verdicts, security high-risk wins.
109- Existing merge-gate label tests updated only if labels change.
110- Workflow grep/audit proving no mission-critical role has a single provider with no fallback path.
112Manual validation:
114- Simulate Claude unavailable and confirm Codex can satisfy at least triage/review.
115- Simulate Codex unavailable and confirm Claude can satisfy at least triage/review.
116- Simulate conflicting review results and confirm merge stays blocked.
118## ADW issue scan
120Scanned all GitHub issues whose title, body, or labels mention ADW, including closed incidents. The open ADW-relevant issues are:
122| Issue | Root cause | Design response |
123|---|---|---|
124| #127 | Separate Claude builder lane is unreachable and branch setup differs from Codex. | One builder contract with provider-selected execution; branch creation is deterministic and shared before the provider runs. |
125| #114 | Review action success is not proof of a review artifact. | Artifact assertions are mandatory; missing verdict/comment triggers fallback, then hard failure. |
126| #49 | Reviewers read PR-head `CLAUDE.md` as trusted instructions. | Provider runners pin trusted project instructions to base SHA while reviewing PR-head diff/files as untrusted input. |
127| #51 | Codex setup, docs wording, and revise routing drift across copied workflows. | Shared provider setup + provider matrix removes copy-paste and records the provider family that owns revisions. |
128| #56 | Owner GitHub interactions can fall into silent voids. | Add a documented coverage matrix; prefer one scheduled reconciler over new per-event workflows. |
129| #21 | Liveness cliff, revise thrash, and no post-merge recovery. | Bounded WIP with one alternate unblocked slice, per-PR revise counter, and post-merge red-CI revert PR path. |
130| #20 | Some event triggers are unproven. | Treat schedules/reconciliation as load-bearing; prototype only events that remain load-bearing. |
131| #17 | `merge-gate` is labels-only until real CI is required. | No hands-off auto-merge until `xtask check` is a required status beside `merge-gate`. |
132| #16 | Project v2 board driving is unproven. | Labels, issues, milestones remain source of truth; board stays disabled/best-effort until proven. |
133| #122 | Release workflow must stay thin and invoke `xtask release`. | Release-manager uses the same provider runner; release mechanics wait on #104/#120 and stay xtask-owned. |
135Closed ADW incidents cluster into the same roots: merge-gate jams (#39, #43, #58-#76, #84), stale labels (#94), label drift (#113), no-verdict recovery (#128/#129), stale CodeQL config (#116), auth/setup blockers (#13/#14/#32/#47), and wrong-signing diagnosis (#115). They argue for fewer moving pieces, not more per-incident patches.
137## Simplified ADW shape
139The minimal system is four boring layers:
1411. **State:** GitHub issues, labels, milestones, required checks. Project boards are mirrors only.
1422. **Runner:** one provider runner contract prepares trusted inputs, runs Claude or Codex, and proves the artifact.
1433. **Reducer:** deterministic shell logic reduces provider results into labels, comments, PRs, or failures.
1444. **Reconciler:** scheduled sweeper/doctor repairs missed events, stalled work, and provider outages.
146No role should own bespoke auth setup, branch setup, verdict probing, or provider fallback. If a workflow needs those, it calls the shared runner/reducer. New instant triggers are added only when schedule-based reconciliation cannot preserve correctness.
148## Rollout
1501. Add provider matrix, shared setup, and reducer helpers.
1512. Convert review/security first: base-pinned instructions, quorum/fallback, no-verdict assertions, conflict blocking.
1523. Convert builder into one shared branch/PR path with provider-selected execution.
1534. Convert triage, sweep, planner, surveyor, docs, deps, release, pioneer, and doctor to the same runner.
1545. Add ADW coverage matrix and liveness rules to `docs/plans/AGENTIC-DEVELOPMENT.md`.
1556. Keep auto-merge disabled until real CI is required with `merge-gate`.
1567. Leave Project v2 disabled as source of truth until #16 is proven.
158Each step must preserve current artifact contracts before adding new behavior.