Resolve old threads on re-review
On the second review pass, half your old comments no longer apply because the author already fixed them. Leaving the threads open is noisy and makes humans rescan things the bot has already cleared. The fix is to resolve obsolete threads in the same pass that posts the new ones.
resolve_threads.py
python
RESOLVE_MUTATION = """
mutation Resolve($threadId: ID!) {
resolveReviewThread(input: {threadId: $threadId}) {
thread { id isResolved }
}
}
"""
def resolve_obsolete(client, pr, fresh_fingerprints: set[str]):
"""Resolve any prior bot thread whose fingerprint is no longer current."""
for thread in pr.review_threads():
if thread.author != BOT_LOGIN:
continue
if thread.fingerprint in fresh_fingerprints:
continue
client.graphql(RESOLVE_MUTATION, threadId=thread.id)GraphQL is the supported path for thread resolution; the REST API does not expose it. The comment fingerprints you built earlier make this a one-shot diff.
Two safety rails. Only resolve threads the bot itself authored: never silence a human reviewer. And run resolve before posting new comments, so the order in the timeline reads cleanly: previous round closed, new round opened.
Quiz: Quiz
Loading practice…