Skip to content

fix: add docstrings to meet coverage threshold for SIGSEGV retry PR#4

Open
deepshekhardas wants to merge 3 commits into
mainfrom
fix/pr-3552-sigsegv
Open

fix: add docstrings to meet coverage threshold for SIGSEGV retry PR#4
deepshekhardas wants to merge 3 commits into
mainfrom
fix/pr-3552-sigsegv

Conversation

@deepshekhardas

@deepshekhardas deepshekhardas commented May 12, 2026

Copy link
Copy Markdown
Owner

Adds JSDoc comments to shouldRetryError, shouldLookupRetrySettings, and correctErrorStackTrace functions to bring docstring coverage up to the 80% threshold required by the project's CI checks.


Summary by cubic

Retries TASK_PROCESS_SIGSEGV crashes under the task’s existing retry policy and fails attempts on uncaught exceptions instead of timing out. Also adds JSDoc to key error helpers to pass the 80% doc coverage check and fixes dev workers spinning after CLI disconnect.

  • Bug Fixes
    • @trigger.dev/core: Retry segfaults using the task’s retry/maxAttempts; tasks without a retry policy still fail fast.
    • trigger.dev + @trigger.dev/core: Uncaught exceptions now fail the attempt and follow the normal retry policy (no more drift to max duration).
    • Dev workers: Stop 100% CPU loop after the CLI disconnects by guarding IPC sends and exiting on process.disconnect.
    • Docs: Added JSDoc for shouldRetryError, shouldLookupRetrySettings, and correctErrorStackTrace; CI doc coverage now exceeds 80%.

Written for commit 7052c25. Summary will update on new commits.

matt-aitken and others added 2 commits May 11, 2026 17:10
SIGSEGV was hard-classified as non-retriable in shouldRetryError on the
assumption that it's always a deterministic native crash. For Node
tasks that's not reliably true — many production SIGSEGVs are flaky:

- Native addon races (sharp, canvas, better-sqlite3, node-rdkafka,
  bcrypt, etc.) — libuv thread-pool work stepping on V8 handles.
  Different heap layout / thread schedule on a fresh process,
  retry often succeeds.
- JIT / GC interaction — V8 turbofan deopt or GC during a native
  callback. Timing-dependent.
- Near-OOM in native code — when RSS approaches the cgroup limit,
  native allocations fail and poorly-written addons dereference
  NULL → SIGSEGV instead of a clean OOM-kill. A fresh process
  with cleaner memory often succeeds.
- Host / hardware issues — bit flips, kernel quirks. Retry lands
  on a different host.

The codebase was already inconsistent here: shouldLookupRetrySettings
listed SIGSEGV as retry-config-aware, but the shouldRetryError gate
short-circuited fail_run before that branch could be reached. And we
already retry TASK_RUN_UNCAUGHT_EXCEPTION — clearly a user-code bug —
under the user's retry policy, so refusing to retry SIGSEGV was the
odd one out.

Flip TASK_PROCESS_SIGSEGV from the false branch to the true branch in
shouldRetryError. The existing retrying.ts pipeline then gates the
retry on lockedRetryConfig + maxAttempts — same path SIGTERM and
uncaught-exception already use. No new code paths; tasks without a
retry policy still fail fast.

Tests added in packages/core/test/errors.test.ts lock down the new
classification alongside SIGTERM, SIGKILL_TIMEOUT, and the OOM codes
(still non-retriable here because OOM has its own machine-bump retry
path in retrying.ts that runs before shouldRetryError).

Closes TRI-9234.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds JSDoc to shouldRetryError, shouldLookupRetrySettings, and
correctErrorStackTrace functions to meet 80% docstring coverage threshold.
id: release
uses: softprops/action-gh-release@v1
if: github.event_name == 'push'
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
Adds JSDoc to parseError, truncateMessage, sanitizeError,
taskRunErrorEnhancer, and groupTaskMetadataIssuesByTask.
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