Skip to content

fix: don't crash when posting the CI link comment fails - #707

Open
NopeCharon wants to merge 1 commit into
nodejs:mainfrom
NopeCharon:fix/jenkins-ci-comment-rejection
Open

NopeCharon wants to merge 1 commit into
nodejs:mainfrom
NopeCharon:fix/jenkins-ci-comment-rejection

Conversation

@NopeCharon

Copy link
Copy Markdown

Fixes #704

pushStarted() posted the "CI: " / "V8 CI:" / "Lite-CI:" comment without awaiting createPrComment() or handling its rejection. createPrComment() logs the error and then rethrows it, so a GitHub API failure while commenting became an unhandled rejection, and server.js exits the process on those.

This sends the three comment calls through a small postCiComment() helper. The helper discards the rejection, which createPrComment() has already logged. The commit status update and the rest of the bot keep running.

Testing

  • New unit test: the comment endpoint returns 500, and the test checks that the commit status is still created and that no unhandled rejection is raised. Without the fix it fails with failureType: 'unhandledRejection'.
  • npm test (node --test + standard) passes.

pushStarted() posts a "CI: <url>" (or "V8 CI:" / "Lite-CI:") comment
on the pull request when Jenkins reports a pending build, but called
createPrComment() without awaiting it or attaching a rejection handler.
createPrComment() logs the error and rethrows it, so any GitHub API
failure while commenting (5xx, rate limiting, locked PR, timeout)
turned into an unhandled promise rejection. server.js treats those as
fatal and exits the process, taking down the bot because of a
best-effort comment.

Route the three comment calls through a small postCiComment() helper
that swallows the already-logged rejection, so the commit status update
and the rest of the bot keep working.

Add a unit test which makes the comment endpoint return 500 and asserts
that the status is still created and no unhandled rejection is raised;
it fails without this change.

Fixes: nodejs#704
Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
@NopeCharon
NopeCharon requested a review from a team as a code owner October 24, 2026 06:56
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.

Failed CI link comment crashes the bot with an unhandled rejection

1 participant