You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: a pull-request session follows the pull request's head - #126
An old session showed old code, sent the attendant to the old head, and only found out at posting time. Now the Sessions page and the review page move a session to the current head (open findings carry over), the review page offers Update when the head moves while it's open, and posting to an outdated head asks: update, or post to the reviewed commit anyway.
The Sessions page moves a row's session to the current head (findings carry over), a review page
opened on an old head moves on by itself and offers Update when the head moves while open, the
attendant is always handed the current head, and posting to an outdated head asks first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
The reason will be displayed to describe this comment to others. Learn more.
One P3; the rest checks out. advanceSession reuses createSession/carryForward, the 409 now carries a code that the dialog acts on, and both review triggers hand the routine the advanced session.
The reason will be displayed to describe this comment to others. Learn more.
P3: Suppose an agent is still reviewing the old session when the page loads. The page moves to the new head anyway, and the agent keeps writing findings to the old session. The new session then has no review-in-progress banner, so the reader can post while findings are still arriving somewhere they can't see. Suggestion: skip the automatic move while info.review is in progress and show the Update banner instead.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Session migration can leave open findings behind or prematurely remove them from active reviews, causing findings to disappear and replies or status changes to fail with 404s.
This PR makes pull-request review sessions follow the current head across the Sessions page, review UI, and agent review requests. It also lets users explicitly post to the reviewed commit after the pull request changes.
Changes:
Add head detection, session advancement, and current-head routing for review requests.
Add update prompts and preserve posting drafts across session navigation.
Extend API contracts, documentation, and tests for moved-head behavior.
File
Description
README.md
Document head-following sessions and outdated posting choices.
packages/ui/tests/follow-head.test.tsx
Test navigation, update prompts, and draft restoration.
packages/ui/src/lib/session-head.ts
Add session navigation and draft storage helpers.
packages/ui/src/lib/api.ts
Handle moved-head refusals and advancement requests.
packages/ui/src/hooks/use-info.ts
Navigate to the session receiving an agent review.
…ab follows it when nothing would be lost
Advancing onto an existing session carries the source's open findings over too, and posting anyway
needs something to post.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
Prevent optional GitHub lookup from blocking page load
packages/server/src/ui-api.ts:136
On a cache miss, /api/info now waits for GitHub, and the review page's loader waits for this response even when the diff is already available locally. GitHub's 60-second request timeout (github.ts:214) exceeds the load balancer's documented 30-second timeout (live.ts:10), so a stalled lookup can prevent the page from loading before the fallback runs. Give this optional lookup a shorter timeout or load head drift separately from the page's required data.
This callback captures the summary and selection from when Update was clicked, but the textarea and comment toggles remain editable while advancement is pending. Edits made during the fetch/reanchoring wait are visible in the dialog, then the callback saves the older values and navigation discards the edits. Disable draft editing while updating, or read the latest draft from a ref when saving it immediately before navigation.
Preserve saved drafts when following an updated head
packages/ui/src/hooks/use-follow-head.ts:58
If Update saves a post-dialog draft for head B and B's initial /api/info already reports head C, this branch advances again without carrying the saved draft to C. The summary, verdict, and deselections are then missing from the destination dialog. Block initial auto-follow when a saved draft exists or the restored dialog is open, including before GitHub details finish loading.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved head-advancement and navigation issues can discard drafts, break active replies or agent work, and leave readers on outdated sessions without an Update control.
Check cached PR heads for sessions created during a push
packages/server/src/service.ts:270
A push after createSession fetches the head but before it inserts the session leaves an outdated session whose createdAt is later than the PR's updatedAt. This filter then skips head checks on every Sessions refresh until another PR update, continuing to display the old SHA. Consult the cached pull head for all rows with a session instead of treating insertion time as proof of freshness.
Block auto-advance while an Ask Claude response is pending
An agent answering an Ask Claude question is counted in liveStatus.working, not as a pending review, so a hidden tab can automatically advance while that answer is in progress. Advancement moves the thread and live request, but the routine agent's token remains scoped to the old session and its reply fails with “belongs to another session”. Wait for live status before deciding to follow, and block automatic advancement while question work is outstanding.
When a PR with an empty diff receives a new commit while the tab stays visible, the hook detects the new head but the reader remains on “No changes found” without an Update control. The diff.files.length === 0 branch returns before this banner is rendered. Render the banner in that empty-state branch too.
This callback captures the summary and selection from the render in which Update was clicked. The summary textarea and comment controls remain editable while /advance waits for GitHub and Git, so edits made during that wait are visible locally but the older draft is saved before navigation, silently discarding the later edits. Read the latest draft from a ref when beforeLeaving runs, or disable all draft-editing controls while updating.
Recheck pending reviews before navigating
packages/ui/src/hooks/use-follow-head.ts:60
If an info poll reports a pending review while /advance is in flight, its final safety check still captures the earlier reviewing = false and navigates away from the session receiving the findings. The initial-load predicate also omits a pending-review recheck. Read the latest reviewing flag at navigation time rather than the value from the render that initiated the request.
Preserve drafts before redirecting outdated sessions
packages/ui/src/hooks/use-info.ts:25
When a review is requested from an outdated session, this unconditional document replacement discards any inline comment or reply draft on the page, including text entered while the request was pending. Unlike automatic head following, it never checks safeToLeave. Recheck page safety before redirecting; if a draft or write is present, keep the page and offer Update, or preserve that work across navigation.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Prepared sessions can omit carried-over findings, and stale pending-review checks can navigate users away just as an agent starts work, leaving later findings on the old session.
… and an automatic move reads the latest review state
The Sessions page links the session still holding open findings, so a prepared session that was
left empty is never shown without them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unbounded waits for optional GitHub head probes can block the entire Sessions page for multiple timeout batches instead of promptly displaying existing session rows.
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
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.
An old session showed old code, sent the attendant to the old head, and only found out at posting time. Now the Sessions page and the review page move a session to the current head (open findings carry over), the review page offers Update when the head moves while it's open, and posting to an outdated head asks: update, or post to the reviewed commit anyway.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Bwp5QefjsjMFeq6CK6cT6w