Skip to content

FailReason and FailedAt not cleared after successful job completion #39755

@Jashk120

Description

@Jashk120

Description:

failReason and failedAt fields set on a job document during failure are never
cleared when the job subsequently runs successfully. This causes stale failure data
to persist indefinitely in rocketchat_cron, leading to incorrect job status
derivation in any tooling that reads these fields.

Steps to reproduce:

  1. Trigger a job failure or manually set failReason and failedAt on a document in rocketchat_cron
  2. Allow the job to run successfully on its next scheduled execution
  3. Query the document — failReason and failedAt still present despite successful run

Expected behavior:

failReason and failedAt should be cleared when a job completes successfully

Actual behavior:

failReason and failedAt persist after successful job completion

Server Setup Information:

Version: 8.3.0-develop
MongoDB Version: 7.0.16
Deployment: local development

##Comments
After a job fails and subsequently runs successfully, failReason and failedAt
persist on the document. Any status derivation reading failReason will incorrectly
mark the job as failed despite lastFinishedAt confirming successful completion.

{
    "_id": "69b96a5e22a18cc50365c72c",
    "name": "UserDataDownload",
    "status": "failed",
    "repeatInterval": "*/2 * * * *",
    "repeatTimezone": null,
    "nextRunAt": "2026-03-20T05:12:00.000Z",
    "lastRunAt": "2026-03-20T05:10:00.000Z",
    "lastFinishedAt": "2026-03-20T05:10:00.004Z",
    "lockedAt": "2026-03-20T05:11:14.706Z",
    "failCount": 0,
    "failReason": "Got Stuck",
    "disabled": false,
    "source": "core"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions