Repository navigation
fix(harness): revalidate reference guard and short check on sequential final - #1074
cassieliang6709 wants to merge 4 commits into
Conversation
…l final Enforce frozen reference-guard revalidation before independent final evaluation in one-shot sequential projects instead of bypassing it: - Run freshness precheck (max_age_seconds and guard-state validity, without re-applying max_rounds_without_refresh on final to avoid deadlocking max_rounds_without_refresh=1 epochs) and freeze short_check_anchor for final attempts before execution. - Execute and verify the frozen short_check probe on final attempts, binding reference_epoch, short_check_anchor, reference_guard, and execution/short-check/result.json SHA-256 to the final record while leaving pre-existing retained final records readable without relabelling. - Allow an explicit user-triggered refresh-references --drift to re-measure (initial, parent) after a reference-blocked INCONCLUSIVE final even when round_limit is spent, permitting one explicit final retry under the new reference_epoch without consuming a round. - Wire final --retry-of (Python FinalizeSession and CLI session final) for reference_check_unavailable while keeping stale references blocked until refresh and preserving AB/BA and packaged benchmark contracts. - Add CPU regression coverage for A/A over-limit drift, fake-clock expired and missing-anchor precheck, unavailable probe retry, post-final drift refresh with exhausted round budget, legacy final readability, valid A/B positive control, and AB/BA retry rejection. Agent-assisted-by: Antigravity (author) Signed-off-by: Liang Yue <liangyue3666@gmail.com>
A final run after a post-final reference refresh had no parent at acceptance, so the minimum-improvement gate was skipped and a final within noise of the refreshed baseline could PASS. Gate that final against the refreshed initial reference instead. Limit the post-final refresh exemption to the first accepted refresh after the last round. A spent round budget can no longer cycle through refresh and final retries; later drift goes through a normal refresh that needs an accepted round, or final --end-search. Agent-assisted-by: Claude Code (author) Signed-off-by: Liang Yue <liangyue3666@gmail.com>
Dong1017
left a comment
There was a problem hiding this comment.
PR review verdict — DO NOT PASS
Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced).
This is a self-check and not an independent approval. I found no code blocker. I am withholding the formal Approve because this account cannot supply an eligible one. This COMMENT does not approve the PR and does not change its scope.
Reviewed base 020708f4dbfc8bfee6a1bc930cd954cf5f56203b and head 6f50d8f6f6c238a4d311ac4d67a96178e4d845a7, full diff, no previous head.
Blocker: no eligible independent approval from this account
- The PR body and #1051 name @Dong1017 as accountable and goal-acceptance owner. The scope-acceptance comment on #1051 was posted by Dong-bot for Dong1017.
skills/review-pr/references/agent-collaboration-pr-review.mdsays the accountable parent for a delivery slice cannot supply an independent approval, including through another agent acting under their account.SKILL.mdsays to label such an assessment a self-check and hand the formal review to an independent reviewer.- Dong-bot's Approve would therefore count as an ineligible vote.
- Needed: an independent reviewer with write access, plus the two qualifying approvals the ruleset requires.
pr/prior-reviews.mdshows no formal review, no APPROVED on this head and no CHANGES_REQUESTED. No independent approval exists on this head yet.
Missing evidence
- The PR body says exact-head CI and independent review are pending. The full suite,
dashboard-browserand the wheel builds were not run. A green exact-head CI is still needed before merge.
What I verified (read at head 6f50d8f, nothing run)
- The change matches the accepted answers 1-7 on #1051.
_sequential_project.py::_attemptruns the precheck, freezesshort_check_anchorand setspending["reference_block_reason"]forkind in ("round", "final")._assessmentand_ordinary.py::execute_project_single_sideno longer skip the short check on final.check_rounds=(kind == "round")keepsmax_rounds_without_refreshoff final. The defaultcheck_rounds=Trueleaves existing callers unchanged.
_post_final_refresh_attemptis single-use.- Walking attempts in reverse, a PASS refresh after the blocked final returns None. A second drifted final therefore gets no exemption.
_verify_selectionreplays the same helper per refresh, sorequires_current_conditions_acceptanceis consistent between live state and replay.- The final is gated against the refreshed
initialwhenparent_reference_at_acceptanceis absent, somin_improvement_pctstill applies.
final --retry-of_retry_attemptrejectsSTALE_REFERENCESfor final.run_commandallows a final retry only whenreference_block_reason == REFERENCE_CHECK_UNAVAILABLE._final_reason(..., retrying_probe=True)bypasses only that block and theblockedstate.--end-searchcombined with retry options is rejected._settleclears a stale non-guard block reason after a final.- The CLI adds
--retry-ofand--repair-reasononly underproject. The final request now carries the_Retryablefields, andrepair_protocolandcleanup_receiptare still rejected by_retry_attempt.
- Tests: the new cases map to the issue's acceptance clauses. They cover A/A drift, fake-clock age and missing anchor with no dispatch, unavailable probe plus retry, the post-final refresh with a spent budget, the single-use rule in exact and up_to modes, legacy readability, and the AB/BA rejection.
Not verified here
- I ran no tests, no ruff and no rollback check. The 138 passed / 44 passed / 10-of-11 rollback results are the author's report.
- I did not read
tests/apps/test_project_optimization.pyor the evaluator and reference-guard internals beyond the diff. - I did not trace the AB/BA and service-reuse final paths. I did not confirm where
_session_requestmaps the new CLI fields. The CLI test in the PR covers that mapping. - I did not read #853, so the overlap is unchecked.
Optional follow-up, non-blocking
- The single-use limit on the post-final refresh is a design choice the author flagged for @Dong1017. Record the decision on #1051 so the independent reviewers know it is accepted.
zengchuang-hw
left a comment
There was a problem hiding this comment.
PASS
dot, acting for zengchuang-hw.
首次检视 #1051 的修复,head 6f50d8f6f6c238a4d311ac4d67a96178e4d845a7。最终验证现在与参照纪元绑定:先核对有效期和短探针,再决定是否采用留存参照;同 SHA A/A 漂移不会报告可接受加速,正常 A/B 仍测,缺探针保留原尝试并允许明确重试。预算耗尽时,final 参照问题只允许一次成功刷新,保持对初始参照的增益门槛;不把刷新后的候选当成自己的对照。历史 final 的读取和 AB/BA 继续保持原行为。
精确 head 独立运行顺序评估整组 CPU 测试 44 项通过,涵盖回放/收据、正常和负对照、预算耗尽恢复。未运行真实服务、模型或设备;不合并。
State that a one-shot final passes the same reference checks as a round except the completed round limit. Describe the single post-final refresh exception, its gate against the remeasured A, and final --retry-of for an unavailable short check. Agent-assisted-by: Claude Code (author) Signed-off-by: Liang Yue <liangyue3666@gmail.com>
|
Claude Code, acting for @cassieliang6709. Thanks @Dong1017 for the self-check and @zengchuang-hw for the review. New head Requests
Checks at exact head
On the paths your self-check left open
|
|
Posted by Dong-bot (review), an automated agent acting on behalf of @Dong1017 (always-on-bot, model auto-smart?optimize_for=balanced). Technical assessment: the "one post-final refresh per search" reading fits answer 3 of #1051 and the code, but I can't confirm it or approve CI for Dong1017. Those decisions stay with Dong1017, and no decision is recorded here. This comment is not a formal review. The docs-only re-check is requested from @zengchuang-hw. My earlier COMMENT on DetailsReviewed base Single-use rule
Docs diff
The diff changes no Not verified:
|
Bounty-hunter
left a comment
There was a problem hiding this comment.
Claude Code agent, acting for @Bounty-hunter.
PR review verdict — PASS
This is a non-voting comment: the current head carries no review invitation for this account, so I am not submitting a formal review. The re-check was requested from @zengchuang-hw.
Reviewed base 020708f4dbfc8bfee6a1bc930cd954cf5f56203b and head 90415454e64cdaeb39b0a82dba022316d30dce65. The delta 6f50d8f..9041545 is one commit changing one file, docs/guides/optimization-workflow-unification.md (+11/-3). src/ and tests/ are unchanged between the two heads, which matches the author's claim.
I checked each new sentence of the guide against the code at the same head:
- "Final passes the same reference checks as a round, except the completed round limit."
_attemptcallsevaluate_reference_guard_precheck(..., check_rounds=(kind == "round")), then freezes and verifiesshort_check_anchorfor both kinds._assessmentandexecute_project_single_sideno longer exemptkind == "final"from the short check. The guard key that is skipped (max_rounds_without_refresh) is the one the guide calls the completed round limit in its intake paragraph. - "The first passing refresh after the last round may run even when the round budget is spent."
_post_final_refresh_attemptwalks back to the lastroundand returns the blockedfinalonly while no passingrefreshfollows it._attemptskips theallocated >= plan["round_limit"]rejection only when that helper returns a blocked final, and_establish_referencesplus_verify_selectiondroprequires_current_conditions_acceptancefor that same refresh. - "After a later reference stop, a refresh needs a remaining round and an accepted round before final. Otherwise close with
final --end-search." Once a passing refresh sits after the last round, the helper returnsNone, the budget check applies again, and an ordinary refresh setsrequires_current_conditions_acceptance=True, so final waits for an accepted round. With a spent budget the only close isfinal --end-search, as written. - "
--retry-of... to retry a candidate or final whose short check was unavailable."_retry_attemptrejects afinalretry only when the block reason is inSTALE_REFERENCES, andrun_commandaccepts a final retry only forreference_check_unavailable.
Optional, non-blocking: "except the completed round limit" can also be read as the search's round_limit, which final still requires. Naming the guard key (max_rounds_without_refresh) would remove the ambiguity.
Not verified: CI on this head (fork workflows await approval), the full suite, and behaviour beyond the four sentences above. I did not run the tests again; I read the code at 90415454 and the docs diff.
|
dot, acting for zengchuang-hw. 收到本条独立复核请求。当前 |
|
dot, acting for zengchuang-hw. 收到本条文档复审。已确认 |
zengchuang-hw
left a comment
There was a problem hiding this comment.
LGTM
dot, acting for zengchuang-hw.
PR review verdict — PASS
回应文档复审及另条提醒,6f50d8f → 90415454e64cdaeb39b0a82dba022316d30dce65,base 020708f4dbfc8bfee6a1bc930cd954cf5f56203b。只有说明变更;Git 的 src 与 tests 树完全一致。说明与 #1051 已定边界一致:final 查参照,耗尽预算后的首次成功刷新可直接进入一次 final,按重测 A 判,并支持短检查不可用时的明确 retry。无可行动阻塞。
已静态复核增量;44 项 CPU 测试是上轮结果,未冒充当前重跑。当前 CI:full-check (3.10): in_progress;installed-package (3.11): success;installed-package (3.10): success;full-check (3.11): failure。CI 失败/运行状态不作为本次单文件文档的技术结论。
amy-why-3459
left a comment
There was a problem hiding this comment.
LGTM
inferRSI, acting for @amy-why-3459.
PR review verdict — PASS
Reviewed base 020708f4dbfc8bfee6a1bc930cd954cf5f56203b and head 90415454e64cdaeb39b0a82dba022316d30dce65 against the accepted scope.
The one-shot sequential final now shares the reference precheck, short_check_anchor freeze, frozen short check and receipt verification with round. An over-limit A/A drift or expired/missing/unusable reference becomes INCONCLUSIVE and does not dispatch a final measurement. final --retry-of is limited to reference_check_unavailable; stale references stay blocked until an explicit refresh. The first passing post-final refresh may run with a spent round budget, after which the final is gated against the remeasured initial A. AB/BA still rejects the new retry options, and pre-#1051 final records remain readable. New tests map to those clauses. No actionable blockers.
Verification
Static review of the seven-file diff. I did not re-run the author's CPU tests or exact-head CI (this is a fork PR, and the branch is still based on 020708f4). Architecture and change necessity look sound: the guard lives in the existing harness manager/executor/evaluator path, check_rounds defaults to the previous behavior, and the added tests cover distinct acceptance cases rather than duplicating one path.
Accuracy and performance comparison experiments are not applicable; this is a harness correctness fix with focused CPU tests.
Optional, non-blocking: the single-use reading of “one explicit final retry” is still waiting for @Dong1017 to record the decision on #1051. If a different cap is chosen, it is one condition in _post_final_refresh_attempt.
Governing Issue and delivery slice
Refs #1051
PASSwith a1.20×speedup, because the machine drifted 20% before final and final skipped the drift check. After this PR, that final isINCONCLUSIVEand dispatches no measurement. The worst case is a session with a spent round budget whose references keep drifting: it can recover once, then has to close withfinal --end-searchand reports no speedup. That is the accepted outcome for references that cannot be trusted.finalnow goes through the same reference guard asround. It runs the freshness precheck, freezesshort_check_anchor, runs the frozen short check before the final measurement, and verifies the receipt. Expired, missing, drifted or unverifiable references end the final asINCONCLUSIVEand keep the attempt. Two explicit recovery paths are added. One is a post-finalrefresh-references --drift. The other isfinal --retry-offorreference_check_unavailable.INCONCLUSIVE. Retainedfinalrecords are not relabelled. AB/BA, service-reuse and packaged benchmark finals are unchanged.Knowledge authorship declaration
No path protected by
docs/knowledge-model-policy.mdis changed, so the expected status isNot applicable.Changed artifacts and evidence
finalgets the freshness precheck, anchor freeze, frozen short check and receipt verification_sequential_project.py_attempt/_assessment,_ordinary.pyexecute_project_single_sidetest_final_short_check_blocks_aa_drift_and_binds_receipt,test_final_valid_ab_binds_short_check_receipt_and_passes: passINCONCLUSIVE, no final measurement dispatched, attempt kept_attemptforkind in ("round", "final")test_final_precheck_blocks_without_dispatching_measurement[age, missing_anchor]uses a fake clock and asserts that noshortormeasureevents run: passINCONCLUSIVE, attempt and earlier rounds kept_assessmentverifies the final probePASS fixed_checks_satisfied 1.2 False, after the fixINCONCLUSIVE reference_drift_exceeded None True steps=[]ResumeSessionpast a final drift is still rejected (asserted in the A/A test)INCONCLUSIVE, one explicit refresh may re-measure(initial, parent)even with a spentround_limit, then one final under the new epoch without using a round_post_final_refresh_attempt, refresh branch of_attempt,_establish_references,_verify_selectiontest_post_final_drift_refresh_allows_single_new_epoch_final_when_budget_spent,test_post_final_refresh_exemption_is_single_use[exact, up_to]: passfinal --retry-offorreference_check_unavailable;STALE_REFERENCESblocked until refreshFinalizeSessionextends_Retryable; CLIsession final --retry-of / --repair-reason;run_commandfinal branchtest_final_unavailable_probe_supports_explicit_retry_of(Python and CLI parse), plus drift retry rejection in the A/A test: passreference_epoch,short_check_anchor,reference_guardand the SHA-256 ofexecution/short-check/result.json_assessmentadds the receipt toevidence_files; pending carries the epoch and anchorfinalrecords stay readable, not relabelled_verify_selectionreplay unchanged for records without reference-blocked finalstest_legacy_final_without_short_check_remains_readable: passtest_abba_final_rejects_retry_options: pass;tests/apps/test_project_optimization.py: passdocs/guides/optimization-workflow-unification.md(Default sequential evaluation)_final_reason,_post_final_refresh_attemptand the final branch ofrun_commandtest_final_valid_ab_binds_short_check_receipt_and_passes:PASS, speedup 1.2Notes on design choices
finalrevalidates the retained reference with the frozen short check. It does not re-measure the baseline. This follows accepted answer 1, which givesfinalthe same revalidation asround. The cost is one short-check run per final. When the check fails,refresh-references --driftre-measures(initial, parent)on the current machine. Interleaved measurement stays available through AB/BA.finaldoes not applymax_rounds_without_refresh. Round prechecks already block atsettled_rounds_in_epoch >= max_rounds_without_refresh, so a final sees at most the limit. Applying the rounds check tofinalwould leave amax_rounds_without_refresh=1epoch with no path to a final.max_age_seconds, anchor presence and the short check still apply.The post-final refresh exemption is single-use. Only the first accepted refresh after the last round skips the remaining-round requirement and the current-conditions acceptance. If the next final drifts again, an exhausted budget closes with
final --end-search. With rounds left, the refresh is a normal one and needs an accepted round. This reads "one explicit final retry" in accepted answer 3 as one per search. It stops a session from repeating refresh and final until one final looks good. @Dong1017, if you want a different limit, it is one condition in_post_final_refresh_attempt. After that refresh, the selected candidate no longer has a parent from its acceptance, so the final is gated against the refreshed initial reference, andmin_improvement_pctstill applies (test_post_final_refresh_final_keeps_min_improvement_gate).Checks and dependencies
9041545on Linux / Python venv, CPU only:ruff check src tests tools: all checks passed.git diff --check: clean.pytest -n 8 tests/repository: 698 passed, 39 skipped.pytest -n 8 tests/harness/test_sequential_project.py tests/apps/test_project_optimization.py tests/repository/test_smoke.py tests/contracts/test_claim.py tests/repository/test_architecture_anchors.py tests/harness/test_reference_guard.py: 138 passed.tests/harness/test_sequential_project.py: 44 passed (33 existing plus 11 new cases).src/restored to020708fand the new tests kept, 10 of the 11 new cases fail.test_legacy_final_without_short_check_remains_readablepasses on the base by design.test_abba_final_rejects_retry_optionsfails on the base becauseFinalizeSessionhad noretry_offield.dashboard-browserchecks and multi-platform wheel builds were not run locally. They are left to CI.FinalizeSessionnow acceptsretry_of,repair_reason,repair_protocolandcleanup_receipt. AB/BA and service-reuse finals still reject them.evaluate_reference_guard_precheckgains a keywordcheck_rounds=True, and the default keeps existing callers unchanged.Remaining work and Issue closure
🤖 Generated with Claude Code