pub fn evaluate_layer3(
project_root: &Path,
phase: PhaseId,
git_flow: &GitFlowConfig,
) -> Result<AgentResult, ResultError>Expand description
Layer 3: Last resort — agent process is gone.
Split per D-02/D-03 case 3 (17-03): “process gone, commits exist” stays
Unknown — unverified but there is SOMETHING to account for, and Plan
04’s never-advance dispatch gates it downstream (D-04) rather than
reclassifying it here. “Process gone, zero commits, nothing declared” is
no longer a blanket advanceable Unknown — it is reclassified to
Failed so a vanished agent that produced and declared nothing cannot
masquerade as ambiguous-but-fine; the reason flags that human review is
needed. This only fires when neither Layer 1 nor Layer 2 produced a
definitive result.
The split is three-way, not two-way (35-01/F-4). The two cases above
both assume the commit count was actually established. A third case —
the count could not be MEASURED at all — is classified Unknown with
commits left absent and a reason naming the measurement failure. It is
not Failed: that asserts a negative the evidence does not support, and
on a transient git fault it is the exact misclassification this layer
used to produce. An unmeasurable count is strictly less certain than the
commits > 0 case already called Unknown, so Unknown is the
consistent answer.
The count now comes from phase_commit_count rather than a second
inline derivation. This layer previously ran its own rev-list --count
that fell soft to a zero default, an independent copy of the same lossy
collapse — so fixing only evaluate_layer2 relocated the
misclassification here instead of removing it. The two measurable arms’
behaviour and reason strings are unchanged.