fix: only count final-phase output as visible for handoff decisions

Progress messages (phase: 'progress') were setting sawVisibleOutput=true,
which blocked failover handoffs when Claude usage was exhausted. Now only
final-phase output counts as visible, allowing reviewer handoff to codex
even after progress messages were shown.
This commit is contained in:
Eyejoker
2026-04-01 04:18:15 +09:00
parent cb0d294941
commit 73156bf375

View File

@@ -534,7 +534,16 @@ export async function runAgentForGroup(
if (!evaluation.shouldForwardOutput) {
return;
}
if (typeof outputText === 'string' && outputText.length > 0) {
// Only count final-phase output as "visible" for handoff decisions.
// Progress messages (phase: 'progress') should not block failover
// handoffs — they don't represent meaningful completed work.
const isFinalPhase =
output.phase === undefined || output.phase === 'final';
if (
isFinalPhase &&
typeof outputText === 'string' &&
outputText.length > 0
) {
streamedState = {
...evaluation.state,
sawVisibleOutput: true,