From 6d4ed9b26bb9a10035e35afebb5f49e9045f743d Mon Sep 17 00:00:00 2001 From: jig Date: Thu, 8 Oct 2026 00:32:52 -0600 Subject: [PATCH] Remove unused protocol.WorstCaseSendCount Nothing referenced the constant, and the engine's own TODO noted that it understated the real send ladder (gate x parse only, ignoring crash re-entries and repair edges). The enforced per-attempt bound is defaultMaxAttemptSends in internal/engine/phase.go; its doc comment now says so directly instead of carrying the TODO. No behaviour change. Co-Authored-By: Claude Opus 5.5 --- internal/engine/phase.go | 11 ++--------- internal/protocol/limits.go | 7 ------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/internal/engine/phase.go b/internal/engine/phase.go index 610ade7..a5cbf18 100644 --- a/internal/engine/phase.go +++ b/internal/engine/phase.go @@ -46,15 +46,8 @@ const phaseStatusSkipped = "skipped" // attempt. Every send is checked against it before the subprocess starts, and // exceeding it ends the attempt with its own terminal cause. // -// TODO(protocol): WorstCaseSendCount understates the ladder. The constant in -// internal/protocol declares gate_budget × parse_budget = 6 and is referenced -// by no code; the ladder the engine actually walks is -// parse(budget+1 emissions) × gate(budget+1 emissions) × crash -// re-entries(budget+1) × repair edge(budget+1 self runs plus budget target -// dispatches) — roughly 252 sends for a single phase at budget 3, and more -// once several phases carry edges. Until that constant is corrected (it lives -// in a package this pass does not own) the real bound is the one enforced -// here. +// This is the real upper bound on sends within one attempt; the parse, gate, +// crash-reentry and repair-edge ladders all count against it. const defaultMaxAttemptSends = 64 // maxPhaseEnvelopeBytes caps the envelope blob one phase result may embed in diff --git a/internal/protocol/limits.go b/internal/protocol/limits.go index d44be43..98f1319 100644 --- a/internal/protocol/limits.go +++ b/internal/protocol/limits.go @@ -77,13 +77,6 @@ const ( // emissions a gate violation may request before the phase fails (R7, R9). DefaultPhaseRetryBudget = 2 - // WorstCaseSendCount is the maximum number of prompt sends one phase can - // issue at the default budgets: gate_budget × parse_budget, because every - // gate correction opens a fresh per-emission parse budget. A definition - // that raises either budget raises this product; the per-attempt - // wall-clock ceiling bounds total cost regardless. - WorstCaseSendCount = DefaultPhaseRetryBudget * ParseBudgetPerEmission - // DefaultPhaseTimeout is the wall-clock ceiling for a single phase. A // phase that exceeds it is killed by process group, consumes one phase // retry, and restarts from the pre-phase snapshot with a fresh session