Repository navigation
test(logs): wait for the call-log save instead of a fixed poll in upstream-error-call-log-16558 - #17091
Merged
diegosouzapw merged 1 commit intoOct 18, 2026
Conversation
…tream-error-call-log-16558 The detail artifact is written by a worker thread that starts cold on the first write; in a source checkout it is spawned through tsx. On a loaded machine that start took 8-20 s, past the helper's ~4 s polling budget (200 x 20 ms), so the first one or two cases failed with "attempt did not reach durable call-log detail" (3/3 runs on the release tip, load ~6-7). persistAttemptLogs hands the row to saveCallLog synchronously, so the helper now awaits waitForCallLogSaves() (row inserted and detail published: 'ready', or 'missing' if the write failed) with a 60 s bound that only turns a hung save into a failure, then asserts the row settled. The assertions are unchanged. Refs #15306
Contributor
CI Coverage Report
Coverage artifact was not available for this run. |
diegosouzapw
deleted the
fix/release-v3.8.52-basereds-calllog-settle-20261018
branch
October 18, 2026 22:17
diegosouzapw
added a commit
that referenced
this pull request
Oct 19, 2026
…sk cache (#17133) In a source checkout the call-log artifact worker runs through tsx, and tsx indexes its whole disk cache (os.tmpdir()/tsx-<uid>) with one readdirSync the first time a thread transforms a file. On a shared dev box that directory reached ~585k entries and the worker's first write waited 5-7 s on the listing (0.4 s without it). callLogWorkerOptions() now starts a tsx-launched worker with TSX_DISABLE_CACHE=1 on top of the parent's environment; compiled workers (npm, standalone, Docker) keep the default options. Refs #17091, #17099
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/unit/upstream-error-call-log-16558.test.tsreads each call-log row back through a helperthat polled 200 × 20 ms (~4 s) for the row to settle. The row's detail artifact is written by a
worker thread (
src/lib/usage/callLogArtifactWriter.ts) that starts cold on the first write; in asource checkout it is spawned with
--import tsx/esm. On a loaded machine that start took 8–20 s,so the first one or two cases failed with
attempt did not reach durable call-log detail.persistAttemptLogshands the row tosaveCallLogsynchronously, so the helper now awaitswaitForCallLogSaves()(row inserted and detail published:ready, ormissingif the writefailed) with a 60 s bound that only turns a hung save into a failure, then asserts the row settled
and reads it. The assertions are unchanged; no production code is touched.
Evidence
a016744417, unchanged test, devbox load ~6–7: 3/3 runs red (pass 4 fail 2,pass 4 fail 2,pass 5 fail 1); the first case spent 14.1 s and the second 5.6 s beforefailing.
(
tests 6 pass 5 fail 1).The race only bites when the worker's cold start is slow — i.e. on the shared devbox where local
validation runs.
pass 6 fail 0at load ~5–6; the first case takes ~8 s (theworker start) and the others ~20–30 ms.
publishCallLogDetail()the file goespass 1 fail 5— the readers still catch a missing detail (only the no-log case, which expectsnull, passes).Same class elsewhere (not changed here)
The worker comes online in ~0.1 s, but its first reply took 6.7–8.4 s on the devbox at load
3–5: tsx loads its import graph in the fresh thread (
callLogArtifacts.tspullsopen-sse/utils/requestLogger.ts). Other call-log readers have shorter bounds and fail the sameway there, also when run alone (
--test-concurrency=1):call-logs-id-collision(10 s),image-usage-accounting(5 s),copilot-learned-catalog-15634(2 s),chatcore-attempt-logging,chat-keepalive-correlation-functional,estimated-usage-billing-guard,provider-request-failure-pipeline, andtests/integration/reasoning-routing-pipeline.test.ts(harness
waitFor, 1.5 s default). They pass on hosted CI. Left for a follow-up: move thosebounds onto the same barrier, or make the worker's import graph lighter.
Validation
open-sse/transformer/responsesTransformer.tsandopen-sse/utils/sseHeartbeat.ts).Refs #15306