Comments creation is failing silently, with the illusion of "Pending" comments that saved on the server
- Extension version: v0.54.1
- VSCode Version: 1.73.1
- OS: MacOS
Steps to Reproduce:
- Start a review and wait for a while (maybe until the session is expired)
- Try to write a comment and then edit it or comment in the thread
Comments creation is failing silently
After a few hours of code review on a massive PR, I noticed an error when I commented on another comment on one of my threads.
Creating comment failed: Error: Cannot reply to temporary comment
I tried to save the comments without success, and I realized that none of the comments that I made in recent hours did save on GitHub as a "Pending" comment as always. It was just an optimistic UI that gave me the illusion that the comments were saved in GitHub, but it held my comments in memory.
I can't determine what caused the bug. Maybe it was because time passed and my session got expired or something like that (We're login into GitHub with SSO, and the session is limited to a few hours) I cannot find out because everything is failing silently until I comment in the thread/edit a comment, and even then, there is no relevant log-in console in the extension output pane (see the attached video)
https://user-images.githubusercontent.com/5693018/205736222-4496ebc0-10c2-4838-8703-90834b2ebc19.mp4
Besides the unknown cause of the bug, it's just a very bad idea to save the comments in memory. This optimistic UI gave me the illusion that everything was fine and made me lose many work hours. We can't rely on and use it for our PR's anymore
We need the optimistic UI otherwise you'll see a pretty dramatic flicker.
I can see where we're supposed to be showing an error notification when creating the comment fails. It looks like you're not getting that error notification. I think we need some kind of spinner to indicate that the comment is still in progress. Started discussion for this here: https://github.com/microsoft/vscode/issues/168431
@yoavbls any chance that you can still reproduce the issue and are willing to share some logs? If so, can you "githubPullRequests.logLevel": "debug", reproduce the issue, then share the Output from "GitHub Pull Request"?
We need the optimistic UI otherwise you'll see a pretty dramatic flicker.
I can see where we're supposed to be showing an error notification when creating the comment fails. It looks like you're not getting that error notification. I think we need some kind of spinner to indicate that the comment is still in progress. Started discussion for this here: microsoft/vscode#168431
Yes, you're right, the optimistic UI is fine but we must have some indication for loading/failure. Thank you for starting this discussion.
@yoavbls any chance that you can still reproduce the issue and are willing to share some logs? If so, can you
"githubPullRequests.logLevel": "debug", reproduce the issue, then share the Output from "GitHub Pull Request"?
I changed the logLevel to debug, and I will try to reproduce it when I'll do a long code review. Then I'll share the output here of course 🙏🏼
@alexr00 It happened to me again, and that was what been in the output console at the time:
[Debug 1672510572.096s] RateLimit> API call count: 107 (/repos/{owner}/{repo}/pulls/comments/{comment_id})
[Debug 1672510572.973s] RateLimit> Rate limit remaining: 4969
[Debug 1672510572.973s] PullRequestTree> Review threads have changed, refreshing Files node
[Debug 1672510572.973s] PullRequestTree> Review threads have changed, refreshing Commits node
[Debug 1672510572.974s] RateLimit> API call count: 108 (GetPendingReviewId)
[Debug 1672510573.013s] PullRequestTree> Getting children for Files node
[Debug 1672510573.013s] PullRequestTree> Got all children for Files node
[Debug 1672510573.434s] RateLimit> Rate limit remaining: 4829
[Debug 1672510573.441s] RateLimit> API call count: 109 (GetPendingReviewId)
[Debug 1672510573.914s] RateLimit> Rate limit remaining: 4828
[Debug 1672510593.49s] RateLimit> API call count: 110 (GetPendingReviewId)
[Debug 1672510593.914s] RateLimit> Rate limit remaining: 4825
[Debug 1672510593.914s] RateLimit> API call count: 111
[Debug 1672510594.37s] GitHubRepository> Fetch pull request 20532 - enter
[Debug 1672510594.37s] RateLimit> API call count: 112 (PullRequest)
[Debug 1672510594.816s] RateLimit> Rate limit remaining: undefined
[Debug 1672510594.819s] PullRequestTree> Review threads have changed, refreshing Files node
[Debug 1672510594.819s] PullRequestTree> Review threads have changed, refreshing Commits node
[Debug 1672510594.823s] PullRequestTree> Getting children for Files node
[Debug 1672510594.823s] PullRequestTree> Got all children for Files node
[Debug 1672510595.316s] RateLimit> Rate limit remaining: 4820
[Debug 1672510595.316s] GitHubRepository> Fetch pull request 20532 - done
[Debug 1672510595.317s] PullRequestModel> Fetch file changes, base, head and merge base of PR #20532 - enter
[Debug 1672510595.317s] IssueModel> Fetch viewers latest review commit
[Debug 1672510595.317s] RateLimit> API call count: 113 (LatestReviewCommit)
[Debug 1672510595.707s] RateLimit> Rate limit remaining: 4819
[Debug 1672510595.708s] RateLimit> API call count: 114 (/repos/{owner}/{repo}/compare/{base}...{head})
[Debug 1672510596.245s] RateLimit> Rate limit remaining: 4967
I've encountered a similar issue when trying to comment on a Draft PR. Maybe that is related with the issue. Although changing it from draft to normal PR did not fix it.
My log output:
2023-12-28 17:31:40.517 [info] PullRequestTree> Got all children for Files node
2023-12-28 17:31:40.683 [info] PullRequestTree> Review threads have changed, refreshing Files node
2023-12-28 17:31:40.683 [info] PullRequestTree> Review threads have changed, refreshing Commits node
2023-12-28 17:39:03.334 [debug] ReviewCommentController> Found matched file for commenting ranges.
2023-12-28 17:39:03.335 [debug] ReviewCommentController> No commenting ranges: Diff is in base and none of the diff hunks could be added.
2023-12-28 17:39:03.335 [debug] ReviewCommentController> No commenting ranges: Diff is in base and none of the diff hunks could be added.
2023-12-28 17:39:03.335 [debug] ReviewCommentController> No commenting ranges: Diff is in base and none of the diff hunks could be added.
2023-12-28 17:39:03.335 [debug] ReviewCommentController> Found 21 commenting ranges.
2023-12-28 17:39:03.360 [debug] ReviewCommentController> Providing 11 commenting ranges for CheckedContract.ts.
Also FYI "githubPullRequests.logLevel": "debug" does not work anymore. It is changed by ctrl + shift + P Developer: Set Log Level
This is the related PR if that helps https://github.com/ethereum/sourcify/pull/1243/files#diff-0d9298f18c4401448b178bd182d4f29b33a995eacb65e3cfabf80c28ceba6ca7R327
Edit: After I opened & closed the VSCode (after changing it to a normal PR instead of draft) it works as expected.
@kuzdogan thanks for the logs! Can you remember which line you were trying to comment on?
@alexr00 no sorry :( But one of the ones that are resolved there
Who thought silently failing was a good idea? Just lost hours on this all comments lost following a long code review 👎