Skip to content

fix(parsers): route summarization failures through the logger (LIB-11) - #2119

Merged
gfargo merged 1 commit into
mainfrom
fix/lib11-summarization-console-error
Aug 14, 2026
Merged

fix(parsers): route summarization failures through the logger (LIB-11)#2119
gfargo merged 1 commit into
mainfrom
fix/lib11-summarization-console-error

Conversation

@gfargo

@gfargo gfargo commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • summarizeFileDiff (summarizeLargeFiles.ts) and summarizeDirectoryDiff (summarizeDiffs.ts) both caught LLM summarization errors, logged via bare console.error, and silently returned the unsummarized diff.
  • console.error bypasses --quiet and lands on a different channel than the rest of the run's output — and the silent degradation itself is the real problem: returning the unsummarized diff is exactly what blows the token budget the summarizer exists to protect, so a run that quietly lost every summarization call would go on to trim real content in enforcePromptBudget with no visible indication why.
  • Both functions already had a logger threaded into their options (summarizeDirectoryDiff's is optional, hence the ?. guard) — this routes the failure through logger.error instead of console.error.

Closes #1931

Test plan

  • New tests in both files' .test.ts assert logger.error is called with the failing file/directory and the underlying error message, and that console.error is not called
  • Updated the pre-existing #1700 test that spied on console.error (no longer needed — the new test covers that channel explicitly)
  • npx jest src/lib/parsers/default/utils — 22 suites / 243 tests passed (35 in the two touched files)
  • npx eslint <touched files> and npx tsc --noEmit -p . — clean
  • npx jest (full suite) — pre-existing, unrelated tree-sitter WASM failures only (same 4 failures present on a clean origin/main checkout in this worktree)

Scope note

The issue's suggested fix also mentions counting failures so the caller can report "summarization degraded for N files." That would mean threading a warnings/counter return value through summarizeLargeFiles/preprocessLargeFiles/summarizeDiffs and every caller that consumes them — a much larger, separate change. This PR fixes the core bug (bypassing the logger, silent degradation with no visible signal) without that broader refactor.

summarizeFileDiff and summarizeDirectoryDiff both caught LLM errors,
logged via bare console.error, and silently returned the unsummarized
diff. console.error bypasses --quiet and the run's normal output
channel entirely — and the silent fallback is exactly what blows the
token budget the summarizer exists to protect, so a run that lost
every summarization would go on to trim real content in
enforcePromptBudget with no indication why.

Both functions already had a logger threaded into their options
(summarizeDirectoryDiff's is optional, hence the ?. guard) — routes
the failure through logger.error instead, which reaches the run's
normal output and survives testing via a mock rather than a
console.error spy.
@gfargo
gfargo merged commit f24389e into main Aug 14, 2026
12 checks passed
@gfargo
gfargo deleted the fix/lib11-summarization-console-error branch August 14, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LIB-11: fix(parsers): summarization failures are swallowed to console.error, bypassing the logger

1 participant