Repository navigation
Conversation
A dispatch timeout is ambiguous: the status probe decides whether the Worker accepted the review. The dispatch catch reported the timeout before that decision, so every recovered timeout became a Sentry error. Mark deadline errors with a stable code, log one structured event per probed dispatch failure with its outcome, and report the timeout to Sentry only when the probe cannot answer.
…t release The guarded release returns false when the review was superseded or reclaimed while the status probe ran. The structured event counted that as a release. Record claim_changed instead, keep both outcomes out of Sentry, and cover the supersede race in a test.
This comment has been minimized.
This comment has been minimized.
chrarnoldus
left a comment
There was a problem hiding this comment.
bot: apps/web/src/lib/code-reviews/dispatch/dispatch-pending-reviews.ts:1099: If the Worker returns a terminal status but a database write fails, this catch reports an unrecovered Worker timeout and groups the database error under it. Isolate the status request in its own try/catch and report reconciliation failures separately.
A successful status response followed by a failed database write landed in the status-probe catch, which reported an unrecovered dispatch timeout and grouped the write error under it. Isolate the status request in its own catch, and report reconcile failures with their own event and operation tag while leaving the review queued.
|
bot: Fixed in 98f7e21. The status request now has its own catch, so its failures keep the existing unrecovered handling. Database writes that follow a successful status response are reported separately: |
…e error Drizzle error messages carry the SQL and its bound values, and the reconcile path copied the message into the log stream. Log only classification fields. The database helpers captured the same error before the reconcile catch, so Sentry deduplicated the second capture and lost the reconcile operation tag. Let the helper that reports the error take the caller's operation, and do not capture again. The test now fails a real attempt update with a trigger and checks the log for absent bound values.
…ntry The tagged error-tracker event still carried the attempt parameters and parent update values, including session IDs and worker error text. Report only the review or attempt ID, the status and the terminal reason. Forward the capture override only when the caller passes one, so ordinary callbacks keep their previous operation tags. Cover both the attempt write and the parent review write with a real trigger failure, and assert that synthetic markers are absent from the log and the error-tracker extras.
Manual QA — T-126Pass · tested
Test details and evidenceScenarios
Total Sentry error envelopes: 7. Scenarios 9, 10 (2), 11, 12, 13, 15 account for all 7; no recovered timeout produced one. The remaining envelope traffic is SDK client reports about discarded spans, not errors. The reconcile envelopes contain the parameterized query in Problems foundnone Note, not a failure: the PR text says the database message is not sent to the error tracker. The evidence shows the database cause message is the Sentry exception value ( Not tested
Verdict: pass |
Why
The web app sends code reviews to a separate review worker with a 10 second deadline. When the
deadline passes, the app cannot tell whether the worker received the review. It then asks the
worker for the review status:
again.
That recovery works. But the timeout was reported to the error tracker before the status check
ran, so every recovered timeout appeared as an error. In a normal day this made a handled
condition look like a service failure. This change reports the timeout only when the status check
cannot answer, and records each ambiguous dispatch failure as one structured log line so recovered
timeouts remain countable.
Summary
CODE_REVIEW_WORKER_TIMEOUT,so callers can identify a timeout without matching the message.
code_review.dispatch_ambiguous_failurewithdispatchFailure(timeout,connection_refused,other) andprobeOutcome(queued,terminal,released,claim_changed,unrecovered).claim_changedmeans the worker has no state and the guarded release matched no row, so thisdispatch no longer holds the claim. The release cannot tell why the claim changed.
is no longer sent to the error tracker. An unrecovered timeout is sent once, with the probe
failure as context.
code_review.dispatch_probe_reconcile_failedin the logs, with the probe observation, thedispatch failure kind and the error class only; the log line has no database message. The
database helper reports the error once under
dispatch-review-probe-reconcile. Following theexisting Drizzle error policy, the error tracker receives the database error class and its
message as the exception value, plus the parameterized query and allowlisted extras. Bound
values, session IDs and worker error text are not sent. It is not reported as an unrecovered
dispatch timeout, and the review stays queued for the existing stale-queued recovery.
Verification
Automated tests only; no manual test. The change affects error reporting and log output, not UI.
pnpm --filter web test -- --runTestsByPath src/lib/code-reviews/client/code-review-worker-client.test.ts src/lib/code-reviews/dispatch/dispatch-pending-reviews.test.ts— 92 tests pass. New coverage: timeout error code, connection refusal is not a timeout, the
queued, released, claim-changed and unrecovered probe outcomes (including the manual review whose
dispatch and status probe are both refused), and a reconcile write failure through a real
database helper for the attempt write and the parent review write, checking that synthetic
session and error markers are absent from both the log and the error-tracker extras.
pnpm --filter web typecheck— pass.pnpm --filter web lint— pass.Visual Changes
N/A
Reviewer Notes
existing error-tracker reports, so this change does not hide a different failure class.
error is carried in
extra.statusProbeError. Reporting both would create two events for onereview.
so a log query can compare outcomes across failure kinds.
claim_changed, notreleased. That result only proves that no row matched the guarded update; it does not say whythe claim changed.
failure keeps the existing unrecovered behaviour. A reconciliation failure is captured once by
the database helper, labelled with the
dispatch-review-probe-reconcileoperation, and leavesthe review queued. The helper's error-tracker extras list only the review or attempt ID, the
status and the terminal reason; they omit session IDs, worker error text and bound query values.