Improve extraction failure diagnostics and token usage logging
Log token usage before JSON validation so truncated responses still get
their usage recorded. Add shared log_extraction_failure() helper that
logs head+tail of partial text and detects possible degenerate token
repetition (unique char count in tail).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>