Address review of two-stop branch

- lca._prefix_profile: anchor the prefix window to the prefix's own first arrival
  so the A-rate is measured over the prefix span (matches the design intent;
  no-op for the 0-based canonical pipeline).
- cli study tune: label file-originated stops as file_proposal rather than
  llm_after_veto_budget (the veto never applies to file proposals).
- spec.AdaptiveStopSpec: reject stable_checks > max_checks (would make
  convergence undetectable and silently disable Stop-A).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 15:19:08 +08:00
parent 3af1d84ac0
commit 43125f48cf
3 changed files with 9 additions and 1 deletions

View File

@@ -376,6 +376,8 @@ def cmd_study_tune(args: argparse.Namespace) -> int:
"stop_authorized_by": ( "stop_authorized_by": (
"validator" "validator"
if (is_harness_stop or authorized) if (is_harness_stop or authorized)
else "file_proposal"
if proposal_source is not None
else "llm_after_veto_budget" else "llm_after_veto_budget"
), ),
"diagnosis": proposal.diagnosis, "diagnosis": proposal.diagnosis,

View File

@@ -373,12 +373,13 @@ def _prefix_profile(
length_mode: str, length_mode: str,
) -> WorkloadProfile: ) -> WorkloadProfile:
prefix = requests[:index] prefix = requests[:index]
start = float(prefix[0].arrival_s) if prefix else float(window.window_start)
end = float(prefix[-1].arrival_s) if prefix else float(window.window_start) end = float(prefix[-1].arrival_s) if prefix else float(window.window_start)
prefix_window = WindowRecord( prefix_window = WindowRecord(
window_id=window.window_id, window_id=window.window_id,
trace_path=window.trace_path, trace_path=window.trace_path,
trace_type=window.trace_type, trace_type=window.trace_type,
window_start=window.window_start, window_start=start,
window_end=end, window_end=end,
source_payload=window.source_payload, source_payload=window.source_payload,
) )

View File

@@ -364,6 +364,11 @@ class AdaptiveStopSpec:
raise SpecError( raise SpecError(
"trace.adaptive_stop.stable_checks and max_checks must be > 0." "trace.adaptive_stop.stable_checks and max_checks must be > 0."
) )
if stable_checks > max_checks:
raise SpecError(
"trace.adaptive_stop.stable_checks must be <= max_checks, "
"otherwise convergence can never be detected."
)
return cls( return cls(
enabled=enabled, enabled=enabled,
tau=tau, tau=tau,