Repository navigation
fix(inbox): keep a PR review's unsent comments and Viewed until a new commit - #2640
Merged
Merged
Conversation
… commit, not a new updated_at updated_at moves with a label, a teammate's comment or a review, and each move deleted the person's unsent line comments and Viewed ticks, read the diff again and took the reader down. Key them on the head commit (the patch's, else the list's), and the diff on head and base. Entries under the old key move over whole.
…his review read a patch Whole stack's compare named no head, so a list behind it deleted comments on the patch. The server now reads the head around a stack's compare too, and caches diffs by head. A patch naming its head stays until a read names a newer one, so a list landing on a head still behind it deletes nothing; a new head brings a new reader, so an open composer cannot save onto a moved line. Stored entries move only once this review read a patch itself, not on a remembered diff. Line comments from a key naming no head are marked outdated: they post in the body, labelled.
… or names no head changes nothing A dialog open over a new commit, or a retry after one, sent its old lines at the new head. The plan now pins the head it was built on: the server refuses a commit it no longer takes, what was typed stays, and reopening builds a new plan. A failed or headless re-read keeps the patch and goes again on the next list read. The reader is keyed on the code. Global comments and old entries stay in view when no patch has been read here, and only a named head on a changed PR labels a comment outdated. Whole stack posts at the patch's head, so catching up no longer offers a second Approve.
…-same-head # Conflicts: # docs/agent-guides/inbox-files-and-guides.md # packages/inbox/pulls/PullReview.tsx
…n the forge is ahead A patch naming no head now keeps the name it came up under while the list moves, so a comment written on the old lines cannot be saved under the new head and post there. Other code naming no head takes the list's name again. An old entry moving to a head the list does not name is marked outdated, so it goes in the review body rather than inline on today's line. A diff remembered in the window is drawn only if it is of the newest head read here, as the server's cache does.
…entries with no list head; keep typed words from becoming an Approve
backnotprop
added a commit
that referenced
this pull request
Nov 5, 2026
Takes #2640's rule early so the two merge cleanly: head_sha in both scopes, and readHeads holds only heads that held still. A file read uses that head, else the list's, and the client asks nothing when an answer has no head_sha, in either scope. Co-Authored-By: Claude <[email protected]>
A saved line comment now survives a real push, on screen and in storage. If its line reads the same in the new diff it stays drawn; otherwise it is in the Comments panel as "Written on older code". On GitHub, Post sends it at the commit the person read, in that commit's lines, as a comment-only review. If that commit has gone (a force-push), the server answers pull_commit_gone and the comment goes in the body with its [Outdated] label, unless its lines still read the same at the new head. GitLab's docs do not say a thread can go on an older version, so GitLab takes the labelled route. A retarget under the same head also does, unless the line is still there. The dialog no longer refuses a push that came in while it was open: what it showed goes at the commit it opened on.
…-same-head # Conflicts: # docs/agent-guides/inbox-files-and-guides.md # packages/inbox/pulls/PostEnding.tsx # packages/inbox/pulls/PullReview.tsx
…omment only after a refusal
… post Request changes with every comment on an older commit now sends the verdict, and older-commit reviews carry the shared body. GitHub's 422 becomes pull_commit_gone only for a refusal of the commit or its lines, or with no reason, and at a head the list names only if the commit really left the PR. A thread's review pane reads the PR again on pull_commit_gone. What went leaves every stored entry of the review, so a push landing during a post cannot bring it back; only the comments in the plan count as posted, and already_posted at an older commit counts as went. A comment on lines outside the diff never goes at an older commit. The committed e2e now walks a saved comment over a push to both commits.
When GitHub refused an older commit, the plan was rebuilt from the comments on screen. A push under the open dialog gave a comment planned for the head a postAt, so it became an older-commit target nothing sent, and it was then counted as posted and erased. The rebuild now takes the plan as it stood, a postAt equal to the plan's head is that review's, and a comment counts as gone only if a target the forge accepted carried it. "Reference could not be resolved" no longer reads as the commit being gone; "start_line must be part of the same hunk" takes the fallback like other refused lines.
…as they stand A comment edited after its plan was built was forgotten when its old words posted. What went is now noted with its words: an edit since stays. The dialog rebuilds its plan from the comments as they stand on reopen and at Send; a partly posted review keeps its narrowed retry in the current words, and what the forge took leaves at once and is not sent again. A post of unknown result can go again once the dialog is reopened, and the server's already_posted ends it. Over-limit or malformed file-level comments are refused, not cut. Another window's write reaches this one, and a push's move empties the old entry only once the new one holds the words.
…a main comment that went A window still on the old head could edit a comment another had moved: the next move kept the head's version and dropped the edit. Both now stay, as two comments, for the person to see both and delete one. A partly posted review's main comment stayed in the box over a new commit, unlocked, and went again. It is cleared if the forge took it. Over 500 file comments, the dialog now says so in plain words.
…-same-head # Conflicts: # packages/server/inbox.ts
backnotprop
marked this pull request as ready for review
November 5, 2026 12:12
…names no viewer PullReview imported them from @plannotator/review-editor, which the guard on the window's first load refuses by name. The module has no viewer in its graph (only type imports), so it moves to packages/ui as it is, beside the CodeAnnotation type it reads. No behaviour changes.
backnotprop
added a commit
that referenced
this pull request
Nov 5, 2026
Conflicts kept both sides: `guest` and `codeReview`, the outside-diff and outdated labels together, `fetchFileContent`/`fileContents` with `fileOpenIn`, #2640's readHead comment with hasCommit and fileContents, its key comment over ReaderPart, the union of imports, and both e2e tests (main's first). Co-Authored-By: Claude <[email protected]>
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a data loss in the Inbox's PR page. Unsent line comments and Viewed ticks were kept per
updated_at, which moves with a label, a teammate's comment or a review. Any of those deleted them. Same head on the old code, in the DOM test:Comments, 2becameComments, 1andviewed: ['src/retry.ts']became[]. It also read the diff again and took the reader down, losing the scroll and a comment being typed.The fix
readHeadsnow takes both scopes).pull_moved, its existing sentence), what was typed stays, and reopening builds a plan of the new head, even after a partial or blocked attempt. I chose this over closing the dialog: nothing typed is lost, and nothing is posted at a head the person never read.SEEN.SEENonly draws a diff of the newest head this window read, as the server's cache does, so a list gone back reads the forge first instead of hiding work on the newer head.seenId) is keyed on head and base;updated_atonly stands in while the list names no head.Visible changes: on a real push the old patch stays until the new one lands, instead of "Reading the diff…". The "Review posted" banner stays until the head moves or you leave the page. With a folded panel, the Comments button now shows on a read-only review when there are words to read.
Second Approve. It did go out: on the list-head rule, which main has too, Whole stack posted at A, the list reached B, Approve came back, and a second review went at B (run in the DOM test; the server's duplicate check includes the head). So this predates the PR. Fixed here.
Migration and
outdated. Nameless entries move whole once a patch is read here. A comment written since this PR has a stamp, which decides. An older Inbox's comment has none, so it getsoutdatedwhenupdated_athas changed since the entry's key, or when a head is named that the list doesn't name, a list naming none included. That leaves these false labels, whichcodeAnnotationAnchor.tstreats as the safe direction:updated_atmoved but whose head didn't: nothing stored can tell.outdated, since its line number is no more trustworthy after an edit.No missing label is known now. The earlier note here, about a null head and a write, is closed: an old entry on a changed PR is labelled as soon as it's seen, with or without a head. That changes one behaviour a test held before: with no head known, it used to carry no label until one was named.
codeAnnotationAnchor.tsmoved frompackages/review-editor/utilstopackages/ui/utils, unchanged but for its two type imports, because the Inbox's first load may not name@plannotator/review-editor(tests/entry-assets.test.ts). The module has only type imports, so no viewer code came with it.Saved comments survive a push (the owner's decision), as GitHub's pending comments do. On screen and in storage; only Viewed ticks drop.
readHead,readBase, a stamp of the patch, and the anchor text and context fromcodeAnnotationAnchor.ts. It's drawn on the diff only on the same patch, or the same code at the same side and lines. Otherwise it's only in the Comments panel, labelled "Written on older code" (an optionalcodeAnnotationNoteprop onAnnotationPanel: the onepackages/uichange, since the panel lives there; no caller but this one passes it).commentreview, its body the sharedSee inline comments., as GitHub's docs andpr-github.tsrequire one. The verdict and typed words go at the head on screen; a verdict always goes, with that same body if it has no words of its own. The dialog's row starts with the commit, so a long repository name can't hide it: "Simplify extensions to thin wrappers: server-owned prompts, vendor trim, dumb-pipe CLI #801 — read at 1111111". What went leaves every stored entry of the review, so a push landing during a post can't bring it back to go twice. A comment counts as gone only if a target the forge accepted carried it, and when GitHub refuses an older commit the plan is rebuilt from what it held, not from what came in under the dialog: another window's comments, or a new head's view of the ones planned, wait for the next plan.already_postedat an older commit counts as went. A comment on lines outside the diff (Expand arrows on the Inbox's PR page and guided reviews #2635'soutsideDiff) never goes at an older commit: it stays in the main comment at the head.[Outdatednote in the body, or inline at the head if the code still reads the same. It applies when the commit has gone (pull_commit_gone, frompulls/N/commits, or GitHub refusing that commit or its lines (part of the diff,part of the same hunk,Path could not be resolved) or answering 422 with no reason; at a head the list still names, only whenpulls/N/commitsno longer has it. Any other refusal, such as your own PR, a pending review or too quickly, stayspull_review_failed, and a full list of 250, GitHub's most, not naming the commit says nothing), and when the lines can't be vouched for: same head on another patch (a retarget, unless the same code is still at those lines), read with no head named, or another base. Words are never lost and nothing goes on a moved line, by the model in the tests.position[head_sha]as "SHA referencing HEAD of this merge request", and say nothing about placing a thread on an older version or what happens otherwise, so I couldn't verify it. Same code goes inline at the head, other code goes in the body, labelled. Thepull_movedrefusal stays on GitLab, with the T8/T9 fixes: Retry shows the new plan, and typed words never become an Approve.A comment is forgotten only in the words the forge took. What went is noted with its words (
postedSignature, moved topostRules.ts, now also the label and decorations), so a comment edited since stays, on screen and in storage, and goes next.retry), whenpostedFileCommentCountagrees; if the count disagrees, nothing counts as gone, so they are sent again rather than lost.already_posted, whose fingerprint holds the same head, action, body and comments, also counts, now at the head too.already_postedends it as posted.422), instead of cutting them for the page to forget.storageevent), so its next save does not write over it. A window that could not store keeps its own copy as the only one. A push's move empties the old entry only once the new one holds the words.How it looks (real build, a fake
gh): pictures at 1440 and 390, light and dark, in/tmp/rv2640c/built-final, taken from a build of this head. The dialog's partial, reopen and too-many-file-comments states are in/tmp/pr-keep-sandbox/walk/f7/j-shots.Cost. A read that misses the cache costs 3
ghcalls in either scope (head, patch, head), 2 more than a stack read used to. A post at an older commit costs one more (pulls/N/commits). Labels now cost none. A read that keeps failing, or names no head, repeats on each list read (2-minute tick, focus at most every 20 s).Tests. New
pullReviewKept.test.tsxcovers both scopes, with the real post dialog for the post routes.sure, list-head posting,SEENover any head, a stale cache,readmode writing, no absorb, both label rules,seenIdwithout base, catch-up ignoring base, the regex at 40,sureout of the deps. Added this round: the name following the list, the name sticking over other code, the list-head label off and always on,SEENover an older head, the newest head never recorded, a verdict or a post without absorb, the banner outliving a head.sure = !!head && !!readHead.currentmutant no longer applies:sureis now just "a patch read here named its head".scope === 'layer'inforPost: Whole stack line comments go to "Cannot post inline" anyway, so it only changes the label in Copy as Markdown. The reviewer's M20 is unreachable behind the GitLab check, and M28, the panel's other card branch, has no test.Results at this head, on Bun 1.4.4 (CI's) for the tests. The browser runs are on a binary built at this exact commit:
entry-assets,inbox-pulls,guideFeedback,agents-md-size,codeAnnotationAnchor,outsideDiffComments,review-draft-localandci-test-lanes: 210 pass.--isolateas CI's lanes run them:pullReviewKept,pullReview,pullReviewGlobalComments,usePulls,reviewPane,dom-test-allowlistlocalReviewDraftand sevenAnnotationPanelfiles: 283 pass. Without--isolate, files in one run share module mocks and fail, also with no file of this PR's (pullReview+pullReviewGlobalComments: 2 fail); no CI lane runs them so.tsconpackages/inbox,apps/inbox,packages/server,packages/coreandpackages/ui: clean.tsconfig.guide.json: 33 errors, all inpackages/review-editor, as on main.inbox-pull-requests.spec.tson a sandbox binary: 10 pass, 2 skipped. One test walks a line comment over a push: the label shows, thencommit_id,lineandbodyat the old commit, then the typed words at the new head.gh/glab, not committed; they log what the fake received): 6 for this round (the reviewer's B1 by hand in the panel: the forge has the first comment and the new words, once each, no old words, Comments 0 after reload; B2; an edit and a delete under the open dialog; a real second window; an answer lost at the head), 16 of mine, 4 of the reviewer's S scenarios.zz-jon this build: 7 pass. T1: both versions shown and posted, Comments 0. T2: main comment once, box empty on reopen. T3: the plain sentence, nothing sent.doneby id gives the same result becauseonPostedholds the comments as they stood at Send; the listener's key filter only saves a re-read; holding a blocked target in the kept-plan check changes nothing, asplanOverdrops it. A mutant that drops a blocked target's narrowed retry is killed.Follow-ups, not in this PR
storageevent arrives can still write over it.fileComments: at most 500 comments….AllFilesCodeViewwith no draft key, so keeping it isn't cheap.Typecheck.
apps/inboxis clean the way the repo'stypecheckscript runs it,tsc -p apps/inbox/tsconfig.jsonfrom the root (TypeScript 6.0.3). From insideapps/inbox, its own TypeScript 5.8.3 gives 12 errors, the same 12 on main, in files this PR doesn't touch.packages/inbox/tsconfig.guide.jsonreports 33 errors, all inpackages/review-editor, none inPlatformPost.tsx.Merging. Main is merged in as of
4d659c5cf. #2635 is still open. A trial merge conflicts inPullReview.tsx,attachments.ts,inbox-pulls.ts, the two guides and the e2e spec. Inattachments.tskeep both the outside-diff heading and the[Outdatedline. With those resolved,pullReviewKeptpassed (119 pass, at the earlier merge), and a comment outside the diff, read before a push, went in the main comment at the head, with Comments at 0. #2639's conflicts were not tried.#2635 reads Whole stack file contents at the list's head (
inbox-pulls.ts:779there), so with the list behind or ahead, its arrows read a different commit from the patch. That gets fixed where the two meet.Not checked: real GitHub and GitLab were not exercised. The commit-anchored behaviour rests on GitHub's docs ("Not using the latest commit SHA may render your review comment outdated") and a model in the tests that lands comments at a commit's diff and refuses what it doesn't have. GitHub's docs don't list the exact refusal for a commit off the PR, or say an older
commit_idis accepted outright. Also unchecked: GitLab's null head for real, a real retarget or force-push, and whetherpulls/N's head can lag the branch tip that a compare reads.