Skip to content

fix(run-engine): don't mislabel DB errors as UnclassifiableWaitpointId in completeWaitpoint - #4259

Open
claude[bot] wants to merge 7 commits into
mainfrom
fix/waitpoint-completion-db-error-mislabel
Open

fix(run-engine): don't mislabel DB errors as UnclassifiableWaitpointId in completeWaitpoint#4259
claude[bot] wants to merge 7 commits into
mainfrom
fix/waitpoint-completion-db-error-mislabel

Conversation

@claude

@claude claude Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The waitpoint completion path wrapped every error from the store-resolution step (runStore.forWaitpointCompletion) as UnclassifiableWaitpointId. That step probes the database to find the owning store, so a transient connection failure surfaced as a misleading "unclassifiable waitpointId" error, hiding the real cause and losing the underlying error's type, retryability and grouping. During a brief database failover this mislabel sent an incident investigation down a false trail before the real connection error was found underneath.

Fix

The catch is narrowed: only a genuine UnclassifiableRunId (the documented classification-failure signal from RunStore.forWaitpointCompletion) becomes UnclassifiableWaitpointId. Every other error, including database connectivity failures, is rethrown unchanged.

With the default classifier this also turns UnclassifiableWaitpointId into a clean signal: it no longer fires on infra noise, so any occurrence indicates a real id-routing defect worth alerting on. Recovery does not depend on this change, since lost completion side effects are re-delivered by the finalization guard from #4849; this PR is about diagnosing failures correctly.

A hermetic unit test locks both behaviors: a database error bubbles up unchanged, and a classification failure is wrapped with the original error as cause.

…d in completeWaitpoint

forWaitpointCompletion resolves the owning store by probing the database, so a
transient DB/infra error surfaced from that call was being caught and rethrown
as UnclassifiableWaitpointId with a misleading "length matches neither cuid nor
run-ops id" message, losing the original error's type, retryability, and error
grouping.

Narrow the catch so only a genuine id-classification failure (UnclassifiableRunId)
becomes UnclassifiableWaitpointId; every other error (including DB connectivity
failures) is rethrown unchanged.
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4ccd956

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@d-cs d-cs self-assigned this Jul 14, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@7fa1afc

trigger.dev

npm i https://pkg.pr.new/trigger.dev@7fa1afc

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@7fa1afc

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@7fa1afc

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@7fa1afc

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@7fa1afc

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@7fa1afc

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@7fa1afc

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@7fa1afc

commit: 7fa1afc

claude added 2 commits August 24, 2026 11:28
…ion-db-error-mislabel

# Conflicts:
#	internal-packages/run-engine/src/engine/systems/waitpointSystem.ts
@matt-aitken
matt-aitken marked this pull request as ready for review August 31, 2026 19:33
@matt-aitken matt-aitken assigned matt-aitken and unassigned d-cs Aug 31, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

…as instanceof

The intended thrower of UnclassifiableRunId is an injected classifier,
which can arrive from a separately built bundle carrying its own copy
of the class, where instanceof misses. The class sets its name
explicitly, so the name check keeps the wrap reliable across module
instances. A missed match was already harmless (the error bubbled
unchanged); this preserves the clearer label in the one scenario the
branch exists for.
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.

3 participants