feat(attach): warn on empty transcript, add capture footer + amend-fail note

main

Commit

computermode2mo ago

Improve entire attach diagnosability and feedback:

  • Warn (don't fail) when a transcript parses to no prompts and no model, so a contentless checkpoint is never produced silently. Stays a warning because agents whose user-content shape isn't matched (codex/copilot/pi/ factory) can legitimately yield empty metadata from a valid transcript; the warning goes to stderr and calls out --review when the empty prompt would also empty the review prompt.
  • Print a "Captured: <turns> · <model> · <tokens>" footer after a real attach, reusing the existing token-total/format helpers; each segment is omitted when absent.
  • Surface the amend-failure reason on stderr in addition to the existing debug log, so the user knows the best-effort amend was attempted before the manual-paste trailer fallback.
  • Document the best-effort amend and transcript-based agent auto-detection in --force/Long help.

Threads an errW writer through runAttach for the stderr output, and extracts warnEmptyTranscriptMetadata / printAttachFooter / amendOrPrintTrailer helpers (the last de-duplicates the two amend call sites).

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com Entire-Checkpoint: 38c6ac0d707e

Checkpoints

Warn on Empty Transcript, Improve Transport Tests

Claude CodeOpus 4.8
View session
Checkpoint 1