fix(attach): address review bot feedback on warnings and footer · Entire
fix(attach): address review bot feedback on warnings and footer
6e9267e→main·
computermode·2w ago·2 files·+61 added/-6 removed
- Suppress the "review prompt will be empty" warning when a pending-review marker "ReviewPromptOverride" supplies the prompt; the general "no prompts parsed" warning still fires.
- Omit the footer token segment when the total is zero (not just nil), so it never renders "0 tokens" — matches the turns guard and the helper's doc.
- Truncate the amend-failure stderr note to the error's first line via the existing firstLine helper, keeping the full multi-line git output in the debug log only.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Sessions
a548a19a0542View transcript
Changes
2
cmd/entire/cli
- Mattach.go+10/-4
Mattach_test.go+51/-2
398 unmodified lines
func amendOrPrintTrailer(logCtx context.Context, w, errW io.Writer, headCommit *object.Commit, checkpointIDStr string, force bool) {
if err := promptAmendCommit(logCtx, w, headCommit, checkpointIDStr, force); err != nil {
logging.Warn(logCtx, "failed to amend commit", "error", err)
fmt.Fprintf(errW, "Could not amend the commit automatically (%v).
", err)
fmt.Fprintf(errW, "Could not amend the commit automatically (%s).
", firstLine(err.Error()))
fmt.Fprintf(w, "\nCopy to your commit message to attach:\n\n Entire-Checkpoint: %s\n", checkpointIDStr)
}
}
```
### Test Attach
- TestAttach_EmptyMetadataReviewWithOverride_NoEmptyPromptWarning: when a
pending-review marker supplies ReviewPromptOverride, the review prompt is
NOT empty even with an unparseable transcript, so the review-specific
warning must be suppressed (the general "no prompts parsed" warning still
fires).
func TestAttach_EmptyMetadataReviewWithOverride_NoEmptyPromptWarning(t *testing.T) { setupAttachTestRepo(t)
sessionID := "test-attach-empty-meta-review-override" setupClaudeTranscript(t, sessionID, `{"type":"assistant","message":{"role":"assistant","content":"hi"},"uuid":"a1"}")
var out, errOut bytes.Buffer if err := runAttach(context.Background(), &out, &errOut, sessionID, agent.AgentNameClaudeCode, attachOptions{ Force: true, Review: true, ReviewPromptOverride: "review the auth module for security issues", }); err != nil { t.Fatalf("runAttach --review with override should not fail: %v", err) }
if !strings.Contains(errOut.String(), "no user prompts were parsed") { t.Errorf("expected general empty-transcript warning on stderr, got: %q", errOut.String()) } if strings.Contains(errOut.String(), "review prompt will be empty") { t.Errorf("review-empty warning must be suppressed when an override prompt is set, got: %q", errOut.String()) } }
- TestAttachSummaryLine covers the post-attach "Captured: …" footer builder:
every field present, the token segment omitted when usage is nil, and the
empty result when nothing is known.