Skip to content

Aurora retry logging: accurate reasons, correct levels, never throw - #90

Merged
wparad merged 2 commits into
mainfrom
claude/serializer-timeout-tracking-lpf7yr
Aug 25, 2026
Merged

Aurora retry logging: accurate reasons, correct levels, never throw#90
wparad merged 2 commits into
mainfrom
claude/serializer-timeout-tracking-lpf7yr

Conversation

@wparad

@wparad wparad commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixed the aurora.retry WARN log, which previously said only "Aurora query failed — retrying" with no indication of why. It now includes the actual failure reason.
  • The reason is read from the unwrapped SDK/driver cause rather than DrizzleQueryError's own .message, which dumps the raw SQL and bound parameter values (e.g. a thread ID) — that stays out of the log title/message while the full error (query text included) is still available via the error context field.
  • Downgraded the per-attempt retry log to INFO specifically when the failure is Aurora resuming from auto-pause: expected and self-resolving, with nothing actionable — already flagged once by the existing aurora.resume_detected INFO log. Non-resume transient failures still log at WARN.
  • withRetry() in src/database/thread-matcher.ts no longer throws — it returns Result<T, DbError>. Every terminal failure comes back as an err(DbError) carrying the operation name and the attempt count it gave up at (new optional operation/attempts fields on DbError in src/errors.ts), so callers get full context without wrapping it in their own try/catch.
  • Every ThreadMatcher method now checks that Result directly instead of wrapping withRetry in try/catch and re-deriving a DbError from a caught exception.
  • processor.ts's tier-2 similarity search previously discarded ThreadMatcher.findMatch() errors with no logging at all; it now logs a WARN (matching the existing tier-1.5 In-Reply-To pattern) before degrading to "no match".

Test plan

  • npx tsc --noEmit passes
  • npx eslint src/database/thread-matcher.ts src/errors.ts src/processor/processor.ts passes clean
  • Full test suite: npx vitest run — 2846/2846 pass

Generated by Claude Code

claude added 2 commits August 25, 2026 20:45
…tcher

Log message/level fixes in withRetry:
- Include the actual failure reason in every log line (previously the
  per-attempt retry WARN was a bare "Aurora query failed — retrying" with
  no indication of why).
- Read that reason from the unwrapped SDK/driver cause rather than
  DrizzleQueryError's own message, which dumps the raw SQL and bound
  parameter values (e.g. a thread ID) — keeping that out of the log
  title while the full error (query text included) still reaches the
  log via the `error` context field.
- Downgrade the per-attempt retry log to INFO when the failure is Aurora
  resuming from auto-pause: expected, self-resolving, and already
  flagged once by the existing "aurora.resume_detected" INFO log.
  Non-resume transient failures still log at WARN.

Never-throw refactor:
- withRetry() now returns Result<T, DbError> instead of throwing —
  every terminal failure comes back as an err(DbError) carrying the
  operation name and the attempt count it gave up at (new optional
  `operation`/`attempts` fields on DbError), so callers get full
  context without needing their own try/catch around a throw.
- Every ThreadMatcher method now checks the Result directly instead of
  wrapping withRetry in try/catch and re-deriving a DbError from a
  caught exception.
- processor.ts's tier-2 similarity search previously discarded
  ThreadMatcher.findMatch() errors with no logging at all; it now logs
  a WARN (matching the existing tier-1.5 pattern) before degrading to
  "no match".
Nothing outside withRetry acts on how many attempts it took; only the
operation name is useful context for a caller. The attempt count stays
in the per-attempt log lines, where it's actually meaningful.
@wparad
wparad merged commit 547a42a into main Aug 25, 2026
6 checks passed
@wparad
wparad deleted the claude/serializer-timeout-tracking-lpf7yr branch August 25, 2026 22:09
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.

2 participants