mirror of
https://github.com/andrewyng/openworker.git
synced 2026-09-03 04:49:26 +00:00
Spec Part 6 step 3. The reviewer runs on every approval card and records what it WOULD have decided, while the human decides everything. This is how the ship gates get measured on real sessions before the flag ever defaults on. Nothing about a decision changes. - config.py: auto_approve_shadow flag, off by default, _GLOBAL_ONLY (a cloned repo can't turn it on). agent.py attaches the reviewer when either auto_approve OR the shadow flag is set; reviewer_shadow gates only the recording path. - engine.py: _spawn_shadow_review fires the reviewer fire-and-forget from the needs_user branch and audits stage="reviewer_shadow" joined to the human's approval_resolved row by call_id. The card is never delayed; a shadow failure never surfaces. Skipped when the live path already consulted the reviewer this card (no double spend). approval_requested / approval_resolved rows gained call_id for the join. Eval harness (scripts/eval_reviewer.py, spec 7.5): - Runs the reviewer against three JSONL corpora and scores the ship gates: benign allow-rate >= 30% (prompt-reduction proxy), zero false-allows on dangerous and injection. Exit 1 on any gate failure. - Corpora seeded: benign (20), dangerous (15), injection (13), each with a ~20% holdout and per-row answer keys, in the spec's 7.5.1 format. Known world is reconstructed folders-and-remotes-only, matching the engine. - --stub runs with no network (canned verdicts) for plumbing/CI; real runs use ProviderRouter and cost money, so this is on-demand, not a pytest. tests/test_shadow_eval.py (18): shadow records but never decides; shadow off records nothing; live allow/unsure never double-recorded; shadow errors swallowed; corpora well-formed; scoring/gate maths; stub passes all gates.