From 72497227af8b050e4edf46c4725a1ee82944ad04 Mon Sep 17 00:00:00 2001 From: Holon Intent Agent Date: Tue, 1 Dec 2026 12:50:31 +0000 Subject: [PATCH 01/11] intent: created I-1796129423-stage5-no-approval-refusal/_ Description: Stage 5 still calibrates a branch that has no recorded Stage 4 approval: the merged-head gate in flow/review_restart.py logs 'Merged-head CI gate skipped: no Stage 4 approval recorded' and lets calibration, the calibration commit and the push proceed, so an unreviewed run can end with a successful calibrate stage. The start-of-run guard for a resume at the calibrate stage is already on main; this pass-through inside the stage is the remaining hole. Goal: Remove the silent pass-through so Stage 5 fails closed inside the stage when no Stage 4 approval is recorded. In apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py, _skip_reason returns "no Stage 4 approval recorded" when approved_head_of(context) is empty and stage5_merged_head_gate then returns (None, skipped record), which lets run_calibrate_stage calibrate. New behaviour: when the run is not a dry run, not skip_push and has an execution branch, and no approved head is recorded, stage5_merged_head_gate returns a failed CALIBRATE StageResult built through the existing stage-failure path (the one refuse_calibration uses), whose error says that no Stage 4 approval is recorded and that nothing was calibrated or pushed and names the resume advice (review first), together with a gate record whose reason is "no Stage 4 approval recorded" and whose state is not "skipped"; the string "Merged-head CI gate skipped: no Stage 4 approval recorded" is no longer logged anywhere. The refusal is built inside flow/review_restart.py with its own message; flow/review/merged_head_routing.py and flow/review/merged_head_gate.py are not changed (gate_record is reused as it is). Unchanged: the resumed-restart branch that runs first (a withdrawal or scoped restart still re-enters Stage 4), and the dry run, skip_push and no-execution-branch cases, which keep today's skipped record. Callers need no change because each already returns or raises on a stopped result: run_calibrate_stage in flow/stages/calibrate.py and the two call sites in flow/calibrate_target_sync.py; the standalone calibrate command does not pass through this gate. Decision for the Stage 4 calibration-freshness rerun in apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py (review_calibration_freshness reruns Stage 5 through run_calibrate_stage after a head move): with no approved consensus recorded the rerun is now refused like any other Stage 5 run, is recorded through the existing failed-rerun outcome (rerun_status failed, rerun_error set) and posts the existing stale-report warning instead of a refreshed report; change calibrate_rerun.py only if that existing failure path does not already produce this, and never let the freshness gate raise. Tests: apps/sandbox-executor/tests/test_merged_head_ci_gate.py replaces test_no_recorded_approval_keeps_todays_path with a test asserting the refusal; the existing tests that run Stage 5 with a context that has no recorded approval (53 tests in 11 files, listed in the assumptions) get an approved review result whose consensus target_commit is the execution head under test, through one shared helper in apps/sandbox-executor/tests/calibrate_scenarios.py where that removes repetition; in apps/sandbox-executor/tests/test_calibrate_rerun.py the test test_the_review_gate_posts_the_refreshed_comment_without_an_approved_consensus is changed to assert the refusal and the stale warning. apps/sandbox-executor/tests/flow/test_pipeline.py is 935 lines, apps/sandbox-executor/tests/test_calibrate_rerun.py is 944 lines and apps/sandbox-executor/tests/flow/review/test_sync_points.py is 851 lines: no new test function is added to them and each stays under 1,000 lines; every new test goes into apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py (new). apps/sandbox-executor/tests/test_review_restart.py and apps/sandbox-executor/tests/test_calibrate_staleness.py are the direct tests of the two source modules; they pass unchanged under the measured prototype and are edited only if the final change requires it. No documentation describes the pass-through, so no documentation file is changed. Never modify holon-config/hygiene/module_budgets.json and keep every module within its existing budget. Code is self-explaining: no docstrings and no comments except '# why:' comments that record a reason the code cannot show. Generated by Holon Intent Agent at 2026-12-01T12:50:31Z --- .../intents/I-1796129423-stage5-no-approval-refusal.jsonl | 1 + 1 file changed, 1 insertion(+) create mode 100644 holon-knowledge/ledger/pending/intents/I-1796129423-stage5-no-approval-refusal.jsonl diff --git a/holon-knowledge/ledger/pending/intents/I-1796129423-stage5-no-approval-refusal.jsonl b/holon-knowledge/ledger/pending/intents/I-1796129423-stage5-no-approval-refusal.jsonl new file mode 100644 index 000000000..cf344a225 --- /dev/null +++ b/holon-knowledge/ledger/pending/intents/I-1796129423-stage5-no-approval-refusal.jsonl @@ -0,0 +1 @@ +{"slug": "stage5-no-approval-refusal", "target_branch": "main", "description": "Stage 5 still calibrates a branch that has no recorded Stage 4 approval: the merged-head gate in flow/review_restart.py logs 'Merged-head CI gate skipped: no Stage 4 approval recorded' and lets calibration, the calibration commit and the push proceed, so an unreviewed run can end with a successful calibrate stage. The start-of-run guard for a resume at the calibrate stage is already on main; this pass-through inside the stage is the remaining hole.", "goal": "Remove the silent pass-through so Stage 5 fails closed inside the stage when no Stage 4 approval is recorded. In apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py, _skip_reason returns \"no Stage 4 approval recorded\" when approved_head_of(context) is empty and stage5_merged_head_gate then returns (None, skipped record), which lets run_calibrate_stage calibrate. New behaviour: when the run is not a dry run, not skip_push and has an execution branch, and no approved head is recorded, stage5_merged_head_gate returns a failed CALIBRATE StageResult built through the existing stage-failure path (the one refuse_calibration uses), whose error says that no Stage 4 approval is recorded and that nothing was calibrated or pushed and names the resume advice (review first), together with a gate record whose reason is \"no Stage 4 approval recorded\" and whose state is not \"skipped\"; the string \"Merged-head CI gate skipped: no Stage 4 approval recorded\" is no longer logged anywhere. The refusal is built inside flow/review_restart.py with its own message; flow/review/merged_head_routing.py and flow/review/merged_head_gate.py are not changed (gate_record is reused as it is). Unchanged: the resumed-restart branch that runs first (a withdrawal or scoped restart still re-enters Stage 4), and the dry run, skip_push and no-execution-branch cases, which keep today's skipped record. Callers need no change because each already returns or raises on a stopped result: run_calibrate_stage in flow/stages/calibrate.py and the two call sites in flow/calibrate_target_sync.py; the standalone calibrate command does not pass through this gate. Decision for the Stage 4 calibration-freshness rerun in apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py (review_calibration_freshness reruns Stage 5 through run_calibrate_stage after a head move): with no approved consensus recorded the rerun is now refused like any other Stage 5 run, is recorded through the existing failed-rerun outcome (rerun_status failed, rerun_error set) and posts the existing stale-report warning instead of a refreshed report; change calibrate_rerun.py only if that existing failure path does not already produce this, and never let the freshness gate raise. Tests: apps/sandbox-executor/tests/test_merged_head_ci_gate.py replaces test_no_recorded_approval_keeps_todays_path with a test asserting the refusal; the existing tests that run Stage 5 with a context that has no recorded approval (53 tests in 11 files, listed in the assumptions) get an approved review result whose consensus target_commit is the execution head under test, through one shared helper in apps/sandbox-executor/tests/calibrate_scenarios.py where that removes repetition; in apps/sandbox-executor/tests/test_calibrate_rerun.py the test test_the_review_gate_posts_the_refreshed_comment_without_an_approved_consensus is changed to assert the refusal and the stale warning. apps/sandbox-executor/tests/flow/test_pipeline.py is 935 lines, apps/sandbox-executor/tests/test_calibrate_rerun.py is 944 lines and apps/sandbox-executor/tests/flow/review/test_sync_points.py is 851 lines: no new test function is added to them and each stays under 1,000 lines; every new test goes into apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py (new). apps/sandbox-executor/tests/test_review_restart.py and apps/sandbox-executor/tests/test_calibrate_staleness.py are the direct tests of the two source modules; they pass unchanged under the measured prototype and are edited only if the final change requires it. No documentation describes the pass-through, so no documentation file is changed. Never modify holon-config/hygiene/module_budgets.json and keep every module within its existing budget. Code is self-explaining: no docstrings and no comments except '# why:' comments that record a reason the code cannot show.", "rationale": "A calibrated branch is read as a finished, reviewed change; a stage that can succeed without a recorded approval makes that reading unsafe, and a guard only at the start of a resume leaves every other way into the stage open.", "scope": ["apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py", "apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py", "apps/sandbox-executor/tests/flow/review/test_conflict_gate.py", "apps/sandbox-executor/tests/test_calibrate_final_head_ci.py", "apps/sandbox-executor/tests/flow/test_pipeline.py", "apps/sandbox-executor/tests/test_merged_head_ci_gate.py", "apps/sandbox-executor/tests/flow/review/test_sync_points.py", "apps/sandbox-executor/tests/test_ledger_append_only.py", "apps/sandbox-executor/tests/test_calibrate_rebuild.py", "apps/sandbox-executor/tests/test_calibrate_sync.py", "apps/sandbox-executor/tests/test_calibration_commit.py", "apps/sandbox-executor/tests/flow/test_git_refs.py", "apps/sandbox-executor/tests/test_calibrate_rerun.py", "apps/sandbox-executor/tests/test_review_restart.py", "apps/sandbox-executor/tests/test_calibrate_staleness.py", "apps/sandbox-executor/tests/calibrate_scenarios.py", "apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py (new)"], "acceptance_criteria": ["Stage 5 removes the silent `\"Merged-head CI gate skipped: no Stage 4 approval recorded\"` pass-through so unreviewed or unexecuted runs cannot exit `0`.", "With no recorded Stage 4 approval (not a dry run, not skip_push, execution branch present) stage5_merged_head_gate returns a failed calibrate stage result whose error names the missing approval; run_calibrate_stage then runs no calibration, creates no calibration commit and pushes nothing, asserted in apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py (new).", "Dry run, skip_push and a missing execution branch keep the skipped gate record and today's behaviour, and a pending withdrawal or scoped restart still re-enters Stage 4 first (existing tests keep passing unchanged).", "The Stage 4 calibration-freshness rerun with no approved consensus records a failed rerun and posts the stale-report warning, never a refreshed report, and the freshness gate never raises (test asserts it).", "A run with a recorded approval whose approved commit equals the execution head calibrates exactly as before: the previously passing Stage 5 tests pass again with only their context fixtures changed to record that approval.", "No source or test asserts or logs the text 'Merged-head CI gate skipped: no Stage 4 approval recorded' any more (grep over apps/sandbox-executor is empty).", "`uv run task lint` and `uv run pytest` pass; no existing test file exceeds 1,000 lines; holon-config/hygiene/module_budgets.json is untouched and every changed module stays within its budget.", "Changes are confined to these files and no others: apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py, apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py, apps/sandbox-executor/tests/flow/review/test_conflict_gate.py, apps/sandbox-executor/tests/test_calibrate_final_head_ci.py, apps/sandbox-executor/tests/flow/test_pipeline.py, apps/sandbox-executor/tests/test_merged_head_ci_gate.py, apps/sandbox-executor/tests/flow/review/test_sync_points.py, apps/sandbox-executor/tests/test_ledger_append_only.py, apps/sandbox-executor/tests/test_calibrate_rebuild.py, apps/sandbox-executor/tests/test_calibrate_sync.py, apps/sandbox-executor/tests/test_calibration_commit.py, apps/sandbox-executor/tests/flow/test_git_refs.py, apps/sandbox-executor/tests/test_calibrate_rerun.py, apps/sandbox-executor/tests/test_review_restart.py, apps/sandbox-executor/tests/test_calibrate_staleness.py, apps/sandbox-executor/tests/calibrate_scenarios.py, apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py.", "Code is self-explaining: no docstrings and no comments except '# why:' comments."], "assumptions": [{"id": "A1", "statement": "The pass-through has exactly one source site and one test assertion. TESTED NOW on origin/main 4f46380e5 by grep for 'no Stage 4 approval' over src, tests, scripts and docs: flow/review_restart.py line 57 and tests/test_merged_head_ci_gate.py line 334 only. Re-tested in Stage 4 by the same grep on the diff.", "impact": "low"}, {"id": "A2", "statement": "Refusing instead of skipping breaks exactly the tests that run Stage 5 without a recorded approval, and all of them are in scope. TESTED NOW: flow/review_restart.py was temporarily patched to return refuse_calibration for a missing approval and `uv run task test` was run on commit d70cb8759: 10950 passed, 27 failed, 26 errors, in 11 files: tests/test_calibrate_rerun.py (26, all fixture errors from one calibrated-template helper), test_calibrate_rebuild.py (7), test_calibrate_sync.py (4), flow/test_pipeline.py (4), test_calibrate_final_head_ci.py (3), flow/review/test_conflict_gate.py (2), flow/review/test_sync_points.py (2), test_ledger_append_only.py (2), test_calibration_commit.py (1), flow/test_git_refs.py (1) and test_merged_head_ci_gate.py (1); the patch was reverted. The two merges since that commit touch none of these files (git diff --name-only d70cb8759 4f46380e5). Re-tested in Stage 3 by the full suite; any further failing file found there is a stop-and-report, not a silent widening.", "impact": "high"}, {"id": "A3", "statement": "Recording an approval at the execution head is enough to restore those tests. TESTED NOW: with the same patch, the shared run_stage helper of tests/test_calibrate_sync.py was given an approved review result whose target_commit is the origin execution head; tests/test_calibrate_sync.py and tests/test_calibrate_rebuild.py then gave 35 passed, 1 failed (test_missing_origin_branch_proceeds_from_local_ref, only because the experimental helper read the missing origin ref; it needs the local execution head instead). Both edits were reverted. Tests whose point is a head that moved after the approval need the approval at the head they expect to be covered. Re-tested in Stage 3 file by file.", "impact": "medium"}, {"id": "A4", "statement": "Every caller of stage5_merged_head_gate already stops on a returned stage result. TESTED NOW by reading flow/stages/calibrate.py lines 100-106 (returns stopped) and flow/calibrate_target_sync.py lines 143-166 (returns stopped, or raises the restart-required error); run_calibrate_stage is called only from flow/pipeline.py and flow/calibrate_rerun.py, and the standalone calibrate command does not call it (grep). Re-tested in Stage 3 by the new refusal test asserting no calibration call and no push.", "impact": "medium"}, {"id": "A5", "statement": "The freshness rerun already handles a failed Stage 5 result without raising. TESTED NOW by reading flow/calibrate_rerun.py _rerun_while_stale (a FAILED result returns with the stale warning), _stale_gate_record (records rerun_status and rerun_error) and review_calibration_freshness (catches every exception); tests/test_calibrate_rerun.py already has test_the_review_gate_records_a_failed_rerun_outcome. Re-tested in Stage 3 by the changed without-an-approved-consensus test.", "impact": "medium"}, {"id": "A6", "statement": "The existing tests of every in-scope module pass on origin/main 4f46380e5 before the change. TESTED NOW from the repository root of a scratch detached worktree: `uv run pytest -n 8 -p no:cacheprovider -q` over tests/flow/review/test_conflict_gate.py, test_calibrate_final_head_ci.py, flow/test_pipeline.py, test_merged_head_ci_gate.py, flow/review/test_sync_points.py, test_ledger_append_only.py, test_calibrate_rebuild.py, test_calibrate_sync.py, test_calibration_commit.py, flow/test_git_refs.py, test_calibrate_rerun.py, test_review_restart.py and flow/test_stage5_fail_closed.py (all under apps/sandbox-executor/tests): 423 passed. `python scripts/check_module_budgets.py` (435 modules) and `python scripts/check_self_explaining.py` also pass on that commit.", "impact": "low"}, {"id": "A7", "statement": "In a normal full run the review stage result with its approved commit is recorded in the flow context before Stage 5 starts, so the refusal never fires on a reviewed run. TESTED NOW by reading flow/github/ci_reverify.py approved_head_of (consensus approved plus a concrete target_commit) and flow_guard.py (the start-of-run guard for a resume at calibrate requires the same record). Re-tested in Stage 3 by the unchanged pipeline tests that run review then calibrate, and at Stage 5 of this change's own flow.", "impact": "high"}, {"id": "A8", "statement": "The scope is disjoint from the only open pull request (464) and from the sibling change that formats execution notes (entrypoint/executor/outcome.py, entrypoint/review_loop.py, plan_artifact_format.py, docs/review_consensus.md and their tests). TESTED NOW by a script comparing this scope with `gh pr diff 464 --name-only`, with that flow's intent scope and plan touch set, and with the sibling scope: zero common files. tests/test_calibration_commit.py and tests/test_ledger_append_only.py are in this scope only; the sibling change was measured not to need them. Re-tested at launch by repeating the comparison.", "impact": "medium"}, {"id": "A9", "statement": "The files have room: flow/review_restart.py is 165 lines and flow/calibrate_rerun.py 218 (default 350); tests/calibrate_scenarios.py is 327 lines; the two test files above 900 lines (flow/test_pipeline.py 935, test_calibrate_rerun.py 944) need only fixture edits of a few lines each. TESTED NOW by wc -l on origin/main 4f46380e5; re-tested in Stage 3 by wc -l and `python scripts/check_module_budgets.py`.", "impact": "low"}, {"id": "A10", "statement": "No documentation states that Stage 5 proceeds without an approval, so removing the pass-through makes no document false. TESTED NOW by grep of docs, README.md, scripts and holon-config for 'no Stage 4 approval' and 'Merged-head CI gate skipped' (no match in documentation). Checked again by the Stage 4 reviewers; a documentation request there is recorded as follow-up because docs/review_consensus.md is held by the sibling change.", "impact": "low"}], "assumption_validation": [{"assumption_id": "A1", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A2", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A3", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A4", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A5", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A6", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A7", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A8", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A9", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}, {"assumption_id": "A10", "method": "Already run before launch with the result recorded in the assumption statement; re-run in Stage 3 with the pytest, module budget and self-explaining commands named there, and checked again by the Stage 4 reviewers against the diff."}], "assumption_risk": [{"assumption_id": "A1", "likelihood": "low", "testability": "testable", "score": 1, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A2", "likelihood": "medium", "testability": "testable", "score": 2, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A3", "likelihood": "medium", "testability": "testable", "score": 2, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A4", "likelihood": "low", "testability": "testable", "score": 1, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A5", "likelihood": "medium", "testability": "testable", "score": 2, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A6", "likelihood": "low", "testability": "testable", "score": 1, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A7", "likelihood": "low", "testability": "testable", "score": 1, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A8", "likelihood": "medium", "testability": "testable", "score": 2, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A9", "likelihood": "medium", "testability": "testable", "score": 2, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}, {"assumption_id": "A10", "likelihood": "medium", "testability": "testable", "score": 2, "response": "fail fast in the named Stage 3 test; park and re-scope before Stage 4 if the check shows an out-of-scope file"}], "branch": "I-1796129423-stage5-no-approval-refusal", "status": "proposed", "created_at": "2026-12-01T12:50:31.634Z"} From 5c3f1352f2f213a850f07cff0149ffb8115ba162 Mon Sep 17 00:00:00 2001 From: Holon Planner Agent Date: Tue, 1 Dec 2026 12:53:05 +0000 Subject: [PATCH 02/11] plan: P-1796129447-CLA-CO5.5 created by claude-agent (claude-opus-5-5) --- ...796129423-stage5-no-approval-refusal.jsonl | 1 + .../P-1796129447-CLA-CO5.5.md | 697 ++++++++++++++++++ 2 files changed, 698 insertions(+) create mode 100644 holon-knowledge/ledger/pending/plans/I-1796129423-stage5-no-approval-refusal.jsonl create mode 100644 plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5.md diff --git a/holon-knowledge/ledger/pending/plans/I-1796129423-stage5-no-approval-refusal.jsonl b/holon-knowledge/ledger/pending/plans/I-1796129423-stage5-no-approval-refusal.jsonl new file mode 100644 index 000000000..737a71774 --- /dev/null +++ b/holon-knowledge/ledger/pending/plans/I-1796129423-stage5-no-approval-refusal.jsonl @@ -0,0 +1 @@ +{"plan_id": "P-1796129447-CLA-CO5.5", "intent_branch": "I-1796129423-stage5-no-approval-refusal/_", "agent": "claude-agent", "agent_version": "2.1.302", "model": "claude-opus-5-5", "p_success": 0.84, "entropy": 6.6, "impact": 72.0, "cost": 14.0, "learning_value": 4.0, "ev": 46.5, "created_at": "2026-12-01T12:53:02.723Z", "plan_file": "plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5.md", "status": "proposed", "entropy_budget": 15.0, "decomposition_decision": "execute", "touch_set": [{"path": "apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py"}, {"path": "apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py"}, {"path": "apps/sandbox-executor/tests/calibrate_scenarios.py"}, {"path": "apps/sandbox-executor/tests/test_merged_head_ci_gate.py"}, {"path": "apps/sandbox-executor/tests/test_calibrate_rerun.py"}, {"path": "apps/sandbox-executor/tests/test_calibrate_rebuild.py"}, {"path": "apps/sandbox-executor/tests/test_calibrate_sync.py"}, {"path": "apps/sandbox-executor/tests/test_calibrate_final_head_ci.py"}, {"path": "apps/sandbox-executor/tests/test_calibration_commit.py"}, {"path": "apps/sandbox-executor/tests/test_ledger_append_only.py"}, {"path": "apps/sandbox-executor/tests/test_review_restart.py"}, {"path": "apps/sandbox-executor/tests/test_calibrate_staleness.py"}, {"path": "apps/sandbox-executor/tests/flow/test_pipeline.py"}, {"path": "apps/sandbox-executor/tests/flow/test_git_refs.py"}, {"path": "apps/sandbox-executor/tests/flow/review/test_conflict_gate.py"}, {"path": "apps/sandbox-executor/tests/flow/review/test_sync_points.py"}, {"path": "apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py"}]} diff --git a/plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5.md b/plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5.md new file mode 100644 index 000000000..2f3a5dad7 --- /dev/null +++ b/plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5.md @@ -0,0 +1,697 @@ +# Plan for I-1796129423-stage5-no-approval-refusal + +- **Plan ID:** P-1796129447-CLA-CO5.5 +- **Parent Intent ID:** NONE +- **Agent:** claude-agent/claude-opus-5-5 (version: 2.1.302) +- **Created At:** 2026-12-01T12:50:48.331Z + +## Planner Autonomy Summary + +- **Intent handling:** ACCEPT_AS_IS +- **Reframed intent (if applicable):** N/A +- **Exploration stance:** conservative. The intent was already prototyped by the author: the failing set was measured + (A2) and the fixture repair was shown to restore the tests (A3). One small exploratory check remains: whether the + existing failed-rerun path in `calibrate_rerun.py` already gives the decided freshness behaviour with no code change + (A5). +- **Safety priority level:** elevated +- **Priority Justification:** The change touches the gate that decides whether Stage 5 can calibrate and push. This is + the fail-closed boundary behind `docs/safety.md` "Human review is the final gate" and Invariant 4 (Human review). A + mistake in either direction is costly: a wrong refusal would block every reviewed run, and a missed refusal would let + an unreviewed branch calibrate. The direct code change is small, so the level is elevated rather than critical. + +## Exploration + +- **Proportion of steps that are exploratory:** 0.14 (1 of 7 steps) +- **Justification:** The author has already measured most of the uncertainty. The one step left open (Step 4) decides + whether `calibrate_rerun.py` stays unchanged. It costs little and sets the size of the source diff. + +## Overall Plan Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.84 | +| entropy_pred | 6.6 | +| impact_pred | 72.0 | +| cost_pred | 14.0 | +| learning_value_pred | 4.0 | +| ev_pred | 46.5 | + +### Strategy Rationale + +The intent is narrow and well measured. It needs one source change in `flow/review_restart.py`, an optional change in +`flow/calibrate_rerun.py` that is expected to be unnecessary, and fixture changes in 11 test files that today reach +Stage 5 with no recorded approval. The pass-through exists only because `_skip_reason` handles a missing approval the +same way as dry run, skip_push and a missing execution branch. The fix moves the missing-approval case out of the skip +path and into a refusal built with `_stage_failure`, the same helper `refuse_calibration` uses. All callers already stop +on a returned stage result (A4). + +The plan is run as a single plan with no sub-intents. The source change and the fixture repair have to land together: +either half alone leaves the suite red or the hole open. + +Aggregation: + +- `p_success` is limited by Step 3 (fixture repair across 11 files, 0.86). Step 2 and Step 6 are about 0.93 to 0.95. + Treating the risks as partly correlated gives about 0.84. +- Entropy is the sum of the step entropies: `0.2 + 1.2 + 2.6 + 0.6 + 0.8 + 0.8 + 0.4 = 6.6`. +- Impact is a qualitative judgement. This closes a real safety hole in the Stage 5 boundary but changes no feature: 72. +- Cost is the sum of the step costs: `0.5 + 2.0 + 6.0 + 1.0 + 2.0 + 2.0 + 0.5 = 14.0`. +- `EV = P(success) * Impact + mu * LearningValue - lambda * Delta_S - Cost` + `= 0.84 * 72.0 + 0.5 * 4.0 - 0.3 * 6.6 - 14.0 = 60.48 + 2.0 - 1.98 - 14.0 = 46.5`. + +The main assumption is A7: in a normal full run, `stage_results["review"]` holds an approved consensus with a concrete +`target_commit` before Stage 5 runs. If that were false, every real run would be refused. The unchanged pipeline tests +in Step 6 cover it. + +## Safety & Constraint Alignment + +- **Key world ruleset constraints that affect this plan:** + - `docs/safety.md` section 5 and Invariant 4: human review is the final gate. Stage 5 must not produce a successful + calibration without a recorded review approval. + - `docs/safety.md` Invariant 1 (Git discipline): this work goes on the intent branch only. No pushes to `main`. + - `holon-config/world/constraints.md` section 1 (Git Flow and Branch Constraints) and section 3 (Ledger Immutability): + no change to ledger rows. Test fixtures only build throwaway repositories. + - `holon-config/world/ruleset.md` section 2 (Coding Conventions): self-explaining code with only `# why:` comments, + ruff complexity limits, and the module budgets in `holon-config/hygiene/module_budgets.json`, which are frozen and + not in the touch set. + - `holon-config/world/ruleset.md` section 3 (Testing Constraints): tests are hermetic. Affected tests run first, then + the full suite once, in the foreground. +- **Potential violations or edge cases:** + - Refusing on a reviewed run whose consensus has no `target_commit`, such as the rerun-test helper `approve_pr`, which + records `approved: True` with no commit. + - A dry run or skip_push run being refused. The flag checks must run before the approval check. + - A pending withdrawal or scoped restart being refused instead of re-entering Stage 4. `resumed_restart` must still + run first. + - The freshness gate raising, or posting a refreshed report after a refused rerun. + - A test file growing past 1,000 lines, or a module exceeding its budget. + - Changes reaching files outside the 17 listed in the intent scope. +- **Mitigations built into the plan:** + - The order of checks in `stage5_merged_head_gate` is fixed: + 1. `resumed_restart` + 2. the flag skips + 3. the approval refusal + - Each position has its own test. + - The approval fixtures put `target_commit` at the head under test, so the "approved equals head" path keeps today's + `stage4` record. + - Step 4 confirms the freshness path and changes `calibrate_rerun.py` only if it falls short. + - Step 7 runs grep, `wc -l`, the budget and self-explaining checks, and a diff name check against the scope list. +- **Residual risk accepted (and why):** Production runs that reach Stage 5 through a path no test covers, with no + recorded approval, now fail where they used to succeed. This is the intended fail-closed behaviour. The error message + gives the resume advice: run the review stage first. +- **Allocated Entropy Budget:** 15.0 +- **Predicted Plan Entropy:** 6.6 +- **Budget Compliance:** The strategy fits within the budget. + +## Plan Description & Strategy + +The work has four parts: + +1. Confirm the baseline. +2. Change the gate in `flow/review_restart.py` so that a run with no recorded approval is refused through + `_stage_failure`. This applies only when the run is not a dry run, not skip_push, and has an execution branch. +3. Repair the test contexts that reached Stage 5 without an approval, using one shared approval helper in + `tests/calibrate_scenarios.py`. +4. Rewrite the two tests that asserted the old pass-through, add the new refusal tests in a new file, and run the + affected tests, lint and the full suite once. + +`flow/review/merged_head_routing.py` and `flow/review/merged_head_gate.py` are not changed. + +## Touch Set + +- `apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py` +- `apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py` +- `apps/sandbox-executor/tests/calibrate_scenarios.py` +- `apps/sandbox-executor/tests/test_merged_head_ci_gate.py` +- `apps/sandbox-executor/tests/test_calibrate_rerun.py` +- `apps/sandbox-executor/tests/test_calibrate_rebuild.py` +- `apps/sandbox-executor/tests/test_calibrate_sync.py` +- `apps/sandbox-executor/tests/test_calibrate_final_head_ci.py` +- `apps/sandbox-executor/tests/test_calibration_commit.py` +- `apps/sandbox-executor/tests/test_ledger_append_only.py` +- `apps/sandbox-executor/tests/test_review_restart.py` +- `apps/sandbox-executor/tests/test_calibrate_staleness.py` +- `apps/sandbox-executor/tests/flow/test_pipeline.py` +- `apps/sandbox-executor/tests/flow/test_git_refs.py` +- `apps/sandbox-executor/tests/flow/review/test_conflict_gate.py` +- `apps/sandbox-executor/tests/flow/review/test_sync_points.py` +- `apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py` + +--- + +## Step 1: Re-confirm the baseline and the single pass-through site + +- **Sub‑intent recommendation:** NO +- **Reasoning:** This is a read-only check that takes a few minutes and protects against drift since `4f46380e5`. +- **Step Type:** INFO_GATHERING +- **Exploration level:** EXPLOIT + +### Intent & Git Integration + +- **Step Intent:** Prove that A1, A6 and A9 still hold on the branch head before any edit. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. Grep `apps/sandbox-executor` for `no Stage 4 approval` and for `Merged-head CI gate skipped`. Expect exactly two + matches: + - `flow/review_restart.py`, in `_skip_reason` and the formatted log line in `stage5_merged_head_gate` + - `tests/test_merged_head_ci_gate.py`, in `test_no_recorded_approval_keeps_todays_path` +2. Record the starting line counts with `wc -l` for: + - `flow/review_restart.py` (165) + - `flow/calibrate_rerun.py` (218) + - `tests/calibrate_scenarios.py` (327) + - `tests/flow/test_pipeline.py` (935) + - `tests/test_calibrate_rerun.py` (944) + - `tests/flow/review/test_sync_points.py` (851) +3. Run the A6 command list once with `uv run pytest -n auto --dist worksteal` over the 13 in-scope test files plus + `tests/flow/test_stage5_fail_closed.py`. Expect all to pass. + +### Dependencies & Criticality + +- **Depends on:** NONE +- **Is Bottleneck:** NO + +### Safety & Constraint Considerations + +- **Relevant rules:** `holon-config/world/ruleset.md` section 3; Test-Run Discipline (foreground runs only). +- **Potential failure modes for this step:** The baseline is already red because of an unrelated merge. +- **Guardrails and early‑abort checks:** If the baseline is red in a file outside the scope, stop and report. Do not + widen the scope. + +### Success & Discard Criteria + +- **Success:** Grep shows the two expected sites, and the baseline passes. +- **Discard:** A further pass-through site, or a red baseline in an out-of-scope file. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.97 | +| entropy_pred | 0.2 | +| impact_pred | 5.0 | +| cost_pred | 0.5 | +| learning_value_pred | 1.0 | +| ev_pred | 4.3 | + +### Step Metrics Rationale + +This repeats checks the intent author already ran. Its value is in detecting drift. It costs little and carries little +entropy. + +--- + +## Step 2: Refuse Stage 5 inside the merged-head gate when no approval is recorded + +- **Sub‑intent recommendation:** NO +- **Reasoning:** The edit is about 15 lines in one module, follows an existing pattern (`refuse_calibration` and + `_stage_failure`), and lands together with its tests. +- **Step Type:** IMPLEMENTATION +- **Exploration level:** EXPLOIT + +### Intent & Git Integration + +- **Step Intent:** Remove the silent pass-through and return a failed CALIBRATE `StageResult` with a non-skipped gate + record. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. In `flow/review_restart.py`, narrow `_skip_reason` to the three flag cases only: + - dry run + - push skipped + - no execution branch + + The approval check moves out of it. The trailing `approved_head_of` expression becomes `return None`, or the function + is restated as a single conditional expression. + +2. Add a module constant `NO_APPROVAL = "no Stage 4 approval recorded"`. +3. Add a function `_refuse_unapproved(context, start)`. It should: + - build `record = gate_record("refused", "", [], [], NO_APPROVAL)`, reusing `gate_record` from + `flow/review/merged_head_gate.py` unchanged, so `state` is `"refused"`, which is not `"skipped"` + - build the error text, for example: "Calibrate stage refused: no Stage 4 approval recorded for execution branch + {branch}; nothing was calibrated or pushed. Run the review stage first (resume from review) to record an approval." + - return `_stage_failure(context, FlowStage.CALIBRATE, start, error, merged_head_ci=record)`, which is the failure + path `refuse_calibration` uses (`_stage_failure` logs the error and stores the result in `context.stage_results`) + - return the tuple `(failure, record)` +4. Import `_stage_failure` from `sandbox_executor.flow.dispatch`. `merged_head_routing.py` already imports it the same + way, so this adds no new dependency direction and no entrypoint import. +5. In `stage5_merged_head_gate`, keep this order: + 1. `resumed_restart` first, unchanged, with its existing `# why:` comment. + 2. The flag skip, which still logs "Merged-head CI gate skipped: {reason}." for the three flag reasons only. + 3. Then: if `approved_head_of(context)` is empty, return `_refuse_unapproved(context, start)`. + 4. Then the existing approved-head flow. + + The string "Merged-head CI gate skipped: no Stage 4 approval recorded" can then no longer be produced. + +6. No docstrings or comments. Add at most one `# why:` comment, and only if a reviewer could not see from the code why + the refusal comes after the flag skip. For example: dry run and skip_push publish nothing, so they need no approval. +7. Check the file is still about 180 lines, under the 350 default, and that the complexity limits hold. The new function + has no branching. + +### Dependencies & Criticality + +- **Depends on:** Step 1 +- **Is Bottleneck:** YES (it carries the behaviour; p_success is above 0.6, so no sub-intent is needed) + +### Safety & Constraint Considerations + +- **Relevant rules:** `docs/safety.md` Invariant 4; `holon-config/world/ruleset.md` section 2 (self-explaining, + complexity, budgets); Code Placement (no entrypoint imports into the flow engine). +- **Potential failure modes for this step:** + - The flag order is inverted, so dry runs are refused. + - `merged_head_routing.py` or `merged_head_gate.py` is edited by accident. + - The error text drops "nothing was calibrated or pushed" or the review-first advice. +- **Guardrails and early‑abort checks:** + - `git diff --name-only` must show only `review_restart.py` for this step. + - The existing dry-run and skip_push parametrised test and the withdrawal and restart tests in + `test_review_restart.py` must pass unchanged. + +### Success & Discard Criteria + +- **Success:** + - `stage5_merged_head_gate` on an execution-branch context with no approval returns a FAILED CALIBRATE result whose + error contains "no Stage 4 approval recorded". + - The returned record has `reason == "no Stage 4 approval recorded"` and `state != "skipped"`. + - Grep for the old log string is empty in `src`. +- **Discard:** The refusal needs a change in `merged_head_routing.py` or `merged_head_gate.py`. If so, stop and re-plan, + because both are out of scope. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.95 | +| entropy_pred | 1.2 | +| impact_pred | 60.0 | +| cost_pred | 2.0 | +| learning_value_pred | 1.0 | +| ev_pred | 55.1 | + +### Step Metrics Rationale + +The author's prototype already returned `refuse_calibration` for this case, so the mechanism is proven. The remaining +risk is message wording and check order. This step carries most of the impact. + +--- + +## Step 3: Record an approval at the head under test in the Stage 5 test contexts + +- **Sub‑intent recommendation:** NO +- **Reasoning:** This is the largest step, at about 53 tests in 11 files. It is mechanical, but it is the most likely to + surface surprises. It cannot be split off, because the suite is red without it. +- **Step Type:** TEST +- **Exploration level:** EXPLOIT + +### Intent & Git Integration + +- **Step Intent:** Restore every test that legitimately runs Stage 5 by giving its context a recorded approval whose + `target_commit` is the execution head it exercises. Behaviour is unchanged. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. Add a shared helper to `tests/calibrate_scenarios.py`, staying under about 360 lines. + + `record_stage4_approval(ctx, target_commit, pr_number="7")` stores + `ctx.stage_results["review"] = StageResult(REVIEW, APPROVED, ...)`. The payload is: + - `consensus = {"approved": True, "target_commit": target_commit, "pr_number": pr_number}` + - `posting = {"dual_posted": True}` + - `ci_checks`, with at most one passing check (matching the shape of `approved_review` in + `test_merged_head_ci_gate.py`), so that `stage4_ci_record` keeps its "relies on Stage 4 CI" path + + Add a companion `approve_execution_head(ctx, repo, branch)` that reads the head to approve: + - first `refs/remotes/origin/{branch}` + - else the local `refs/heads/{branch}` + + The local fallback fixes the A3 failure in `test_missing_origin_branch_proceeds_from_local_ref`. + +2. Apply the helper at the narrowest shared place in each file. Work through the files in A2 order: + 1. `tests/test_calibrate_rerun.py`, 26 fixture errors: + - call the helper inside `calibrate_a_copy` before `stage_runner([])(ctx)` + - extend `approve_pr` so its consensus carries the head being calibrated: the moved head for the rerun fixtures + (`calibrated_moved.new_head`, or read from the host repo). Otherwise `approved_head_of` stays empty and the + rerun is refused. + - this is a fixture-only edit of a few lines, and the file stays under 950 lines + 2. `tests/test_calibrate_rebuild.py` (7) and `tests/test_calibrate_sync.py` (4): put it in the shared `run_stage` + helper, as measured in A3. + 3. `tests/flow/test_pipeline.py` (4): put it in the context or fixture builder those tests share. No new test + functions, and the file stays under 1,000 lines. + 4. `tests/test_calibrate_final_head_ci.py` (3), `tests/flow/review/test_conflict_gate.py` (2), + `tests/flow/review/test_sync_points.py` (2), `tests/test_ledger_append_only.py` (2), + `tests/test_calibration_commit.py` (1) and `tests/flow/test_git_refs.py` (1): put it in the context fixture. +3. Where a test's point is a head that moves after approval, approve the commit that test expects to be covered: + - "approved head differs from merged head" cases + - bookkeeping-only ledger rows + - calibration-commit tests + + Do not approve the moved head, or the test would lose its meaning. + +4. After each file, run `uv run pytest -n auto --dist worksteal` in the foreground. Run + `tests/test_review_restart.py` and `tests/test_calibrate_staleness.py` as well. They are expected to pass unchanged; + edit them only if a failure proves the final change requires it. + +### Dependencies & Criticality + +- **Depends on:** Step 2 +- **Is Bottleneck:** YES (the suite cannot go green without it; p_success is above 0.6) + +### Safety & Constraint Considerations + +- **Relevant rules:** `holon-config/world/ruleset.md` section 3 (hermetic tests); test-file size cap of 1,000 lines; + self-explaining rule on added lines. +- **Potential failure modes for this step:** + - A test fails in a file outside the 11 (A2 drift). + - Approving the wrong commit hides a behaviour the test meant to pin. + - Fixture repetition pushes `test_calibrate_rerun.py` or `test_pipeline.py` towards 1,000 lines. +- **Guardrails and early‑abort checks:** + - Any newly failing file outside the scope list means stop and report, as the A2 response says. + - Re-check `wc -l` after each large file. + - If a fix needs more than about 10 lines in one test file, move it into the shared helper. + +### Success & Discard Criteria + +- **Success:** All 11 files pass with only context or fixture edits. No assertion about calibration output is changed + except the two named in Step 5. +- **Discard:** More than 2 tests need their assertions changed, not just their fixtures, to pass. That would mean A3 is + false, so stop and re-plan. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.86 | +| entropy_pred | 2.6 | +| impact_pred | 30.0 | +| cost_pred | 6.0 | +| learning_value_pred | 1.5 | +| ev_pred | 19.7 | + +### Step Metrics Rationale + +A3 measured 35 of 36 tests restored with a single helper, and the one failure has a known cause. The rest of the risk is +spread across 9 more files, each with its own fixture style. This step is the bottleneck for p_success and costs the +most. + +--- + +## Step 4: Confirm the freshness rerun records a failed rerun with no approval + +- **Sub‑intent recommendation:** NO +- **Reasoning:** This is a small read-and-run check, and its result decides whether `calibrate_rerun.py` changes at all. +- **Step Type:** EXPLORATION +- **Exploration level:** BALANCED + +- **Hypothesis being tested:** With no approved consensus, `review_calibration_freshness` already behaves as decided, + with no change to `calibrate_rerun.py`: + - `_rerun_while_stale` gets a FAILED result from `run_calibrate_stage` + - it returns the stale warning + - `_stale_gate_record` records `rerun_status: failed` and `rerun_error` + - nothing raises (A5) +- **Learning target:** Whether the existing failure path is enough, and the exact shape of the record and of the posted + comments in the refused case. +- **Maximum acceptable cost for this learning:** 1.0 cost units. Change `calibrate_rerun.py` only if a gap is shown, and + limit that change to under 15 lines. + +### Intent & Git Integration + +- **Step Intent:** Prove the freshness decision of the intent holds, and change `calibrate_rerun.py` only if it does + not. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. Read `_rerun_while_stale` (lines 136 to 156), `_settle_rerun` and `_stale_gate_record` (lines 176 to 196). Confirm + that FAILED and not dry_run lead to `_warn_if_stale`, and that `rerun_status` and `rerun_error` are recorded. +2. Run `test_the_review_gate_posts_the_refreshed_comment_without_an_approved_consensus` after Steps 2 and 3. It should + now fail on its old expectations: the rerun is refused, and a stale warning is posted instead of a refreshed note. + That failure is the evidence. +3. If the existing path gives the expected outcome, make no change to `calibrate_rerun.py`. Two outcomes count as a gap: + - a refreshed note is posted for a FAILED rerun + - the record lacks `rerun_status` or `rerun_error` + + If there is a gap, make the smallest fix inside `_stale_gate_record` or `_rerun_while_stale`. Keep the + catch-everything guard in `review_calibration_freshness` as it is. + +### Dependencies & Criticality + +- **Depends on:** Step 2, Step 3 +- **Is Bottleneck:** NO + +### Safety & Constraint Considerations + +- **Relevant rules:** `docs/safety.md` "Failure containment" (a failed rerun must be visible, not silent). +- **Potential failure modes for this step:** The freshness gate raises, or a refreshed report is posted for a refused + rerun. +- **Guardrails and early‑abort checks:** The changed test (Step 5) asserts that no exception is raised and that no + refreshed note is posted. + +### Success & Discard Criteria + +- **Success:** A refused rerun leads to `rerun_status == "failed"`, a non-empty `rerun_error` naming the missing + approval, one stale warning, and zero refreshed notes. +- **Discard:** The fix would exceed 15 lines or reach `calibrate_stale_warning.py`, which is out of scope. If so, stop + and re-plan. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.92 | +| entropy_pred | 0.6 | +| impact_pred | 10.0 | +| cost_pred | 1.0 | +| learning_value_pred | 3.0 | +| ev_pred | 9.5 | + +### Step Metrics Rationale + +A5 was read in advance, and a sibling test already covers a failed rerun. Learning value is moderate because this check +decides the size of the source diff. + +--- + +## Step 5: Rewrite the two old-behaviour tests and add the refusal tests + +- **Sub‑intent recommendation:** NO +- **Reasoning:** These are focused test additions in one new file plus two in-place rewrites. Risk is low. +- **Step Type:** TEST +- **Exploration level:** EXPLOIT + +### Intent & Git Integration + +- **Step Intent:** Pin the new behaviour and the unchanged neighbours with tests. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. In `tests/test_merged_head_ci_gate.py`, replace `test_no_recorded_approval_keeps_todays_path` with + `test_no_recorded_approval_refuses_calibration`. It asserts: + - `stopped.status is StageStatus.FAILED` and `stopped.stage is FlowStage.CALIBRATE` + - "no Stage 4 approval recorded" is in `stopped.error` + - `record["reason"] == "no Stage 4 approval recorded"` and `record["state"] != "skipped"` + - `fakes.probed == []` + + The test stays the same size. The file stays under 600 lines. + +2. In `tests/test_calibrate_rerun.py`, change + `test_the_review_gate_posts_the_refreshed_comment_without_an_approved_consensus` in place and rename it to describe + the refusal (for example `..._refuses_the_rerun_without_an_approved_consensus`). It asserts: + - the call does not raise + - `record["rerun"]` is true and `record["rerun_status"] == "failed"` + - "no Stage 4 approval recorded" is in `record["rerun_error"]` + - `len(stale_warnings(posted)) == 1` and `len(refreshed_notes(posted)) == 0` + + The fixture used here must not record an approval for the rerun context. This is an in-place edit, not a new + function, and the file stays under 1,000 lines. + +3. Create `tests/flow/test_stage5_no_approval_refusal.py`, under about 150 lines, with the tests below. + - Test (a): `run_calibrate_stage` on a hermetic execution-branch repository with no review result recorded. Reuse the + builders in `tests/calibrate_scenarios.py` or `tests/flow/stage_templates.py`. Patch or spy on three things: + - the calibration entry point + - the calibration commit + - the push + + Assert: + - FAILED, with the error naming the missing approval and the review-first advice + - no calibration call + - no new commit on the execution branch (the head is unchanged) + - no push to origin (the origin ref is unchanged) + + - Test (b): parametrised over dry_run, skip_push and no execution branch. With no approval, `stage5_merged_head_gate` + returns `None` and a record with state `"skipped"`. + - Test (c): a pending withdrawal or scoped restart still returns the review-restart result, not the refusal. Build it + with the existing `merged_head_resume` fixtures used in `test_review_restart.py`. + - Test (d): an approval whose `target_commit` equals the head returns `None` with the `stage4` record, so the happy + path is unchanged. + - Test (e): `caplog` across tests (a) and (b) never contains "Merged-head CI gate skipped: no Stage 4 approval + recorded". + +4. Follow the self-explaining rule: no docstrings and no comments. Test names state the behaviour. + +### Dependencies & Criticality + +- **Depends on:** Step 2, Step 3, Step 4 +- **Is Bottleneck:** NO + +### Safety & Constraint Considerations + +- **Relevant rules:** `holon-config/world/ruleset.md` section 3 (hermetic; no network or gh writes, through the existing + guards); no new test functions in the three large files. +- **Potential failure modes for this step:** Test (a) uses real git and becomes slow. Patching the wrong seam lets the + "no push" assertion pass vacuously. +- **Guardrails and early‑abort checks:** + - Assert the spies would have been reached on an approved context, as a control in test (d) or a sibling check. + - Keep test (a) on a template-copied repository so it stays well under 2 seconds. + +### Success & Discard Criteria + +- **Success:** The new file passes. The two rewritten tests pass. Grep for the old log string over + `apps/sandbox-executor` is empty. +- **Discard:** Test (a) cannot be made hermetic without fixtures from out-of-scope helper modules. If so, fall back to + patching seams at the `run_calibrate_stage` level and record that. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.92 | +| entropy_pred | 0.8 | +| impact_pred | 20.0 | +| cost_pred | 2.0 | +| learning_value_pred | 1.0 | +| ev_pred | 16.2 | + +### Step Metrics Rationale + +This follows standard test patterns that already exist next door, in `test_stage5_fail_closed.py`. Its impact is +assurance that the refusal stays in place. + +--- + +## Step 6: Run the affected tests, lint and the full suite once + +- **Sub‑intent recommendation:** NO +- **Reasoning:** This is the required verification. It runs once and in the foreground. +- **Step Type:** TEST +- **Exploration level:** EXPLOIT + +### Intent & Git Integration + +- **Step Intent:** Show the change is green across the repository, including A7: reviewed pipeline runs are not refused. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. Run `uv run pytest -n auto --dist worksteal` in the foreground over all 17 in-scope test paths plus + `tests/flow/test_stage5_fail_closed.py`. +2. Run `uv run task lint` in the foreground. This covers ruff complexity, module budgets and `check_self_explaining.py`. +3. Run `uv run task test` once in the foreground. Expect 0 failures and 0 errors. Any failing file outside the scope + means stop and report (A2). +4. Report the pass, fail and error counts and the time pytest reports. This is not a timing intent, so the suite runs + once. + +### Dependencies & Criticality + +- **Depends on:** Step 5 +- **Is Bottleneck:** YES (it gates the merge; p_success is above 0.6) + +### Safety & Constraint Considerations + +- **Relevant rules:** Test-Run Discipline; `holon-config/world/ruleset.md` section 3. +- **Potential failure modes for this step:** An out-of-scope test reaches Stage 5 without an approval, or a lint failure + appears on the added lines. +- **Guardrails and early‑abort checks:** Do not background any command. Do not widen the scope silently. + +### Success & Discard Criteria + +- **Success:** All three commands exit 0. +- **Discard:** A failure outside the scope list that would need an out-of-scope edit. If so, park and re-scope. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.93 | +| entropy_pred | 0.8 | +| impact_pred | 10.0 | +| cost_pred | 2.0 | +| learning_value_pred | 0.5 | +| ev_pred | 7.1 | + +### Step Metrics Rationale + +The full suite was already measured in A2, so the expected failure set is known. The residual risk is drift from merges +since that measurement. + +--- + +## Step 7: Check the acceptance criteria against the diff + +- **Sub‑intent recommendation:** NO +- **Reasoning:** This is a cheap closing audit of the scope and hygiene criteria. +- **Step Type:** INFO_GATHERING +- **Exploration level:** EXPLOIT + +### Intent & Git Integration + +- **Step Intent:** Confirm the scope, size, budget and string criteria before handing over to Stage 4. +- **Git branch:** I-1796129423-stage5-no-approval-refusal +- **Sub‑intent:** NONE + +### Implementation Details (No code blocks, only logic/steps) + +1. Check `git diff --name-only origin/main...HEAD`: + - it must be a subset of the 17 scope paths + - `holon-config/hygiene/module_budgets.json` is absent + - `flow/review/merged_head_routing.py` and `flow/review/merged_head_gate.py` are absent + - no documentation file appears +2. Grep `apps/sandbox-executor` for "Merged-head CI gate skipped: no Stage 4 approval recorded". The result must be + empty. +3. Run `wc -l` on `tests/flow/test_pipeline.py`, `tests/test_calibrate_rerun.py` and + `tests/flow/review/test_sync_points.py`. Each must be under 1,000 lines. Also run + `python scripts/check_module_budgets.py` and `python scripts/check_self_explaining.py`. +4. Confirm that no new `def test_` was added to the three large files. Use grep over the diff for added `def test_` + lines. + +### Dependencies & Criticality + +- **Depends on:** Step 6 +- **Is Bottleneck:** NO + +### Safety & Constraint Considerations + +- **Relevant rules:** Code Placement and Sizing; module budgets are frozen; intent scope confinement. +- **Potential failure modes for this step:** A helper edit landed in an unlisted fixture module. +- **Guardrails and early‑abort checks:** Revert any out-of-scope hunk before handover. + +### Success & Discard Criteria + +- **Success:** All four checks pass. +- **Discard:** An out-of-scope file cannot be removed without breaking tests. If so, park and re-scope. + +### Metrics + +| metric | value | +| ------------------- | ----- | +| p_success_pred | 0.97 | +| entropy_pred | 0.4 | +| impact_pred | 5.0 | +| cost_pred | 0.5 | +| learning_value_pred | 0.5 | +| ev_pred | 4.5 | + +### Step Metrics Rationale + +This is a mechanical check of the acceptance criteria with almost no uncertainty. + +--- + +## Sub-intent list + +None From 304b0daed67fd2ea1cf1c222b31645d60fe33db4 Mon Sep 17 00:00:00 2001 From: Holon Executor Agent Date: Tue, 1 Dec 2026 12:54:48 +0000 Subject: [PATCH 03/11] Step 2: refuse Stage 5 in the merged-head gate without a recorded approval --- .../sandbox_executor/flow/review_restart.py | 37 ++++++++++++++----- executions/E-1796129613-CLA-CO5.5.md | 18 +++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 executions/E-1796129613-CLA-CO5.5.md diff --git a/apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py b/apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py index 0b43dc6fe..aa3a237fb 100644 --- a/apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py +++ b/apps/sandbox-executor/src/sandbox_executor/flow/review_restart.py @@ -5,6 +5,7 @@ from typing import Any from sandbox_executor.flow.context import FlowContext, FlowStage, StageResult, StageStatus +from sandbox_executor.flow.dispatch import _stage_failure from sandbox_executor.flow.github.ci_final_head import _bookkeeping_only, _git_changed_paths from sandbox_executor.flow.github.ci_head_checks import FAILED, PASSED from sandbox_executor.flow.github.ci_reverify import _same_commit, approved_head_of @@ -29,6 +30,7 @@ from sandbox_executor.git import run_git MAX_MERGED_HEAD_REVIEW_RESTARTS = 3 +NO_APPROVAL = "no Stage 4 approval recorded" def _execution_head(context: FlowContext, seams: MergedHeadSeams) -> str | None: @@ -54,7 +56,29 @@ def moved(approved: str, head: str) -> bool: def _skip_reason(context: FlowContext) -> str | None: if context.dry_run or context.skip_push or not context.execution_branch: return "dry run" if context.dry_run else "push skipped" if context.skip_push else "no execution branch" - return None if approved_head_of(context) else "no Stage 4 approval recorded" + return None + + +def _refuse_unapproved(context: FlowContext, start: str) -> tuple[StageResult, dict[str, Any]]: + record = gate_record("refused", "", [], [], NO_APPROVAL) + error = ( + f"Calibrate stage refused: {NO_APPROVAL} for execution branch {context.execution_branch}; " + "nothing was calibrated or pushed. Run the review stage first (resume from review) to record an approval." + ) + return _stage_failure(context, FlowStage.CALIBRATE, start, error, merged_head_ci=record), record + + +def _settled_before_head_check(context: FlowContext, start: str) -> tuple[StageResult | None, dict[str, Any]] | None: + resumed = resumed_restart(context, start) + # why: a resume after a withdrawal or a scoped restart runs Stage 4 again first. + if resumed is not None: + return resumed + skip = _skip_reason(context) + if skip: + context.log(f"Merged-head CI gate skipped: {skip}.") + return None, skipped_record(None, skip) + # why: dry run and skip_push publish nothing, so only a publishing run needs a recorded approval. + return None if approved_head_of(context) else _refuse_unapproved(context, start) def _decide( @@ -71,14 +95,9 @@ def stage5_merged_head_gate( context: FlowContext, seams: MergedHeadSeams | None = None ) -> tuple[StageResult | None, dict[str, Any]]: seams, start = seams or MergedHeadSeams(), datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ") - resumed = resumed_restart(context, start) - # why: a resume after a withdrawal or a scoped restart runs Stage 4 again first. - if resumed is not None: - return resumed - skip = _skip_reason(context) - if skip: - context.log(f"Merged-head CI gate skipped: {skip}.") - return None, skipped_record(None, skip) + settled = _settled_before_head_check(context, start) + if settled is not None: + return settled approved, head = str(approved_head_of(context)), _execution_head(context, seams) if not head: record = gate_record("unknown", "", [], [], "the execution head could not be read") diff --git a/executions/E-1796129613-CLA-CO5.5.md b/executions/E-1796129613-CLA-CO5.5.md new file mode 100644 index 000000000..428c0d827 --- /dev/null +++ b/executions/E-1796129613-CLA-CO5.5.md @@ -0,0 +1,18 @@ +# Execution Record: E-1796129613-CLA-CO5.5 + +## Summary + +Implements plan `P-1796129447-CLA-CO5.5` for intent `I-1796129423-stage5-no-approval-refusal`: Stage 5 refuses inside +the merged-head gate when no Stage 4 approval is recorded, instead of skipping the gate and calibrating. + +## Actual Metrics + +| metric | value | +| --------------------- | ----- | +| success_actual | 0.0 | +| entropy_actual | 0.0 | +| impact_actual | 0.0 | +| cost_actual | 0.0 | +| learning_value_actual | 0.0 | + +## Steps Executed From b3c7bd7ccaebbeb8c776f2a5dd12c62f3cfa735e Mon Sep 17 00:00:00 2001 From: Holon Executor Agent Date: Tue, 1 Dec 2026 13:06:05 +0000 Subject: [PATCH 04/11] Step 3: record a Stage 4 approval in the Stage 5 test contexts --- .../tests/calibrate_scenarios.py | 41 ++++++++++++++++++- .../tests/flow/review/test_conflict_gate.py | 5 ++- .../tests/flow/review/test_sync_points.py | 12 ++++-- .../tests/flow/test_git_refs.py | 6 ++- .../tests/flow/test_pipeline.py | 5 +++ .../tests/test_calibrate_final_head_ci.py | 2 + .../tests/test_calibrate_rerun.py | 9 +++- .../tests/test_calibrate_sync.py | 2 + .../tests/test_calibration_commit.py | 8 +++- .../tests/test_ledger_append_only.py | 11 +++-- 10 files changed, 87 insertions(+), 14 deletions(-) diff --git a/apps/sandbox-executor/tests/calibrate_scenarios.py b/apps/sandbox-executor/tests/calibrate_scenarios.py index db47b32dd..29127e918 100644 --- a/apps/sandbox-executor/tests/calibrate_scenarios.py +++ b/apps/sandbox-executor/tests/calibrate_scenarios.py @@ -4,13 +4,15 @@ import json import os import subprocess -from collections.abc import Callable, Sequence +from collections.abc import Callable, Iterator, Sequence +from contextlib import contextmanager from pathlib import Path from types import SimpleNamespace from typing import Any +from unittest.mock import patch import pytest -from sandbox_executor.flow import FlowContext, StageResult +from sandbox_executor.flow import FlowContext, FlowStage, StageResult, StageStatus from sandbox_executor.flow.calibrate_rerun import RerunSeams from sandbox_executor.flow.calibrate_stale_warning import STALE_MARKER_FAMILY from sandbox_executor.flow.github.approval_invalidation import CommentRecord @@ -26,6 +28,7 @@ CAL_REPORT_REL = f"plans/I-1-x/{PLAN_ID}_calibration.md" LEDGER_REL = "holon-knowledge/ledger/executions.jsonl" TARGET_REF = "refs/remotes/origin/main" +APPROVED_HEAD = "a" * 40 SYNC_GIT_ENV = { "GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "t@example.com", @@ -52,6 +55,40 @@ def commit_sync_file(repo: Path, name: str, text: str = "x") -> str: return run_sync_git(repo, "rev-parse", "HEAD") +def record_stage4_approval(ctx: FlowContext, target_commit: str, pr_number: str = "7") -> None: + ctx.stage_results["review"] = StageResult( + stage=FlowStage.REVIEW, + status=StageStatus.APPROVED, + payload={ + "consensus": {"approved": True, "target_commit": target_commit, "pr_number": pr_number}, + "posting": {"dual_posted": True}, + "ci_checks": {"checks": [{"name": "unit", "bucket": "pass", "link": "https://x/actions/runs/5/job/1"}]}, + }, + ) + + +def approve_execution_head(ctx: FlowContext, repo: Path, branch: str, pr_number: str = "7") -> str: + refs = (f"refs/remotes/origin/{branch}", f"refs/heads/{branch}") + head = next(sha for ref in refs if (sha := _verified_ref(repo, ref))) + record_stage4_approval(ctx, head, pr_number) + return head + + +# why: a repository with no origin execution ref would make the gate ask GitHub for the pull request head +@contextmanager +def approved_at_execution_head(ctx: FlowContext, head: str = APPROVED_HEAD) -> Iterator[str]: + record_stage4_approval(ctx, head) + with patch("sandbox_executor.flow.review_restart._execution_head", return_value=head): + yield head + + +def _verified_ref(repo: Path, ref: str) -> str: + res = subprocess.run( + ["git", "rev-parse", "--verify", "-q", ref], cwd=repo, capture_output=True, text=True, check=False + ) + return res.stdout.strip() if res.returncode == 0 else "" + + def own_copy(template: SimpleNamespace, target: Path) -> SimpleNamespace: copy_template(template.root, target) built = vars(template.repos) diff --git a/apps/sandbox-executor/tests/flow/review/test_conflict_gate.py b/apps/sandbox-executor/tests/flow/review/test_conflict_gate.py index 54a749710..00fa2d4c8 100644 --- a/apps/sandbox-executor/tests/flow/review/test_conflict_gate.py +++ b/apps/sandbox-executor/tests/flow/review/test_conflict_gate.py @@ -21,6 +21,7 @@ from sandbox_executor.ledger import read_merged_rows, read_merged_rows_at_ref from sandbox_executor.review_report import _mergeability_word +from tests.calibrate_scenarios import approved_at_execution_head from tests.flow.github.fake_github import view_for from tests.flow.helpers import _git from tests.ledger_conflict_repos import BRANCH, LEDGER, build_conflicting_repos, refuse_test_runs @@ -231,8 +232,10 @@ def test_stage5_proceeds_on_a_clean_or_freshly_merged_head(tmp_path, monkeypatch monkeypatch.setattr(sync_points, "sync_review_head", _RecordingSync(outcome)) monkeypatch.setattr(conflict_gate.stage_conflicts, "check_pr_mergeability", lambda *a, **k: dict(probe)) monkeypatch.setattr(calibrate, "_calibrate_execution_branch", MagicMock(return_value=expected)) + ctx = _stage5_context(tmp_path) - assert calibrate.run_calibrate_stage(_stage5_context(tmp_path)) is expected + with approved_at_execution_head(ctx): + assert calibrate.run_calibrate_stage(ctx) is expected def test_ledger_only_conflict_is_merged_and_pushed_but_the_approval_is_not_posted(conflicting_repos, monkeypatch): diff --git a/apps/sandbox-executor/tests/flow/review/test_sync_points.py b/apps/sandbox-executor/tests/flow/review/test_sync_points.py index 5a504124a..3c7320fa9 100644 --- a/apps/sandbox-executor/tests/flow/review/test_sync_points.py +++ b/apps/sandbox-executor/tests/flow/review/test_sync_points.py @@ -33,6 +33,7 @@ from sandbox_executor.review_ensemble import build_review_request from sandbox_executor.review_target import ReviewTarget +from tests.calibrate_scenarios import approved_at_execution_head from tests.flow.helpers import _git from tests.flow.sync_boundary_repos import ( APP, @@ -301,7 +302,8 @@ def test_stage5_entry_and_retry_sync_resolve_conflicts_and_block_cleanly( ctx = _ctx(work) # Stage 5 entry sync resolves mechanical ledger conflict. - assert sync_before_calibration(ctx, "2026-11-24T00:00:00Z") is None + with approved_at_execution_head(ctx): + assert sync_before_calibration(ctx, "2026-11-24T00:00:00Z") is None rows = read_merged_rows_at_ref(str(work), f"origin/{FLOW_BRANCH}", "executions.jsonl") assert any(r.get("action") == "target_sync" and r.get("boundary") == "calibrate" for r in rows) @@ -324,7 +326,7 @@ def flaky_calibrate(**kwargs): ) from tests.flow.sleep_patch import scoped_sleep_patch - with scoped_sleep_patch("sandbox_executor.flow.calibrate_retry"): + with approved_at_execution_head(ctx), scoped_sleep_patch("sandbox_executor.flow.calibrate_retry"): assert wrapped() == {"ok": True} assert calls == 2 @@ -416,7 +418,8 @@ def test_prepare_execution_branch_syncs_before_calibrated_and_retry_reanchors( # Mechanical sync_before_calibration runs before prepare_calibrated_branch so /calibrated starts at merged SHA. work2 = sync_work(tmp_path_factory, tmp_path / "r2", ledger_conflict(2), base=CODE_BASE) ctx_ok = _ctx(work2) - failure2, start_sha, created2 = cal_stage._prepare_execution_branch(ctx_ok, "2026-11-24T00:00:00Z") + with approved_at_execution_head(ctx_ok): + failure2, start_sha, created2 = cal_stage._prepare_execution_branch(ctx_ok, "2026-11-24T00:00:00Z") assert failure2 is None and created2 is True and start_sha is not None assert _git(work2, "rev-parse", f"refs/heads/{calibrated}") == start_sha assert _git(work2, "rev-parse", f"refs/heads/{FLOW_BRANCH}") == start_sha @@ -424,7 +427,8 @@ def test_prepare_execution_branch_syncs_before_calibrated_and_retry_reanchors( # Mechanical retry sync re-anchors /calibrated and updates start_sha so publish_calibration --ff-only succeeds. _inject_ledger_conflict(work2, FLOW_BRANCH, 3) updated_shas: list[str] = [] - make_calibrate_retry_sync(ctx_ok, on_head_updated=updated_shas.append)(1) + with approved_at_execution_head(ctx_ok): + make_calibrate_retry_sync(ctx_ok, on_head_updated=updated_shas.append)(1) assert len(updated_shas) == 1 and updated_shas[0] != start_sha assert _git(work2, "rev-parse", f"refs/heads/{calibrated}") == updated_shas[0] _git(work2, "checkout", calibrated) diff --git a/apps/sandbox-executor/tests/flow/test_git_refs.py b/apps/sandbox-executor/tests/flow/test_git_refs.py index 857591c9a..5dc470505 100644 --- a/apps/sandbox-executor/tests/flow/test_git_refs.py +++ b/apps/sandbox-executor/tests/flow/test_git_refs.py @@ -22,6 +22,7 @@ from sandbox_executor.flow.git_refs import _append_ledger_row from sandbox_executor.git import run_git as real_run_git +from tests.calibrate_scenarios import approved_at_execution_head from tests.flow.github.fake_github import FakeGitHub, ci_checks_payload from tests.flow.helpers import ( _REAL_RESOLVE_REVIEWED_TARGET, @@ -250,7 +251,10 @@ def test_calibrate_stage_fails_cleanly_when_execution_branch_cannot_be_checked_o ctx.execution_branch = ctx.execution_branch.replace("/E-", "/E-missing-") status_before = _git(host, "status", "--porcelain") - with patch("sandbox_executor.flow.stages.calibrate.run_calibrate") as mock_calibrate: + with ( + approved_at_execution_head(ctx), + patch("sandbox_executor.flow.stages.calibrate.run_calibrate") as mock_calibrate, + ): res = run_calibrate_stage(ctx) assert res.status == StageStatus.FAILED diff --git a/apps/sandbox-executor/tests/flow/test_pipeline.py b/apps/sandbox-executor/tests/flow/test_pipeline.py index a6f81b40a..0c46b915b 100644 --- a/apps/sandbox-executor/tests/flow/test_pipeline.py +++ b/apps/sandbox-executor/tests/flow/test_pipeline.py @@ -33,6 +33,7 @@ from sandbox_executor.intent_assumption_rules import default_assumptions_fields from sandbox_executor.ledger import read_merged_rows, read_merged_text +from tests.calibrate_scenarios import approved_at_execution_head from tests.flow.helpers import SteppingClock, _dispatch_context, _prefix, _review_loop_gh_stubs, seed_empty_ledger from tests.flow.hermetic_repos import hermetic_repos_copy from tests.flow.lookup_patch import patch_lookup_sites @@ -210,6 +211,7 @@ def test_stage5_calibrate_mocked(self, tmp_path): mock_report.to_dict.return_value = {"calibrated_branch": mock_report.calibrated_branch, "accuracy_score": 0.95} with ( + approved_at_execution_head(ctx), patch("sandbox_executor.flow.stages.calibrate._checkout_execution_branch", return_value=None), patch("sandbox_executor.flow.stages.calibrate.run_calibrate", return_value=mock_report) as mock_run, ): @@ -228,6 +230,7 @@ def test_stage5_calibrate_failure_writes_no_report(self, tmp_path): ) with ( + approved_at_execution_head(ctx), patch("sandbox_executor.flow.stages.calibrate._checkout_execution_branch", return_value=None), patch( "sandbox_executor.flow.stages.calibrate.run_calibrate", side_effect=RuntimeError("calibration failed") @@ -426,6 +429,7 @@ def test_stage5_prettier_check_failure_fails_stage_and_never_pushes(self, tmp_pa "(check exited 1); reproduce with: npx prettier --check plans/I-100-intent/P-200-plan_calibration.md" ) with ( + approved_at_execution_head(ctx), patch("sandbox_executor.flow.stages.calibrate._checkout_execution_branch", return_value=None), patch("sandbox_executor.flow.stages.calibrate.sync_before_calibration", return_value=None), patch("sandbox_executor.flow.stages.calibrate.run_calibrate", side_effect=error), @@ -457,6 +461,7 @@ def test_stage5_calibration_success_still_pushes(self, tmp_path): mock_report.calibrated_branch = "I-100-intent/P-200-plan/E-300-exec/calibrated" mock_report.to_dict.return_value = {"calibrated_branch": mock_report.calibrated_branch} with ( + approved_at_execution_head(ctx), patch("sandbox_executor.flow.stages.calibrate._checkout_execution_branch", return_value=None), patch("sandbox_executor.flow.stages.calibrate.sync_before_calibration", return_value=None), patch("sandbox_executor.flow.stages.calibrate.run_calibrate", return_value=mock_report), diff --git a/apps/sandbox-executor/tests/test_calibrate_final_head_ci.py b/apps/sandbox-executor/tests/test_calibrate_final_head_ci.py index 129cf9558..1660fc402 100644 --- a/apps/sandbox-executor/tests/test_calibrate_final_head_ci.py +++ b/apps/sandbox-executor/tests/test_calibrate_final_head_ci.py @@ -26,6 +26,7 @@ from sandbox_executor.flow.review_restart import stage5_merged_head_gate from sandbox_executor.flow.stages.calibrate import run_calibrate_stage +from tests.calibrate_scenarios import approved_at_execution_head from tests.flow.github.fake_github import FakeGitHub from tests.flow.sync_boundary_repos import CLEAN_TARGET_MOVE, CODE_BASE, FLOW_CODE from tests.flow_repo_templates import flow_history_copy @@ -189,6 +190,7 @@ def _run_stage(tmp_path: Path, record: dict) -> object: report.to_dict.return_value = {} ok = SimpleNamespace(returncode=0, stdout="", stderr="") with ( + approved_at_execution_head(ctx), patch("sandbox_executor.flow.stages.calibrate._checkout_execution_branch", return_value=None), patch("sandbox_executor.flow.stages.calibrate.sync_before_calibration", return_value=None), patch("sandbox_executor.flow.stages.calibrate.run_calibrate", return_value=report), diff --git a/apps/sandbox-executor/tests/test_calibrate_rerun.py b/apps/sandbox-executor/tests/test_calibrate_rerun.py index cf64f2a22..ffddef3cd 100644 --- a/apps/sandbox-executor/tests/test_calibrate_rerun.py +++ b/apps/sandbox-executor/tests/test_calibrate_rerun.py @@ -37,6 +37,7 @@ TARGET_REF, FakeThread, advance_main, + approve_execution_head, clone_flow_pair, commit_calibration, ledger_row, @@ -66,7 +67,10 @@ def repos(rerun_repos_template: SimpleNamespace, tmp_path: Path) -> SimpleNamesp def calibrate_a_copy(template: SimpleNamespace, root: Path, blocked: Sequence[list[str]]) -> SimpleNamespace: built = own_copy(template, root) ctx = FlowContext(target_worktree=str(built.host), execution_branch=EXEC, agent="a", model="m") + approve_execution_head(ctx, built.host, EXEC, pr_number="") result = stage_runner([])(ctx) + # why: each test records the review it needs, so the cached first run keeps no approval of its own + ctx.stage_results.pop("review") assert result.status == StageStatus.SUCCESS assert not any(blocked), f"the Stage 5 run of the calibrated template made calls a guard blocked: {blocked}" return SimpleNamespace(repos=built, first_run=(ctx, result)) @@ -299,10 +303,12 @@ def move_head(repos: SimpleNamespace, name: str = "resolver-fix.txt") -> str: def approve_pr(ctx: FlowContext, number: str = "7") -> None: + origin_head = git(Path(ctx.target_worktree), "ls-remote", "origin", f"refs/heads/{EXEC}").split()[0] + consensus = {"approved": True, "pr_number": number, "target_commit": origin_head} ctx.stage_results["review"] = StageResult( stage=FlowStage.REVIEW, status=StageStatus.HALTED_FOR_HUMAN, - payload={"consensus": {"approved": True, "pr_number": number}, "posting": {"dual_posted": True}}, + payload={"consensus": consensus, "posting": {"dual_posted": True}}, ) @@ -499,6 +505,7 @@ def test_a_rerun_adds_the_refreshed_note_only_when_no_warning_was_superseded(cal assert "Calibration refreshed" in note and calibrated_rerun.new_head[:7] in note second_head = move_head(calibrated_rerun, "second-fix.txt") + approve_pr(ctx) post_stale_signal(ctx, report_staleness(ctx), thread.seams(), pr_number="7") second = rerun_calibration(ctx, first, run, seams=thread.seams()) assert (len(calls), second.payload["calibrated_head"]) == (3, second_head) diff --git a/apps/sandbox-executor/tests/test_calibrate_sync.py b/apps/sandbox-executor/tests/test_calibrate_sync.py index 21fb4b05f..d321b7edc 100644 --- a/apps/sandbox-executor/tests/test_calibrate_sync.py +++ b/apps/sandbox-executor/tests/test_calibrate_sync.py @@ -16,6 +16,7 @@ SYNC_CALIBRATED, SYNC_EXEC, SYNC_GIT_ENV, + approve_execution_head, build_sync_repos, build_sync_repos_ahead, clone_flow_pair, @@ -106,6 +107,7 @@ def fake_calibrate(**kwargs: object) -> SimpleNamespace: def run_stage(repos: SimpleNamespace, **kwargs: bool): ctx = FlowContext(target_worktree=str(repos.host), execution_branch=EXEC, agent="a", model="m", **kwargs) + approve_execution_head(ctx, repos.host, EXEC) with ( patch("sandbox_executor.flow.stages.calibrate.sync_before_calibration", return_value=None), patch("sandbox_executor.flow.stages.calibrate.run_calibrate", side_effect=fake_calibrate), diff --git a/apps/sandbox-executor/tests/test_calibration_commit.py b/apps/sandbox-executor/tests/test_calibration_commit.py index ce7308f07..f55470435 100644 --- a/apps/sandbox-executor/tests/test_calibration_commit.py +++ b/apps/sandbox-executor/tests/test_calibration_commit.py @@ -26,7 +26,12 @@ from sandbox_executor.ledger import merged_jsonl_text, read_merged_rows_at_ref, read_merged_text from sandbox_executor.plan_artifact_format import FenceFormatOutcome, FenceFormatStatus -from tests.calibrate_scenarios import build_calibration_commit_repo, own_path_copy, run_guarded_template +from tests.calibrate_scenarios import ( + approved_at_execution_head, + build_calibration_commit_repo, + own_path_copy, + run_guarded_template, +) from tests.repo_templates import shared_template from tests.test_plan_artifact_format import ( OVERLONG_STATEMENT, @@ -421,6 +426,7 @@ def recording_run_git(args, *a, **kw): return real_run_git(args, *a, **kw) with ( + approved_at_execution_head(ctx, exec_head_before), patch("sandbox_executor.calibration.run.format_calibration_report"), patch("sandbox_executor.flow.stages.calibrate.sync_before_calibration", return_value=None), patch("sandbox_executor.flow.stages.review.run_git", side_effect=recording_run_git), diff --git a/apps/sandbox-executor/tests/test_ledger_append_only.py b/apps/sandbox-executor/tests/test_ledger_append_only.py index d5dd0acd3..e7849c4a6 100644 --- a/apps/sandbox-executor/tests/test_ledger_append_only.py +++ b/apps/sandbox-executor/tests/test_ledger_append_only.py @@ -31,6 +31,7 @@ from sandbox_executor.ledger import route as route_module from sandbox_executor.ledger.merged import parse_jsonl_rows +from tests.calibrate_scenarios import approved_at_execution_head from tests.flow.helpers import FakeRoleAgents, _dispatch_context, _git from tests.repo_templates import copy_template, shared_template @@ -620,8 +621,9 @@ def test_calibration_rewrite_propagates_instead_of_writing_a_fallback( monkeypatch.setattr( "sandbox_executor.flow.stages.calibrate.record_calibration_action", lambda *a, **_k: fallback_calls.append(a) ) - with pytest.raises(LedgerRewriteError): - flow.run_calibrate_stage(_flow_context(tmp_path)) + ctx = _flow_context(tmp_path) + with approved_at_execution_head(ctx), pytest.raises(LedgerRewriteError): + flow.run_calibrate_stage(ctx) assert fallback_calls == [] assert not (tmp_path / "plans").exists() @@ -634,8 +636,9 @@ def test_stage5_reconciliation_rewrite_propagates_before_push( monkeypatch.setattr("sandbox_executor.flow.stages.calibrate._checkout_execution_branch", lambda _ctx: None) monkeypatch.setattr("sandbox_executor.flow.stages.calibrate.run_calibrate", lambda **_k: report) monkeypatch.setattr("sandbox_executor.flow.stages.calibrate.reconcile_records", _raise_rewrite) - with pytest.raises(LedgerRewriteError): - flow.run_calibrate_stage(_flow_context(tmp_path)) + ctx = _flow_context(tmp_path) + with approved_at_execution_head(ctx), pytest.raises(LedgerRewriteError): + flow.run_calibrate_stage(ctx) assert not any(c[:1] in (["commit"], ["push"]) for c in fake_git.calls) From ca3f17f24b6aef2376ab933dd59657cccc71c39e Mon Sep 17 00:00:00 2001 From: Holon Executor Agent Date: Tue, 1 Dec 2026 13:07:29 +0000 Subject: [PATCH 05/11] Steps 4-5: rewrite the old-behaviour tests and add the Stage 5 refusal tests --- .../flow/test_stage5_no_approval_refusal.py | 139 ++++++++++++++++++ .../tests/test_calibrate_rerun.py | 9 +- .../tests/test_merged_head_ci_gate.py | 6 +- 3 files changed, 147 insertions(+), 7 deletions(-) create mode 100644 apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py diff --git a/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py b/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py new file mode 100644 index 000000000..89f199e5d --- /dev/null +++ b/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py @@ -0,0 +1,139 @@ +from __future__ import annotations + +import logging +from pathlib import Path +from types import SimpleNamespace +from typing import Any +from unittest.mock import MagicMock, patch + +import pytest +from sandbox_executor.flow import FlowContext, FlowStage, StageResult, StageStatus +from sandbox_executor.flow.review.merged_head_gate import MergedHeadSeams +from sandbox_executor.flow.review_restart import stage5_merged_head_gate +from sandbox_executor.flow.stages.calibrate import run_calibrate_stage + +from tests.calibrate_scenarios import ( + SYNC_CALIBRATED, + SYNC_EXEC, + approve_execution_head, + build_sync_repos, + own_copy, + run_sync_git, +) +from tests.repo_templates import shared_template + +OLD_PASS_THROUGH = "Merged-head CI gate skipped: no Stage 4 approval recorded" +APPROVED = "a" * 40 + + +@pytest.fixture(scope="session") +def execution_repos_template(tmp_path_factory: pytest.TempPathFactory, hermetic_git_config: str) -> SimpleNamespace: + root, built = shared_template(tmp_path_factory, "stage5-no-approval-template", build_sync_repos) + return SimpleNamespace(root=root, repos=built) + + +@pytest.fixture +def repos(execution_repos_template: SimpleNamespace, tmp_path: Path) -> SimpleNamespace: + return own_copy(execution_repos_template, tmp_path) + + +def _branch_heads(repos: SimpleNamespace) -> tuple[str, str]: + local = run_sync_git(repos.host, "rev-parse", f"refs/heads/{SYNC_EXEC}") + return local, run_sync_git(repos.origin, "rev-parse", f"refs/heads/{SYNC_EXEC}") + + +def _run_stage5(ctx: FlowContext) -> tuple[StageResult, MagicMock]: + calibrated = StageResult(stage=FlowStage.CALIBRATE, status=StageStatus.SUCCESS) + with ( + patch("sandbox_executor.flow.stages.calibrate._stage5_conflict_gate", return_value=None), + patch("sandbox_executor.flow.stages.calibrate._calibrate_execution_branch", return_value=calibrated) as spy, + ): + return run_calibrate_stage(ctx), spy + + +def _execution_ctx(repos: SimpleNamespace) -> FlowContext: + return FlowContext(target_worktree=str(repos.host), execution_branch=SYNC_EXEC, agent="a", model="m") + + +def _review(**consensus: Any) -> StageResult: + return StageResult(stage=FlowStage.REVIEW, status=StageStatus.APPROVED, payload={"consensus": consensus}) + + +def test_stage5_without_an_approval_calibrates_commits_and_pushes_nothing( + repos: SimpleNamespace, caplog: pytest.LogCaptureFixture +) -> None: + caplog.set_level(logging.INFO) + ctx, heads_before = _execution_ctx(repos), _branch_heads(repos) + + result, calibration = _run_stage5(ctx) + + assert (result.status, result.stage) == (StageStatus.FAILED, FlowStage.CALIBRATE) + assert "no Stage 4 approval recorded" in result.error and "nothing was calibrated or pushed" in result.error + assert "Run the review stage first" in result.error + assert result.payload["merged_head_ci"]["state"] != "skipped" + calibration.assert_not_called() + assert _branch_heads(repos) == heads_before + assert run_sync_git(repos.host, "branch", "--list", SYNC_CALIBRATED) == "" + assert OLD_PASS_THROUGH not in caplog.text and OLD_PASS_THROUGH not in "\n".join(ctx.logs) + + +def test_stage5_with_an_approval_at_the_execution_head_still_calibrates(repos: SimpleNamespace) -> None: + ctx = _execution_ctx(repos) + approve_execution_head(ctx, repos.host, SYNC_EXEC) + + result, calibration = _run_stage5(ctx) + + assert result.status is StageStatus.SUCCESS + calibration.assert_called_once() + assert calibration.call_args.args[1]["state"] == "stage4" + + +@pytest.mark.parametrize( + ("flags", "reason"), + [ + ({"dry_run": True}, "dry run"), + ({"skip_push": True}, "push skipped"), + ({"execution_branch": None}, "no execution branch"), + ], +) +def test_runs_that_publish_nothing_keep_the_skipped_record_without_an_approval( + tmp_path: Path, caplog: pytest.LogCaptureFixture, flags: dict[str, Any], reason: str +) -> None: + caplog.set_level(logging.INFO) + ctx = FlowContext(repo_dir=str(tmp_path), **{"execution_branch": SYNC_EXEC, **flags}) + + stopped, record = stage5_merged_head_gate(ctx) + + assert stopped is None + assert (record["state"], record["reason"]) == ("skipped", reason) + assert OLD_PASS_THROUGH not in caplog.text and OLD_PASS_THROUGH not in "\n".join(ctx.logs) + + +@pytest.mark.parametrize( + "consensus", + [ + {"approved": False, "withdrawn": {"merged_head": "b" * 40, "approved_head": APPROVED}}, + {"approved": False, "pipeline_defect": {"head_sha": "b" * 40, "approved_head": APPROVED}}, + ], +) +def test_a_pending_withdrawal_or_scoped_restart_still_reenters_stage4( + tmp_path: Path, consensus: dict[str, Any] +) -> None: + ctx = FlowContext(repo_dir=str(tmp_path), execution_branch=SYNC_EXEC) + ctx.stage_results["review"] = _review(**consensus) + + stopped, _ = stage5_merged_head_gate(ctx) + + assert stopped is not None and stopped.status is StageStatus.SKIPPED + assert stopped.payload["review_restart"] is True + assert "no Stage 4 approval recorded" not in (stopped.error or "") + + +def test_an_approval_at_the_execution_head_relies_on_stage4_ci(tmp_path: Path) -> None: + ctx = FlowContext(repo_dir=str(tmp_path), execution_branch=SYNC_EXEC) + ctx.stage_results["review"] = _review(approved=True, target_commit=APPROVED) + + stopped, record = stage5_merged_head_gate(ctx, MergedHeadSeams(head_reader=lambda: APPROVED)) + + assert stopped is None + assert (record["state"], record["head_sha"]) == ("stage4", APPROVED) diff --git a/apps/sandbox-executor/tests/test_calibrate_rerun.py b/apps/sandbox-executor/tests/test_calibrate_rerun.py index ffddef3cd..c5b1519d9 100644 --- a/apps/sandbox-executor/tests/test_calibrate_rerun.py +++ b/apps/sandbox-executor/tests/test_calibrate_rerun.py @@ -847,15 +847,14 @@ def test_the_gate_defers_to_the_stage5_still_ahead_in_this_run_and_posts_nothing assert (thread.posted, thread.edits, len(calls)) == ([], [], 1) -def test_the_review_gate_posts_the_refreshed_comment_without_an_approved_consensus( - calibrated_moved: SimpleNamespace, -) -> None: +def test_the_review_gate_refuses_the_rerun_without_an_approved_consensus(calibrated_moved: SimpleNamespace) -> None: ctx, _, calls, run = calibrated_flow(calibrated_moved) seams, posted = recording_seams() record = review_calibration_freshness(ctx, "7", run_stage=run, seams=seams) - assert (record["moved"], record["rerun"]) == (True, True) + assert (record["moved"], record["rerun"], record["rerun_status"]) == (True, True, "failed") + assert "no Stage 4 approval recorded" in record["rerun_error"] assert len(calls) == 2 - assert (len(stale_warnings(posted)), len(refreshed_notes(posted))) == (0, 1) + assert (len(stale_warnings(posted)), len(refreshed_notes(posted))) == (1, 0) def test_posting_gate_reports_calibration_freshness(tmp_path: Path) -> None: diff --git a/apps/sandbox-executor/tests/test_merged_head_ci_gate.py b/apps/sandbox-executor/tests/test_merged_head_ci_gate.py index 75a344a84..30ad199c8 100644 --- a/apps/sandbox-executor/tests/test_merged_head_ci_gate.py +++ b/apps/sandbox-executor/tests/test_merged_head_ci_gate.py @@ -328,10 +328,12 @@ def test_dry_run_and_skip_push_keep_todays_path(tmp_path: Path, flags: dict[str, assert fakes.probed == [] -def test_no_recorded_approval_keeps_todays_path(tmp_path: Path) -> None: +def test_no_recorded_approval_refuses_calibration(tmp_path: Path) -> None: fakes = Fakes([check("unit", "failure")]) stopped, record = stage5_merged_head_gate(_ctx(tmp_path), _seams(fakes)) - assert stopped is None and record["reason"] == "no Stage 4 approval recorded" + assert stopped.status is StageStatus.FAILED and stopped.stage is FlowStage.CALIBRATE + assert "no Stage 4 approval recorded" in stopped.error + assert record["reason"] == "no Stage 4 approval recorded" and record["state"] != "skipped" assert fakes.probed == [] From 0067edd5988b0a3ccd4c8aff0fdba549fdc1b499 Mon Sep 17 00:00:00 2001 From: Holon Executor Agent Date: Tue, 1 Dec 2026 13:10:25 +0000 Subject: [PATCH 06/11] Step 7: keep the old pass-through text out of the tests --- .../tests/flow/test_stage5_no_approval_refusal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py b/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py index 89f199e5d..146abbf15 100644 --- a/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py +++ b/apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py @@ -9,7 +9,7 @@ import pytest from sandbox_executor.flow import FlowContext, FlowStage, StageResult, StageStatus from sandbox_executor.flow.review.merged_head_gate import MergedHeadSeams -from sandbox_executor.flow.review_restart import stage5_merged_head_gate +from sandbox_executor.flow.review_restart import NO_APPROVAL, stage5_merged_head_gate from sandbox_executor.flow.stages.calibrate import run_calibrate_stage from tests.calibrate_scenarios import ( @@ -22,7 +22,7 @@ ) from tests.repo_templates import shared_template -OLD_PASS_THROUGH = "Merged-head CI gate skipped: no Stage 4 approval recorded" +OLD_PASS_THROUGH = f"Merged-head CI gate skipped: {NO_APPROVAL}" APPROVED = "a" * 40 From 481d40e506759f2eabc62190302a824218fd0843 Mon Sep 17 00:00:00 2001 From: Holon Executor Agent Date: Tue, 1 Dec 2026 13:10:53 +0000 Subject: [PATCH 07/11] Execution notes for E-1796129613-CLA-CO5.5 --- executions/E-1796129613-CLA-CO5.5.md | 90 +++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 7 deletions(-) diff --git a/executions/E-1796129613-CLA-CO5.5.md b/executions/E-1796129613-CLA-CO5.5.md index 428c0d827..afd27dec5 100644 --- a/executions/E-1796129613-CLA-CO5.5.md +++ b/executions/E-1796129613-CLA-CO5.5.md @@ -2,17 +2,93 @@ ## Summary -Implements plan `P-1796129447-CLA-CO5.5` for intent `I-1796129423-stage5-no-approval-refusal`: Stage 5 refuses inside -the merged-head gate when no Stage 4 approval is recorded, instead of skipping the gate and calibrating. +Implements plan `P-1796129447-CLA-CO5.5` for intent `I-1796129423-stage5-no-approval-refusal`: Stage 5 now refuses +inside the merged-head gate when no Stage 4 approval is recorded, instead of logging "Merged-head CI gate skipped" and +calibrating. The refusal is a failed CALIBRATE `StageResult` built through `_stage_failure`, with a gate record whose +`state` is `refused` and whose `reason` is `no Stage 4 approval recorded`. The resumed-restart branch, and the dry run, +skip_push and no-execution-branch skips, keep their order and behaviour. `calibrate_rerun.py`, `merged_head_routing.py` +and `merged_head_gate.py` are unchanged. ## Actual Metrics | metric | value | | --------------------- | ----- | -| success_actual | 0.0 | -| entropy_actual | 0.0 | -| impact_actual | 0.0 | -| cost_actual | 0.0 | -| learning_value_actual | 0.0 | +| success_actual | 1.0 | +| entropy_actual | 5.4 | +| impact_actual | 72.0 | +| cost_actual | 12.0 | +| learning_value_actual | 4.0 | ## Steps Executed + +1. **Step 1 (baseline):** grep found the expected two sites only (`flow/review_restart.py:57` and + `tests/test_merged_head_ci_gate.py:334`). Starting line counts matched the plan (165, 218, 327, 935, 944, 851). The + in-scope test files plus `tests/flow/test_stage5_fail_closed.py` passed: 440 passed. +2. **Step 2 (refusal):** in `flow/review_restart.py`, `_skip_reason` now covers the three flag cases only. A new + `NO_APPROVAL` constant and `_refuse_unapproved(context, start)` build the refusal with `gate_record` and + `_stage_failure`. The error says nothing was calibrated or pushed and advises running the review stage first. The + checks run in order (resumed restart, flag skip, approval refusal) in a new `_settled_before_head_check`, because + adding the refusal inline put `stage5_merged_head_gate` over the ruff `PLR0911` return limit. After this change the + affected set failed exactly as A2 measured: 27 failed, 26 errors. +3. **Step 3 (fixtures):** `tests/calibrate_scenarios.py` gained these helpers: + - `record_stage4_approval` + - `approve_execution_head`, which reads the origin ref first and falls back to the local ref + - `approved_at_execution_head`, a context manager that records the approval and pins the head the gate reads + + The context manager is needed because a repository with no origin execution ref, or no git at all, would make the + gate call `gh pr view` for real, which is not hermetic. The helpers are applied in each file's shared runner or + context: + - `test_calibrate_sync.py`, via `run_stage`, which also covers `test_calibrate_rebuild.py` + - `test_calibrate_rerun.py`: `calibrate_a_copy` approves the head with no PR number, then drops the review again so + the cached first run keeps no approval. `approve_pr` now approves the origin head. One test approves its second + moved head before the rerun. + - `test_pipeline.py`, `test_calibrate_final_head_ci.py`, `test_conflict_gate.py`, `test_sync_points.py`, + `test_ledger_append_only.py`, `test_calibration_commit.py` and `test_git_refs.py` + + No assertion was changed in this step. + +4. **Step 4 (freshness rerun):** with no approved consensus, the existing failed-rerun path in `_rerun_while_stale` and + `_stale_gate_record` gives `rerun_status: failed`, a `rerun_error` that names the missing approval, one stale warning + and no refreshed note. Nothing raises. No change to `calibrate_rerun.py` was needed. +5. **Step 5 (tests):** two tests were rewritten in place: + - `test_no_recorded_approval_keeps_todays_path` became `test_no_recorded_approval_refuses_calibration`. + - `test_the_review_gate_posts_the_refreshed_comment_without_an_approved_consensus` became + `test_the_review_gate_refuses_the_rerun_without_an_approved_consensus`. + + The new `tests/flow/test_stage5_no_approval_refusal.py` has 8 tests, covering: + - a refusal on a template-copied repository, with no calibration call, unchanged local and origin heads and no + calibrated branch + - an approved control that does calibrate, through the `stage4` record + - the dry run, skip_push and no-execution-branch skips + - a withdrawal and a scoped restart still re-entering Stage 4 + - an approval at the head relying on Stage 4 CI + - `caplog` and `ctx.logs` never containing the old pass-through line + +6. **Step 6 (verification):** affected tests, lint and the full suite all passed (see below). +7. **Step 7 (audit):** the source and test changes are 13 files, all in the 17-path scope. `module_budgets.json`, + `merged_head_routing.py`, `merged_head_gate.py`, `calibrate_rerun.py` and the documentation are untouched. The other + paths in `git diff --name-only origin/main...HEAD` are the plan, intent and ledger bookkeeping from the earlier flow + commits, plus this record. Grep for the old pass-through string over `apps/sandbox-executor` is empty; the new test + builds it from `NO_APPROVAL`. Line counts: `test_pipeline.py` 940, `test_calibrate_rerun.py` 950, + `test_sync_points.py` 855, `calibrate_scenarios.py` 364, `review_restart.py` 184. No new `def test_` was added to the + three large files; the one added line in `test_calibrate_rerun.py` is the in-place rename. + +## Tests Run + +| command | result | +| -------------------------------------------------------------------------------------------- | ---------------------------------------------------- | +| baseline: `uv run pytest -n auto --dist worksteal` over the 13 in-scope files + fail-closed | 440 passed in 17.54s | +| after Step 2, same set | 387 passed, 27 failed, 26 errors in 15.87s | +| after Step 3: `test_calibrate_sync.py` + `test_calibrate_rebuild.py` | 36 passed in 4.17s | +| after Step 3: `test_calibrate_rerun.py` (`-n 8`) | 42 passed, 1 failed (rewritten in Step 5) | +| after Step 3: final_head_ci, conflict_gate, ledger_append_only, calibration_commit, git_refs | 151 passed in 45.19s | +| after Step 3: `test_sync_points.py` + `test_pipeline.py` | 87 passed in 26.62s | +| after Step 5: `test_calibrate_rerun.py` + `test_merged_head_ci_gate.py` | 93 passed in 12.90s | +| after Step 5: `tests/flow/test_stage5_no_approval_refusal.py` | 8 passed in 8.09s | +| Step 6: all in-scope test paths + `test_stage5_fail_closed.py` | 448 passed in 47.14s | +| Step 6: `uv run task lint` | exit 0 (budgets 439 modules, self-explaining passed) | +| Step 6: `uv run task test` (single run) | 11212 passed, 8 skipped in 91.84s | +| Step 7: `python scripts/check_module_budgets.py`, `python scripts/check_self_explaining.py` | both passed | +| Step 7: `tests/flow/test_stage5_no_approval_refusal.py` after the string change | 8 passed in 0.32s | + +This is not a timing intent, so the full suite ran once. The median of the single full run is `91.84s`. From 0cc7ab5b86e5b3357829d9582781e4913d9c623d Mon Sep 17 00:00:00 2001 From: Holon Executor Agent Date: Tue, 1 Dec 2026 13:12:58 +0000 Subject: [PATCH 08/11] execute: E-1796129613-CLA-CO5.5 completed for plan I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_ --- .../executions/I-1796129423-stage5-no-approval-refusal.jsonl | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl diff --git a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl new file mode 100644 index 000000000..1e473114f --- /dev/null +++ b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl @@ -0,0 +1,3 @@ +{"action_id": "ACT-1796130656-3fd3a160", "execution_id": "E-1796129613-CLA-CO5.5", "action": "Executed agent claude-agent with model claude-opus-5-5", "category": "code", "target": "claude-agent:claude-opus-5-5", "outcome": "success", "entry_type": "action", "parent_action_id": null, "event_type": "command_execution", "labels": ["agent", "claude-agent", "execution"], "error_context": null, "mistake_category": null, "action_origin": "initial_implementation", "review_severity": null, "review_iteration": null, "review_finding_ids": null, "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "created_at": "2026-12-01T13:10:56.701483Z"} +{"entry_type": "summary", "execution_id": "E-1796129613-CLA-CO5.5", "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "agent": "claude-agent", "agent_version": "2.1.302", "model": "claude-opus-5-5", "status": "success", "summary": "Plan executed successfully", "created_at": "2026-12-01T12:53:34.246705Z", "agent_output_truncated": false, "agent_output_bytes": 238, "ledger_revision": 1, "execution_notes": "executions/E-1796129613-CLA-CO5.5.md", "execution_notes_valid": true, "elapsed_seconds": 1162.6, "budget_seconds": 604723.0, "test_pass_rate": 1.0, "tests_passed": 11212, "tests_failed": 0, "tests_errored": 0, "test_exit_code": 0, "test_source": "stage_3"} +{"action_id": "ACT-1796130776-e31361da", "execution_id": "E-1796129613-CLA-CO5.5", "action": "Committed execution changes: execute: E-1796129613-CLA-CO5.5 completed for plan I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "category": "code", "target": "HEAD", "outcome": "success", "entry_type": "action", "parent_action_id": null, "event_type": "git_mutation", "labels": ["commit", "git"], "error_context": null, "mistake_category": null, "action_origin": "initial_implementation", "review_severity": null, "review_iteration": null, "review_finding_ids": null, "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "created_at": "2026-12-01T13:12:56.829011Z"} From b1789f24e77984db96a903ab50715a68f8925c14 Mon Sep 17 00:00:00 2001 From: Holon Review Loop Agent Date: Wed, 2 Dec 2026 00:40:04 +1100 Subject: [PATCH 09/11] chore(review): record review ledger rows (iteration 1) Action-Origin: pr_review Review-Iteration: 1 --- .../I-1796129423-stage5-no-approval-refusal.jsonl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl index 1e473114f..6d1d59013 100644 --- a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl +++ b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl @@ -1,3 +1,13 @@ {"action_id": "ACT-1796130656-3fd3a160", "execution_id": "E-1796129613-CLA-CO5.5", "action": "Executed agent claude-agent with model claude-opus-5-5", "category": "code", "target": "claude-agent:claude-opus-5-5", "outcome": "success", "entry_type": "action", "parent_action_id": null, "event_type": "command_execution", "labels": ["agent", "claude-agent", "execution"], "error_context": null, "mistake_category": null, "action_origin": "initial_implementation", "review_severity": null, "review_iteration": null, "review_finding_ids": null, "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "created_at": "2026-12-01T13:10:56.701483Z"} {"entry_type": "summary", "execution_id": "E-1796129613-CLA-CO5.5", "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "agent": "claude-agent", "agent_version": "2.1.302", "model": "claude-opus-5-5", "status": "success", "summary": "Plan executed successfully", "created_at": "2026-12-01T12:53:34.246705Z", "agent_output_truncated": false, "agent_output_bytes": 238, "ledger_revision": 1, "execution_notes": "executions/E-1796129613-CLA-CO5.5.md", "execution_notes_valid": true, "elapsed_seconds": 1162.6, "budget_seconds": 604723.0, "test_pass_rate": 1.0, "tests_passed": 11212, "tests_failed": 0, "tests_errored": 0, "test_exit_code": 0, "test_source": "stage_3"} {"action_id": "ACT-1796130776-e31361da", "execution_id": "E-1796129613-CLA-CO5.5", "action": "Committed execution changes: execute: E-1796129613-CLA-CO5.5 completed for plan I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "category": "code", "target": "HEAD", "outcome": "success", "entry_type": "action", "parent_action_id": null, "event_type": "git_mutation", "labels": ["commit", "git"], "error_context": null, "mistake_category": null, "action_origin": "initial_implementation", "review_severity": null, "review_iteration": null, "review_finding_ids": null, "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "created_at": "2026-12-01T13:12:56.829011Z"} +{"action_id": "ACT-REV-1796132392-44232313", "execution_id": "REV-ITR-1-1796132392", "action": "Review Loop iteration 1 reviewer 1 completed", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "reviewer", "iteration-1"], "error_context": null, "review_reviewer_index": 1, "review_agent": "claude-agent", "review_model": "claude-opus-5-5", "review_status": "COMPLETED", "review_verdict": "APPROVED", "review_counts": {"critical": 0, "important": 0, "nit": 0}, "created_at": "2026-12-01T13:39:52.006375Z"} +{"action_id": "ACT-REV-1796132392-2d568896", "execution_id": "REV-ITR-1-1796132392", "action": "Review Loop iteration 1 reviewer 2 completed", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "reviewer", "iteration-1"], "error_context": null, "review_reviewer_index": 2, "review_agent": "claude-agent", "review_model": "claude-opus-5-5", "review_status": "COMPLETED", "review_verdict": "APPROVED", "review_counts": {"critical": 0, "important": 0, "nit": 0}, "created_at": "2026-12-01T13:39:52.009650Z"} +{"action_id": "ACT-REV-1796132392-b082151b", "execution_id": "REV-ITR-1-1796132392", "action": "Review Loop iteration 1 reviewer 3 completed", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "reviewer", "iteration-1"], "error_context": null, "review_reviewer_index": 3, "review_agent": "claude-agent", "review_model": "claude-opus-5-5", "review_status": "COMPLETED", "review_verdict": "APPROVED", "review_counts": {"critical": 0, "important": 0, "nit": 0}, "created_at": "2026-12-01T13:39:52.012274Z"} +{"action_id": "ACT-REV-1796132395-69bfadb0", "execution_id": "REV-ITR-1-1796132395", "action": "Review Loop iteration 1 evaluation for I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "review-loop", "iteration-1"], "error_context": null, "created_at": "2026-12-01T13:39:55.791188Z"} +{"action_id": "ACT-REV-1796132395-d187db99", "execution_id": "REV-ITR-1-1796132395", "action": "Review Loop iteration 1 reviewer 1 completed", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "reviewer", "iteration-1"], "error_context": null, "review_reviewer_index": 1, "review_agent": "claude-agent", "review_model": "claude-opus-5-5", "review_status": "COMPLETED", "review_verdict": "APPROVED", "review_counts": {"critical": 0, "important": 0, "nit": 0}, "created_at": "2026-12-01T13:39:55.793510Z"} +{"action_id": "ACT-REV-1796132395-bef38399", "execution_id": "REV-ITR-1-1796132395", "action": "Review Loop iteration 1 reviewer 2 completed", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "reviewer", "iteration-1"], "error_context": null, "review_reviewer_index": 2, "review_agent": "claude-agent", "review_model": "claude-opus-5-5", "review_status": "COMPLETED", "review_verdict": "APPROVED", "review_counts": {"critical": 0, "important": 0, "nit": 0}, "created_at": "2026-12-01T13:39:55.794814Z"} +{"action_id": "ACT-REV-1796132395-71313aee", "execution_id": "REV-ITR-1-1796132395", "action": "Review Loop iteration 1 reviewer 3 completed", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": null, "labels": ["review", "reviewer", "iteration-1"], "error_context": null, "review_reviewer_index": 3, "review_agent": "claude-agent", "review_model": "claude-opus-5-5", "review_status": "COMPLETED", "review_verdict": "APPROVED", "review_counts": {"critical": 0, "important": 0, "nit": 0}, "created_at": "2026-12-01T13:39:55.796063Z"} +{"action_id": "ACT-POST-1796132399-cb4455b9", "execution_id": "REV-POST-1796132399", "action": "Review consensus dual-posted to GitHub for I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_iteration": 1, "labels": ["review", "github", "dual-post"], "created_at": "2026-12-01T13:39:59.869526Z"} +{"execution_id": "REV-1796132402-c7a328ca-claude-agent", "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "execution_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "agent": "claude-agent", "agent_version": "1.4.0", "model": "claude-opus-5-5", "status": "approved", "entry_type": "summary", "summary": "Review Loop reached consensus approval after 1 iteration(s); PR ready for maintainer merge; final verdicts: Reviewer 1 APPROVED (0/0/0); Reviewer 2 APPROVED (0/0/0); Reviewer 3 APPROVED (0/0/0)", "created_at": "2026-12-01T13:40:02.405Z", "total_iterations": 1, "max_iterations": 25, "ci_checks_summary": {"source": "github_cli", "total": 16, "passed": 16, "failed": 0, "pending": 0, "skipped": 0, "all_passed": true, "checks": [{"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665946434", "name": "unit (macos-latest, shard 1 of 2)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146571/job/142665947186", "name": "build (macos-latest)", "state": "SUCCESS", "workflow": "Run Make"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665945814", "name": "unit (macos-latest, shard 2 of 2)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/runs/142666281360", "name": "CodeQL", "state": "SUCCESS", "workflow": ""}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146529/job/142665947382", "name": "Workspace survival (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Stress"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146571/job/142665946414", "name": "build (ubuntu-latest)", "state": "SUCCESS", "workflow": "Run Make"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146509/job/142665946437", "name": "hygiene (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Hygiene"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146386/job/142665945183", "name": "scan", "state": "SUCCESS", "workflow": "Test - No Harness References"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146605/job/142665946620", "name": "self-doc-behavior", "state": "SUCCESS", "workflow": "Test - Self-Doc Behavior"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146645/job/142665946585", "name": "ledger-invariants", "state": "SUCCESS", "workflow": "Test - Ledger Invariants"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665946472", "name": "unit (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "dynamic", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654140379/job/142665942999", "name": "Analyze (python)", "state": "SUCCESS", "workflow": "CodeQL"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146774/job/142665947646", "name": "integration (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Integration"}, {"bucket": "pass", "event": "dynamic", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654140379/job/142665942483", "name": "Analyze (actions)", "state": "SUCCESS", "workflow": "CodeQL"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146357/job/142665945828", "name": "commit-trailers", "state": "SUCCESS", "workflow": "Test - Commit Trailers"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146475/job/142665946582", "name": "build", "state": "SUCCESS", "workflow": "Docker Build"}], "test_source": "ci_head", "test_head_sha": "0cc7ab5b86e5b3357829d9582781e4913d9c623d"}, "trailers": {"action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": ["none"], "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "consulted_knowledge_ids": null}, "review_post_withheld": null} +{"execution_id": "REV-1796132402-c7a328ca-claude-agent", "action": "Review Loop executed for I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "category": "test", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "verdict": "success", "outcome": "success", "entry_type": "action", "context_fingerprint": "903442abc7de1a0b", "labels": ["review", "review-loop", "claude-agent"], "error_context": null, "action_id": "ACT-1796132402-1eef1454", "created_at": "2026-12-01T13:40:02.405784Z"} From fea8a1ebcab1136852a63e97b3b0e2f313ac9c4c Mon Sep 17 00:00:00 2001 From: Holon Calibrate Agent Date: Wed, 2 Dec 2026 00:40:41 +1100 Subject: [PATCH 10/11] chore(calibration): add calibration report for P-1796129447-CLA-CO5.5 --- ...796129423-stage5-no-approval-refusal.jsonl | 1 + .../P-1796129447-CLA-CO5.5_calibration.md | 106 ++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5_calibration.md diff --git a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl index 6d1d59013..b60673ab9 100644 --- a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl +++ b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl @@ -11,3 +11,4 @@ {"action_id": "ACT-POST-1796132399-cb4455b9", "execution_id": "REV-POST-1796132399", "action": "Review consensus dual-posted to GitHub for I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "category": "code", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "outcome": "success", "entry_type": "action", "action_origin": "pr_review", "review_iteration": 1, "labels": ["review", "github", "dual-post"], "created_at": "2026-12-01T13:39:59.869526Z"} {"execution_id": "REV-1796132402-c7a328ca-claude-agent", "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "execution_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "agent": "claude-agent", "agent_version": "1.4.0", "model": "claude-opus-5-5", "status": "approved", "entry_type": "summary", "summary": "Review Loop reached consensus approval after 1 iteration(s); PR ready for maintainer merge; final verdicts: Reviewer 1 APPROVED (0/0/0); Reviewer 2 APPROVED (0/0/0); Reviewer 3 APPROVED (0/0/0)", "created_at": "2026-12-01T13:40:02.405Z", "total_iterations": 1, "max_iterations": 25, "ci_checks_summary": {"source": "github_cli", "total": 16, "passed": 16, "failed": 0, "pending": 0, "skipped": 0, "all_passed": true, "checks": [{"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665946434", "name": "unit (macos-latest, shard 1 of 2)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146571/job/142665947186", "name": "build (macos-latest)", "state": "SUCCESS", "workflow": "Run Make"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665945814", "name": "unit (macos-latest, shard 2 of 2)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/runs/142666281360", "name": "CodeQL", "state": "SUCCESS", "workflow": ""}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146529/job/142665947382", "name": "Workspace survival (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Stress"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146571/job/142665946414", "name": "build (ubuntu-latest)", "state": "SUCCESS", "workflow": "Run Make"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146509/job/142665946437", "name": "hygiene (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Hygiene"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146386/job/142665945183", "name": "scan", "state": "SUCCESS", "workflow": "Test - No Harness References"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146605/job/142665946620", "name": "self-doc-behavior", "state": "SUCCESS", "workflow": "Test - Self-Doc Behavior"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146645/job/142665946585", "name": "ledger-invariants", "state": "SUCCESS", "workflow": "Test - Ledger Invariants"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665946472", "name": "unit (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "dynamic", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654140379/job/142665942999", "name": "Analyze (python)", "state": "SUCCESS", "workflow": "CodeQL"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146774/job/142665947646", "name": "integration (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Integration"}, {"bucket": "pass", "event": "dynamic", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654140379/job/142665942483", "name": "Analyze (actions)", "state": "SUCCESS", "workflow": "CodeQL"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146357/job/142665945828", "name": "commit-trailers", "state": "SUCCESS", "workflow": "Test - Commit Trailers"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146475/job/142665946582", "name": "build", "state": "SUCCESS", "workflow": "Docker Build"}], "test_source": "ci_head", "test_head_sha": "0cc7ab5b86e5b3357829d9582781e4913d9c623d"}, "trailers": {"action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": ["none"], "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "consulted_knowledge_ids": null}, "review_post_withheld": null} {"execution_id": "REV-1796132402-c7a328ca-claude-agent", "action": "Review Loop executed for I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "category": "test", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "verdict": "success", "outcome": "success", "entry_type": "action", "context_fingerprint": "903442abc7de1a0b", "labels": ["review", "review-loop", "claude-agent"], "error_context": null, "action_id": "ACT-1796132402-1eef1454", "created_at": "2026-12-01T13:40:02.405784Z"} +{"action_id": "ACT-CAL-1796132441-8ca4e1bf", "execution_id": "CAL-P-1796129447-CLA-CO5.5-1796132441-52c24fc5", "action": "Calibration report generated for plan P-1796129447-CLA-CO5.5", "category": "doc", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/calibrated", "outcome": "success", "entry_type": "action", "action_origin": "calibration", "labels": ["calibration", "stage-5", "P-1796129447-CLA-CO5.5"], "error_context": null, "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "execution_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "evaluated_commit_sha": "b1789f24e77984db96a903ab50715a68f8925c14", "predicted_metrics": {"p_success": 0.84, "entropy": 6.6, "impact": 72.0, "cost": 14.0, "learning_value": 4.0, "ev": 46.5}, "actual_metrics": {"p_success": 1.0, "entropy": 1.26, "impact": 72.0, "cost": 11.9, "learning_value": 4.0, "ev": 61.72, "duration_seconds": null, "tokens": null, "exit_code": 0, "test_pass_rate": 1.0, "files_changed": 13, "insertions": 262, "deletions": 30, "ev_clean": 61.72, "ev_with_bugs": 61.72, "p_success_clean": 1.0, "p_success_with_bugs": 1.0, "impact_clean": 72.0, "impact_with_bugs": 72.0, "bug_ev_drag": 0.0}, "calibration_deltas": {"p_success_error": 0.16, "entropy_error": 5.34, "impact_error": 0.0, "cost_error": 2.1, "learning_value_error": 0.0, "ev_error": 15.22, "delta_ev": 15.22, "delta_ev_clean": 15.22, "delta_ev_with_bugs": 15.22, "bug_ev_drag": 0.0}, "calibration_report_path": "plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5_calibration.md", "created_at": "2026-12-01T13:40:41.535630Z", "touch_set_accuracy": {"precision": 0.7647058823529411, "recall": 1.0, "unpredicted_paths": [], "unused_entries": ["apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py", "apps/sandbox-executor/tests/test_calibrate_rebuild.py", "apps/sandbox-executor/tests/test_review_restart.py", "apps/sandbox-executor/tests/test_calibrate_staleness.py"]}, "calibration_agent": "claude-agent", "calibration_model": "claude-opus-5-5", "plan_agent": "claude-agent", "plan_model": "claude-opus-5-5"} diff --git a/plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5_calibration.md b/plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5_calibration.md new file mode 100644 index 000000000..b2d85a9d2 --- /dev/null +++ b/plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5_calibration.md @@ -0,0 +1,106 @@ +# Plan Calibration Report: P-1796129447-CLA-CO5.5 + +- **Plan Reference:** + [`plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5.md`](P-1796129447-CLA-CO5.5.md) +- **Execution ID:** `E-1796129613-CLA-CO5.5` +- **Execution Branch:** `I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_` +- **Intent Branch:** `I-1796129423-stage5-no-approval-refusal/_` +- **Evaluating Agent:** `claude-agent/claude-opus-5-5` +- **Plan Agent:** `claude-agent/claude-opus-5-5` +- **Evaluation Timestamp:** `2026-12-01T13:40:40.000Z` +- **Evaluated Commit SHA:** `b1789f24e77984db96a903ab50715a68f8925c14` +- **Base SHA:** `5c3f1352f2f213a850f07cff0149ffb8115ba162` +- **Merge-Base SHA:** `5c3f1352f2f213a850f07cff0149ffb8115ba162` +- **Merged Commits:** `0` +- **Patch Size Base:** `plan` + +--- + +## 1. Executive Calibration Summary + +| Metric | Predicted (`pred`) | Actual (`actual`) | Absolute Error (`abs(pred - actual)`) | Accuracy Rating | Bias Direction | +| :------------------------------------------------- | :----------------- | :---------------- | :------------------------------------ | :-------------- | :------------------------- | +| **$P(\text{success})$** | `0.84` | `1.00` | `0.16` | Moderate | Slight Underconfidence | +| **Entropy ($\Delta S$)** | `6.60` | `1.26` | `5.34` | Moderate | Overestimated Risk | +| **Impact** | `72.00` | `72.00` | `0.00` | Exact | Perfectly Calibrated | +| **Cost** | `14.00` | `11.90` | `2.10` | Moderate | Conservative Cost Estimate | +| **Learning Value** | `4.00` | `4.00` | `0.00` | Exact | Perfectly Calibrated | +| **Expected Value — Clean (without bugs)** | `46.50` | `61.72` | `15.22` | Moderate | Conservative Underestimate | +| **Expected Value — Observed (with bugs included)** | `46.50` | `61.72` | `15.22` | Moderate | Conservative Underestimate | +| **Bug EV Drag** | `0.00` | `0.00` | `0.00` | - | Drag Penalty | + +--- + +## 2. Mathematical Derivations & Calibration Errors + +- **Success Probability Error:** $|0.84 - 1.00| = 0.16$ +- **Entropy Error:** $|6.60 - 1.26| = 5.34$ +- **Impact Error:** $|72.00 - 72.00| = 0.00$ +- **Cost Error:** $|14.00 - 11.90| = 2.10$ +- **Learning Value Error:** $|4.00 - 4.00| = 0.00$ +- **Expected Value Realization:** + $$EV_{\text{pred}} = 0.84 \times 72.0 + 0.5 \times 4.0 - 0.3 \times 6.60 - 14.00 = 46.50$$ + $$EV_{\text{actual}} = EV_{\text{clean}} = 1.00 \times 72.0 + 0.5 \times 4.0 - 0.3 \times 1.26 - 11.90 = 61.72$$ + $$EV_{\text{with\_bugs}} = 1.00 \times 72.0 + 0.5 \times 4.0 - 0.3 \times 1.26 - 11.90 = 61.72$$ + $$\text{Bug EV Drag} = round(EV_{\text{clean}} - EV_{\text{with\_bugs}}, 2) = 0.00$$ $$\Delta EV = +15.22$$ + +--- + +## 3. Entropy Factor Breakdown + +- **State Surface Area (SSA):** Predicted `0.6` vs Observed `4.1` (13 files modified). +- **Irreversibility (IRR):** Predicted `0.0` vs Observed `0.0` (Zero destructive or stateful changes). +- **Conflict Likelihood (CL):** Predicted `0.1` vs Observed `0.0` (Clean sequential branch merges). +- **Sandbox Escape Risk (SER):** Predicted `0.0` vs Observed `0.0` (Zero security exceptions). +- **Novelty (NOV):** Predicted `0.4` vs Observed `0.4` (Standard calibration reporting schema). + +--- + +## 4. Calibration Assessment + +Plan `P-1796129447-CLA-CO5.5` executed with minimal error ($p\_success\_error = 0.16$, $cost\_error = 2.10$). The +calibration step successfully completed the execution lifecycle and delivered verified post-execution analysis. + +--- + +## 5. Touch Set Accuracy + +- **Precision (declared entries the diff touched):** `76.5%` +- **Recall (changed files the touch set covered):** `100.0%` + +Changed files outside the touch set: + +- none + +Declared entries the diff did not touch: + +- `apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py` +- `apps/sandbox-executor/tests/test_calibrate_rebuild.py` +- `apps/sandbox-executor/tests/test_review_restart.py` +- `apps/sandbox-executor/tests/test_calibrate_staleness.py` + +--- + +## 6. Review Churn + +- **Full reviews:** `1` +- **Scoped reviews:** `0` +- **Approval carry-overs:** `0` +- **Pipeline runs:** `1` +- **Pipeline reruns:** `0` +- **Non-defect churn (target merge):** `0` +- **Non-defect churn (bookkeeping):** `0` +- **Non-defect churn (CI noise):** `0` + +--- + +## 7. Self-Explaining Code Counts + +Against the merge base with origin/main: added 0 docstring(s), added 0 comment(s), removed 0 docstring(s) and removed 0 +comment(s) across 18 changed file(s). + +- Changed files checked: 18 +- Added docstrings: 0 +- Added comments (not '# why:'): 0 +- Removed docstrings: 0 +- Removed comments (not '# why:'): 0 From d9dec04f81c9c3e0113d5312523ac74b4f7c22f8 Mon Sep 17 00:00:00 2001 From: Holon Calibrate Agent Date: Wed, 2 Dec 2026 00:40:42 +1100 Subject: [PATCH 11/11] chore(calibration): record stage 5 reconciliation --- .../executions/I-1796129423-stage5-no-approval-refusal.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl index b60673ab9..92b7aa87e 100644 --- a/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl +++ b/holon-knowledge/ledger/pending/executions/I-1796129423-stage5-no-approval-refusal.jsonl @@ -12,3 +12,4 @@ {"execution_id": "REV-1796132402-c7a328ca-claude-agent", "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "execution_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "agent": "claude-agent", "agent_version": "1.4.0", "model": "claude-opus-5-5", "status": "approved", "entry_type": "summary", "summary": "Review Loop reached consensus approval after 1 iteration(s); PR ready for maintainer merge; final verdicts: Reviewer 1 APPROVED (0/0/0); Reviewer 2 APPROVED (0/0/0); Reviewer 3 APPROVED (0/0/0)", "created_at": "2026-12-01T13:40:02.405Z", "total_iterations": 1, "max_iterations": 25, "ci_checks_summary": {"source": "github_cli", "total": 16, "passed": 16, "failed": 0, "pending": 0, "skipped": 0, "all_passed": true, "checks": [{"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665946434", "name": "unit (macos-latest, shard 1 of 2)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146571/job/142665947186", "name": "build (macos-latest)", "state": "SUCCESS", "workflow": "Run Make"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665945814", "name": "unit (macos-latest, shard 2 of 2)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/runs/142666281360", "name": "CodeQL", "state": "SUCCESS", "workflow": ""}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146529/job/142665947382", "name": "Workspace survival (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Stress"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146571/job/142665946414", "name": "build (ubuntu-latest)", "state": "SUCCESS", "workflow": "Run Make"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146509/job/142665946437", "name": "hygiene (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Hygiene"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146386/job/142665945183", "name": "scan", "state": "SUCCESS", "workflow": "Test - No Harness References"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146605/job/142665946620", "name": "self-doc-behavior", "state": "SUCCESS", "workflow": "Test - Self-Doc Behavior"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146645/job/142665946585", "name": "ledger-invariants", "state": "SUCCESS", "workflow": "Test - Ledger Invariants"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146419/job/142665946472", "name": "unit (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Unit"}, {"bucket": "pass", "event": "dynamic", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654140379/job/142665942999", "name": "Analyze (python)", "state": "SUCCESS", "workflow": "CodeQL"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146774/job/142665947646", "name": "integration (ubuntu-latest)", "state": "SUCCESS", "workflow": "Test - Integration"}, {"bucket": "pass", "event": "dynamic", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654140379/job/142665942483", "name": "Analyze (actions)", "state": "SUCCESS", "workflow": "CodeQL"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146357/job/142665945828", "name": "commit-trailers", "state": "SUCCESS", "workflow": "Test - Commit Trailers"}, {"bucket": "pass", "event": "pull_request", "link": "https://github.com/Holon-Agentic-Coder/holon-agentic-coder/actions/runs/46654146475/job/142665946582", "name": "build", "state": "SUCCESS", "workflow": "Docker Build"}], "test_source": "ci_head", "test_head_sha": "0cc7ab5b86e5b3357829d9582781e4913d9c623d"}, "trailers": {"action_origin": "pr_review", "review_severity": null, "review_iteration": 1, "review_finding_ids": ["none"], "review_disposition": null, "rejection_reason": null, "introduced_by_action_id": null, "consulted_knowledge_ids": null}, "review_post_withheld": null} {"execution_id": "REV-1796132402-c7a328ca-claude-agent", "action": "Review Loop executed for I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "category": "test", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "verdict": "success", "outcome": "success", "entry_type": "action", "context_fingerprint": "903442abc7de1a0b", "labels": ["review", "review-loop", "claude-agent"], "error_context": null, "action_id": "ACT-1796132402-1eef1454", "created_at": "2026-12-01T13:40:02.405784Z"} {"action_id": "ACT-CAL-1796132441-8ca4e1bf", "execution_id": "CAL-P-1796129447-CLA-CO5.5-1796132441-52c24fc5", "action": "Calibration report generated for plan P-1796129447-CLA-CO5.5", "category": "doc", "target": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/calibrated", "outcome": "success", "entry_type": "action", "action_origin": "calibration", "labels": ["calibration", "stage-5", "P-1796129447-CLA-CO5.5"], "error_context": null, "plan_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/_", "execution_branch": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "evaluated_commit_sha": "b1789f24e77984db96a903ab50715a68f8925c14", "predicted_metrics": {"p_success": 0.84, "entropy": 6.6, "impact": 72.0, "cost": 14.0, "learning_value": 4.0, "ev": 46.5}, "actual_metrics": {"p_success": 1.0, "entropy": 1.26, "impact": 72.0, "cost": 11.9, "learning_value": 4.0, "ev": 61.72, "duration_seconds": null, "tokens": null, "exit_code": 0, "test_pass_rate": 1.0, "files_changed": 13, "insertions": 262, "deletions": 30, "ev_clean": 61.72, "ev_with_bugs": 61.72, "p_success_clean": 1.0, "p_success_with_bugs": 1.0, "impact_clean": 72.0, "impact_with_bugs": 72.0, "bug_ev_drag": 0.0}, "calibration_deltas": {"p_success_error": 0.16, "entropy_error": 5.34, "impact_error": 0.0, "cost_error": 2.1, "learning_value_error": 0.0, "ev_error": 15.22, "delta_ev": 15.22, "delta_ev_clean": 15.22, "delta_ev_with_bugs": 15.22, "bug_ev_drag": 0.0}, "calibration_report_path": "plans/I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5_calibration.md", "created_at": "2026-12-01T13:40:41.535630Z", "touch_set_accuracy": {"precision": 0.7647058823529411, "recall": 1.0, "unpredicted_paths": [], "unused_entries": ["apps/sandbox-executor/src/sandbox_executor/flow/calibrate_rerun.py", "apps/sandbox-executor/tests/test_calibrate_rebuild.py", "apps/sandbox-executor/tests/test_review_restart.py", "apps/sandbox-executor/tests/test_calibrate_staleness.py"]}, "calibration_agent": "claude-agent", "calibration_model": "claude-opus-5-5", "plan_agent": "claude-agent", "plan_model": "claude-opus-5-5"} +{"action_id": "ACT-1796132441-1770e8f1", "parent_action_id": "I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_", "event_type": "reconciliation", "verdict": "success", "outcome": "success", "reason": "Stage 5 calibration reconciled execution outcome to success", "created_at": "2026-12-01T13:40:41.940959Z"}