Skip to content

Claude/finish query callback logs a5f2m6 - #145

Merged
maximusunc merged 2 commits into
mainfrom
claude/finish-query-callback-logs-a5f2m6
Aug 31, 2026
Merged

Claude/finish query callback logs a5f2m6#145
maximusunc merged 2 commits into
mainfrom
claude/finish-query-callback-logs-a5f2m6

Conversation

@maximusunc

Copy link
Copy Markdown
Collaborator

No description provided.

claude and others added 2 commits August 28, 2026 20:53
The async callback POST was a black box: one INFO line on success with no
duration, and a failure line whose only detail was the raw exception. Nothing
this worker logged was persisted either -- it acks directly rather than going
through wrap_up_task, so its records never reached the query's log list.

Now, after each attempt completes:

- success logs the elapsed time, payload size and attempt number, plus a
  summary line when it took more than one attempt;
- failure logs the elapsed time and a bounded reason -- HTTP status with the
  head of the server's response body, or the httpx exception class (connect
  and timeout errors routinely stringify to nothing);
- a single "gave up" line records that the response was never delivered;
- the same numbers go on the otel span as attributes, so timing is queryable
  without adding per-query log storage.

A failed attempt's note is also spliced into the next attempt's payload, so a
receiver that eventually gets the response can see the attempts that didn't
make it. Splicing rebuilds the buffer, so it's skipped above 64 MiB -- the
transient second copy would cost more than the note is worth, and the note is
in the query's logs either way.

Memory-wise this is a net improvement: the logs list and its serialization are
dropped once they're inside the payload instead of being held for the length of
the POST, the payload is released before the closing db round trips, and the
log flush drains a handler queue that this worker previously left to accumulate.

Also stop sleeping after the final failed attempt, and make the fallback
serialization put "logs" last so the retry splice has a predictable tail.
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.79%. Comparing base (0216478) to head (806a000).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
workers/finish_query/worker.py 94.52% 3 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
workers/finish_query/worker.py 85.03% <94.52%> (+5.72%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bbf3bc...806a000. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@maximusunc
maximusunc merged commit 731f987 into main Aug 31, 2026
2 checks passed
@maximusunc
maximusunc deleted the claude/finish-query-callback-logs-a5f2m6 branch August 31, 2026 15:22
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