Skip to content

feat(stage5): Stage 5 still calibrates a branch that has no recorded Stage 4 approval: the merged... - #472

Merged
thomashan merged 11 commits into
mainfrom
I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_
Dec 2, 2026
Merged

thomashan merged 11 commits into
mainfrom
I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_

Conversation

@thomashan

Copy link
Copy Markdown
Collaborator

Summary

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.

Key Changes

  • Implement 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.

References

None

Plan & Validation Metadata

  • Plan ID: P-1796129447-CLA-CO5.5
  • Expected Value (EV): 46.50
  • Agent: claude-agent
  • Model: claude-opus-5-5

Holon Intent Agent and others added 8 commits December 1, 2026 12:50
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
…5-no-approval-refusal/P-1796129447-CLA-CO5.5/_

@thomashan thomashan left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Ensemble Consensus Review — APPROVED (3/3)

Reviewed stage5-no-approval-refusal at 0cc7ab5b against main: 0 critical, 0 important and 0 nit findings; CI passing; mergeability CLEAN.

Role reviews:

Role (activated) Verdict Review
Engineering PASS The no-approval case now fails closed via the shared _stage_failure helper; restart and flag-skip order preserved; no import cycle; modules within budget.
Testing PASS New module covers refusal, approval, flag skips and restart re-entry; affected Stage 5 tests record an approval; 383 targeted tests pass.

Verified:

  • Stage 5 without a recorded approval refuses and calibrates, commits and pushes nothing — apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py
  • Gate record for the refusal carries reason 'no Stage 4 approval recorded' and a non-skipped state — apps/sandbox-executor/tests/test_merged_head_ci_gate.py
  • Freshness rerun without an approved consensus records a failed rerun and posts the stale warning — apps/sandbox-executor/tests/test_calibrate_rerun.py
  • Dry run, skip_push and no-execution-branch runs keep the skipped record — apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py
  • Publishing Stage 5 without a recorded approval fails closed and calibrates, commits or pushes nothing — apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py
  • The freshness rerun without an approval records a failed rerun and posts the stale warning — apps/sandbox-executor/tests/test_calibrate_rerun.py
  • No docstrings or explanatory comments were added — scripts/check_self_explaining.py
  • Stage 5 without an approval calibrates, commits and pushes nothing — apps/sandbox-executor/tests/flow/test_stage5_no_approval_refusal.py
  • The refusal carries a non-skipped gate record with the no-approval reason — apps/sandbox-executor/tests/test_merged_head_ci_gate.py
  • The freshness rerun without a consensus is recorded as failed and posts the stale warning — apps/sandbox-executor/tests/test_calibrate_rerun.py

Checks: Mergeability CLEAN · CI 16/16 passed, 0 failing, 0 pending (source: ci_head)

Covers head 0cc7ab5; change fingerprint pf2:da42904ac5df; CI at that commit: 16 of 16 checks passed.

🗳️ Ensemble Review Breakdown

  • Reviewer 1 (claude-agent / claude-opus-5-5): APPROVED (critical: 0, important: 0, nit: 0)
  • Reviewer 2 (claude-agent / claude-opus-5-5): APPROVED (critical: 0, important: 0, nit: 0)
  • Reviewer 3 (claude-agent / claude-opus-5-5): APPROVED (critical: 0, important: 0, nit: 0)
  • Ensemble Consensus Verdict: APPROVED

Reviewed by claude-agent (3-Agent Ensemble) · Model claude-opus-5-5

Stage 5 calibration will be added to this PR before merge. Merging remains with the human maintainer.

@thomashan
thomashan added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 8305645 Dec 2, 2026
18 of 20 checks passed
@thomashan
thomashan deleted the I-1796129423-stage5-no-approval-refusal/P-1796129447-CLA-CO5.5/E-1796129613-CLA-CO5.5/_ branch December 2, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant