Skip to content

Commit cfbcc64

Browse files
wesmclaude
andcommitted
fix: accept non-marker stderr in kiro fallback
When stdout has no review marker, fall back to stderr unconditionally (not only when stderr also has a marker). This handles the case where stderr contains plain review text without Kiro chrome. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6a694d5 commit cfbcc64

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

internal/agent/kiro.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ func (a *KiroAgent) Review(ctx context.Context, repoPath, commitSHA, prompt stri
166166
}
167167

168168
// Prefer the stream that contains a "> " review marker.
169-
// Stdout noise without a marker should not block the
170-
// stderr fallback.
169+
// When stdout has no marker (noise-only) or is empty,
170+
// fall back to stderr unconditionally.
171171
result, hasMarker := stripKiroReview(stdout.String())
172172
if !hasMarker || len(result) == 0 {
173-
if alt, ok := stripKiroReview(stderr.String()); ok && len(alt) > 0 {
173+
if alt, _ := stripKiroReview(stderr.String()); len(alt) > 0 {
174174
result = alt
175175
}
176176
}

internal/agent/kiro_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,34 @@ func TestKiroReviewStderrPreferredOverStdoutNoise(t *testing.T) {
411411
}
412412
}
413413

414+
func TestKiroReviewStderrFallbackNoMarker(t *testing.T) {
415+
skipIfWindows(t)
416+
417+
// stdout has noise without a marker; stderr has plain
418+
// review text also without a marker. stderr should still
419+
// be preferred over stdout noise.
420+
script := NewScriptBuilder().
421+
AddRaw(`echo "Loading model..."`).
422+
AddRaw(`echo "review text without marker" >&2`).
423+
Build()
424+
cmdPath := writeTempCommand(t, script)
425+
a := NewKiroAgent(cmdPath)
426+
427+
result, err := a.Review(
428+
context.Background(), t.TempDir(),
429+
"deadbeef", "review", nil,
430+
)
431+
if err != nil {
432+
t.Fatalf("unexpected error: %v", err)
433+
}
434+
if !strings.Contains(result, "review text without marker") {
435+
t.Fatalf(
436+
"expected stderr fallback even without marker, got: %q",
437+
result,
438+
)
439+
}
440+
}
441+
414442
func TestKiroReviewPromptTooLarge(t *testing.T) {
415443
a := NewKiroAgent("kiro-cli")
416444
bigPrompt := strings.Repeat("x", maxPromptArgLen+1)

0 commit comments

Comments
 (0)