Skip to content

Conversation

@shamoon
Copy link

@shamoon shamoon commented Dec 26, 2025

Description:

This increases the "tolerance" of checking updated_at vs. markedStaleOn from 15 to 30 seconds. See linked thread but for us recently stalebot has been marking issues stale and then un-marking them because of its own actions, seemingly just because the timestamps are > 15s:

  [#11353] Found this pull request last updated at: 2025-12-23T03:32:45Z
  ...
  [#11353] Pull request marked stale on: 2025-12-23T03:32:17Z
  [#11353] Checking for comments on pull request since: 2025-12-23T03:32:17Z
  ...
  [#11353] Pull request has been updated since it was marked stale: true
  [#11353] Pull request has been commented on: false
  [#11353] Remove the stale label since the pull request has been updated and the workflow should remove the stale label when updated

Of course I do not know exactly what the ideal tolerance would be but 30 seconds seems relatively as "safe" as 15. Nor do I know the underlying reason the tolerance is no longer sufficient, perhaps there has been drift in the GH API over time.

Of course alternatively this could be made configurable, but Im not sure how widespread this really is to warrant that.

Related issue:
See #1184 (it would close this in my case but Im not 100% certain if OP there has the same exact cause).

See also:
#816

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Copilot AI review requested due to automatic review settings December 26, 2025 00:09
@shamoon shamoon requested a review from a team as a code owner December 26, 2025 00:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an issue where the stale bot incorrectly un-marks issues/PRs as stale immediately after marking them stale due to timestamp comparison discrepancies between updated_at and markedStaleOn timestamps.

Key changes:

  • Increases the tolerance for date comparison in isDateMoreRecentThan from 15 seconds to 30 seconds
  • Updates associated comments to reflect the new 30-second tolerance value

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/classes/issues-processor.ts Updates the tolerance parameter from 15 to 30 seconds when checking if an issue has been updated since being marked stale, and updates the comment to reflect the new tolerance
dist/index.js Applies the same tolerance change and comment update to the compiled distribution file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shamoon shamoon force-pushed the increase-updated-tolerance branch from ae079e9 to bf02ef2 Compare December 26, 2025 00:13
@shamoon
Copy link
Author

shamoon commented Dec 26, 2025

Another example, 21 seconds:

Screenshot 2025-12-25 at 4 11 13 PM
  [#11487] Found this pull request last updated at: 2025-12-23T03:32:37Z
  [#11487] Pull request marked stale on: 2025-12-23T03:32:16Z

I also verified that there are no events in between these two timestamps:

https://api.github.com/repos/paperless-ngx/paperless-ngx/issues/11487/events :

...
  {
    "id": 21232720086,
    "node_id": "SE_lADOG1Zs187a3isUzwAAAATxkZjW",
    "url": "https://api.github.com/repos/paperless-ngx/paperless-ngx/issues/events/21232720086",
    "actor": {
      "login": "***",
      ...
    },
    "event": "subscribed",
    "commit_id": null,
    "commit_url": null,
    "created_at": "2025-11-27T23:15:01Z",
    "performed_via_github_app": null
  },
  {
    "id": 21716999961,
    "node_id": "LE_lADOG1Zs187a3isUzwAAAAUObx8Z",
    "url": "https://api.github.com/repos/paperless-ngx/paperless-ngx/issues/events/21716999961",
    "actor": {
      "login": "github-actions[bot]",
      ...
    },
    "event": "labeled",
    "commit_id": null,
    "commit_url": null,
    "created_at": "2025-12-23T03:32:16Z",
    "label": {
      "name": "stale",
      "color": "ffffff"
    },
    "performed_via_github_app": null
  },
  {
    "id": 21735735229,
    "node_id": "UNLE_lADOG1Zs187a3isUzwAAAAUPjP-9",
    "url": "https://api.github.com/repos/paperless-ngx/paperless-ngx/issues/events/21735735229",
    "actor": {
      "login": "github-actions[bot]",
      ...
    },
    "event": "unlabeled",
    "commit_id": null,
    "commit_url": null,
    "created_at": "2025-12-24T03:31:39Z",
    "label": {
      "name": "stale",
      "color": "ffffff"
    },
    "performed_via_github_app": null
  }

https://api.github.com/repos/paperless-ngx/paperless-ngx/issues/11487/timeline as well:

[
  ...
  {"event":"subscribed","created_at":"2025-11-27T23:15:01Z","actor":"teutat3s","label":null},
  {"event":"labeled","created_at":"2025-12-23T03:32:16Z","actor":"github-actions[bot]","label":"stale"},
  {"event":"unlabeled","created_at":"2025-12-24T03:31:39Z","actor":"github-actions[bot]","label":"stale"}
]

@shamoon
Copy link
Author

shamoon commented Dec 26, 2025

Happy to close this in favor of #1311 depending on wishes of the maintainers. Sorry for all the noise!

@shamoon shamoon closed this Dec 26, 2025
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.

1 participant