Skip to content

fix: capture timeout errors in cron jobs using captureError - #337

Merged
omegascorp merged 1 commit into
modelence:mainfrom
ankit-0903:fix/capture-cron-timeout-errors
Aug 31, 2026
Merged

omegascorp merged 1 commit into
modelence:mainfrom
ankit-0903:fix/capture-cron-timeout-errors

Conversation

@ankit-0903

@ankit-0903 ankit-0903 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #333

Description

When a cron job ran past its configured timeout, the state was quietly reset to false without logging or reporting anything. There was a TODO comment in the code for this.

Because of this, timed out cron jobs in production would fail silently without any telemetry.

Changes

  1. Added alias to the destructuring in tickCronJobs loop in jobs.ts.
  2. Created a descriptive Error instance when a job times out and passed it to captureError from @/telemetry.
  3. Added a unit test in jobs.test.ts to verify timeout errors are captured correctly.

All unit tests pass and build is clean.


Note

Low Risk
Observability-only change on an existing timeout reset path; no new execution or scheduling behavior beyond error reporting.

Overview
Cron jobs that exceed their configured timeout are no longer reset silently. When tickCronJobs sees a still-running job past startTs + timeout, it now builds an error like Cron job '…' timed out after …ms, sends it through captureError, then clears isRunning so scheduling can continue.

A new unit test simulates a hung handler and advances mocked time past the 5s limit to assert captureError receives that message.

Reviewed by Cursor Bugbot for commit 3716c22. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8b25cea. Configure here.

Comment thread packages/modelence/src/auth/profile.ts Resolved
@omegascorp

Copy link
Copy Markdown
Collaborator

@ankit-0903 please update the PR in contains unrelated changes

@ankit-0903
ankit-0903 force-pushed the fix/capture-cron-timeout-errors branch from 60b9045 to 3716c22 Compare August 29, 2026 07:43
@ankit-0903

ankit-0903 commented Aug 29, 2026 via email

Copy link
Copy Markdown
Contributor Author

@omegascorp
omegascorp self-requested a review August 31, 2026 12:01

@omegascorp omegascorp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good

@omegascorp
omegascorp merged commit 6bc0bf0 into modelence:main Aug 31, 2026
4 checks passed
@ankit-0903

ankit-0903 commented Aug 31, 2026 via email

Copy link
Copy Markdown
Contributor Author

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.

Cron: Log and capture timeout errors in cron job execution

2 participants