Skip to content

fix(native): send a pull request's review comments to its own session - #913

Merged
omartelo merged 1 commit into
mainfrom
fix/pulls-comments-to-pr-session
Oct 22, 2026
Merged

omartelo merged 1 commit into
mainfrom
fix/pulls-comments-to-pr-session

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

Summary

On the Pulls screen, Send on a pull request's "Comments for the session" batch typed the comments into whichever session was active before Pulls opened, with no check that it was working on that pull request's branch. The Files tab took inject/submit bound to the window's active session (main.go) and keyed the batch by that session's checkout.

  • pullsScreen.reviewSession(d) picks where the pull request's comments go: a session in the checkout of its head branch, the active one when it sits there, the first otherwise. The window's active session in another checkout is never picked.
  • With no session in that checkout, Send raises the existing "Open a session to send these comments to" and keeps the batch.
  • A branch with no checkout keeps its batch under the pull request's URL; once Open in Session creates the checkout, commentStore.move carries the comments over, so nothing written before is lost.
  • Line references injected from that tab follow the same rule.
  • filesInput now carries the active session id and the injector/submitter factories instead of functions bound to the active session; sessionButton reads reviewSession.
  • stale_pulls_test.go: the rig now wires sessionsIn and files the way main.go does (it used to rely on a nil guard the old hook had); no assertion changed.
  • CHANGELOG.md [Unreleased] › Fixed entry.

Test plan

  • native/: gofmt -l . clean, go vet ./... and go test ./... green
  • TestPullRequestCommentsGoOnlyToASessionInItsBranchCheckout: branch checked out, active session inside and outside it, branch with no checkout
  • TestCommentBatchMovesWholeAfterWhatItJoins: the batch moves after what the checkout already holds, an open edit follows it

The Files tab in Pulls bound its comment batch and line injects to the
window's active session and keyed the batch by that session's checkout, so
Send typed a pull request's comments into whichever session was open before
Pulls, reviewing another branch.

reviewSession now picks a session in the checkout of the pull request's head
branch: the active one when it sits there, the first otherwise. With none,
Send refuses and keeps the batch. A branch with no checkout keeps its batch
under the pull request's page, and the comments move into the checkout once
Open in Session creates it.
@omartelo
omartelo merged commit 75ee91a into main Oct 22, 2026
7 checks passed
@omartelo
omartelo deleted the fix/pulls-comments-to-pr-session branch October 22, 2026 20:15
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