Skip to content

fix(ci): refresh stale issues on human comments#20914

Open
hesreallyhim wants to merge 2 commits intoanthropics:mainfrom
hesreallyhim:hesreallyhim/fix-ci-stale-issues-wf
Open

fix(ci): refresh stale issues on human comments#20914
hesreallyhim wants to merge 2 commits intoanthropics:mainfrom
hesreallyhim:hesreallyhim/fix-ci-stale-issues-wf

Conversation

@hesreallyhim
Copy link
Copy Markdown

@hesreallyhim hesreallyhim commented Jan 26, 2026

Description

The manage-stale-issues.yml workflow suggests that the issue -> "stale" warning -> closed flow is such that 30 days of inactivity leads to a warning, and 60 days of (consecutive) inactivity leads to a closure. For example, the bot says:

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.`

It also suggests that if an issue receives a warning, the user can effectively "dismiss" it by adding a keep-alive comment:

If the issue is still occurring, please comment to let us know.

Unfortunately, the logic of the workflow does not follow these statements, and a few users have opened issues reporting that their issue was closed prematurely. @marcindulak has been compiling a list of these issues as though preparing for a senate committee hearing. (#16497 )

The Issue

The workflow does this:

  • If an issue goes 30 days without any additional comments, it issues a warning that the issue has been inactive for 30 days ("inactive" means, for the bot, no new comments). It then asks users to let the bot know by commenting, or the issue will be closed automatically in 30 days.
  • Each run, it checks whether last_updated (meaning last comment) occurred over 30 days ago.
    • If no, it skips.
    • If yes, it checks whether there is a bot warning already.
      • If no, it posts warning message.
      • If yes, it posts closing message and closes issue.

The problem is: if the last comment was by a human, all this does is affect the "last_updated is before 30-days-ago" check (if it is, it just bypasses the rest). It doesn't actually take into account "Oh, someone has commented since the first warning, so I guess this is not a stale issue." What it does is, effectively, restarts a 30-day "countdown timer", which opens up a second window of potential inactivity - and if there are no new comments, then it sees two 30-day periods of inactivity, and it closes the issue.

Another way to frame it is: an issue will be closed if it has two 30-day periods of no new comments - but those periods do not have to be consecutive. So the bot's statement, "inactive for 60 days", which implies 60 days continuously, is inaccurate, or highly misleading at best.

This explains why if a user gets a warning on their thread, and then immediately comes to post "Yes this is still happening," it basically has no effect.

TL/DR: what, that was long?

The Fix

In this PR, I propose a minimal change which basically sets the simple condition:

if (lastHumanCommentAt < twoMonthsAgo) {
  // Close the issue - it's been inactive for 60+ days
}

Because the intentions/design of the maintainers can only be inferred by the bot's messages and the code/comments, there is no uniquely correct fix. So, I just went with the natural interpretation - that 60 days of inactivity means 60 continuous days, and it checks by comparing the date against the last human comment, and not computing something on the basis of (a) a 30-day period of inactivity, and (b) a previous comment made by the bot.

EDIT: Fixes: #16497

Post stale issue warning after 30 days of inactivity.
Refresh timeout when human comments are made.
Close issue after 60 days of continuous inactivity.
@ANogin
Copy link
Copy Markdown

ANogin commented Jan 28, 2026

I believe this is the wrong approach. The correct logic IMHO should be:

  • If there are no comments on the issue in the last 30 days:
    • see whether the "autoclose" tag is present
    • if no, add the warning message and set the tag [the current implementation of the warning message already sets the tag]
    • If yes, close
  • [already implemented] If there is a recent user comment, remove the autoclose tag.

Of course an even better logic:

  • If the are no user comments for 30 days and the last comment is not a stale issue comment:
    • Add a comment from the robot asking the user
      • If the issue still exist in the most recent version of Claude, post a comment specifying the version
      • If not, thumbs up this comment to confirm the issue is OK to close.
  • If the robot comment exists and the original reporter gave a thumbs up, close the issue as fixed (even if there are later comments)
  • Otherwise just leave it alone!!!
  • [Optionally] in internal triaging down-prioritize issues where the last comment is from the robot

@hesreallyhim
Copy link
Copy Markdown
Author

Thanks @ANogin that's good feedback and I appreciate your comments. I guess I'm not sure I understand why one approach is "wrong" (unless you mean technically incorrect) and the other is "correct". Since you don't identify any logical issues, I have to assume it's more of a stylistic preference.

Because this is the Anthropic Claude Code repository, my approach was guided by "minimal change set". I think your label-based approach may be sound, but currently the removal of the label is handled by a separate workflow. This creates a coupling between the two workflows that could be avoided for simplicity and to avoid brittleness. Your suggested flow sounds like you want to incorporate the label-removal action into this workflow. That's reasonable, but it's a larger change.

The second proposal you make is a completely new flow. It might be a good one, but you should consider how likely is it that a larger refactor is going to be reviewed or accepted, and do you want this problem to be fixed or not.

So, my reply would be that unless you think that my change is logically incorrect or deficient (or more complex than the alternative you suggest), the strategic thing to do is to try to push through the smallest change possible in order to maximize the likelihood that a maintainer will review it.

I hope that clarifies the proposed changes, which were not made in the spirit of "What's the best possible workflow I could imagine" but rather "what has the highest chance of being reviewed and accepted without corrections." Thanks. 👍🏽

@fsc-eriker
Copy link
Copy Markdown

As noted in #16497 the first question to ask is, does t make sense to close bugs as "stale"? If so, is 30+30 days really enough time to make sure active bugs are not closed needlessly? Both of these are, at the very least, reasonable to challenge.

@hesreallyhim
Copy link
Copy Markdown
Author

@fsc-eriker that's a very good point and I recommend you continue to press the team on this issue if it is important to you. That said, to be fair, that's outside the scope of this PR, which is to implement a bug fix that at least ensures that the bot is doing what it says it's going to do, and hopefully represents an improvement from the current state of affairs, given your concerns. I can certainly sympathize if you feel that the whole stale-issue workflow is unjust, but I hope that people recognize that raising those challenges in the context of this PR may be counter-productive. The scope of this PR is to fix a bug, not to raise a policy debate.

@ANogin
Copy link
Copy Markdown

ANogin commented Jan 28, 2026

Thanks @ANogin that's good feedback and I appreciate your comments. I guess I'm not sure I understand why one approach is "wrong" (unless you mean technically incorrect) and the other is "correct". Since you don't identify any logical issues, I have to assume it's more of a stylistic preference.

You are right - I misunderstood your suggestion, sorry. Your approach is effectively equivalent and is indeed a lot simpler.

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.

[BUG] github-actions incorrectly closed a bunch of issues for "60 days of inactivity"

3 participants