fix(opencode): link sessions to PRs without a timed gh pr view probe - #14075
Open
iscekic wants to merge 1 commit into
Open
fix(opencode): link sessions to PRs without a timed gh pr view probe#14075iscekic wants to merge 1 commit into
iscekic wants to merge 1 commit into
Conversation
iscekic
marked this pull request as draft
September 12, 2026 14:36
iscekic
force-pushed
the
kwf/session-pr-link-without-gh-pr-view-2e6c
branch
from
September 12, 2026 14:38
686b6b2 to
9502ed3
Compare
Contributor
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (11 files)
Fix these issues in Kilo Cloud Previous Review Summary (commit 686b6b2)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 686b6b2)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (11 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
iscekic
force-pushed
the
kwf/session-pr-link-without-gh-pr-view-2e6c
branch
from
September 12, 2026 14:52
9502ed3 to
a7a7679
Compare
iscekic
force-pushed
the
kwf/session-pr-link-without-gh-pr-view-2e6c
branch
from
September 12, 2026 16:27
a7a7679 to
bbe4d15
Compare
iscekic
marked this pull request as ready for review
September 12, 2026 16:42
iscekic
marked this pull request as draft
September 12, 2026 16:46
iscekic
marked this pull request as ready for review
September 12, 2026 17:05
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.
Changelog for users
set_pr_linkremote command, which becomes the override and stops detection.Changelog for maintainers
detectPrLinkruns nogh pr view; it reads@{upstream}, HEAD, and the remote URL locally, then falls back to onegh api repos/{owner}/{repo}/pulls?head={owner}:{branch}&state=allcall with a 5-minute negative cache and a 15-minute failure backoff.recordPrLinkTextrecords a PR URL from session output; thePartUpdatedhandler checks text and completed-tool output and syncs once per change.set_pr_linktakes{ prUrl }or{ cleared: true }, validates the URL, writes the override, ACKs, then fires a best-effort heartbeat; invalid input or a write failure returns an error and writes nothing. ThePrLink/session_pr_linkcontract is unchanged, so the mobile app needs no change.detectPrLinkandlookupfirst: the coalesced in-flight lookup and the branch-scopedlastPositivekeep a known link advertised across a failed same-branch head change, never across a branch change.src/kilo-sessions/pr-link.test.tsmoved undertest/kilocode/sessions/so the package runner executes it, and the orphanedpatches/[email protected]was removed (bun.lockalso reorders the trusted and patched dependency lists).packages/opencode/src/kilo-sessions/pr-link.ts:223— accepted:lastPositivenow stores the branch next to the link, and the fallback returns it only when the branch matches, so a failed lookup after a branch switch yields no link instead of the previous branch's; the earlier branch-switch proof is replaced by the branch-switch-with-failed-lookup scenario.packages/opencode/src/kilo-sessions/pr-link.ts:105— accepted: all five per-worktree maps are written through arememberhelper that caps each at 64 worktrees and evicts the least recently used; eviction only makes that worktree's next detection start fresh.packages/opencode/src/kilo-sessions/pr-link.ts:196— accepted:recordPrLinkTextignores a URL whose owner/repo differs from the worktree's, anddetectPrLinkdrops a recorded link that later turns out to be for another repository. Tests intest/kilocode/sessions/pr-link.test.tscover the branch-switch fallback, cross-repo URL rejection, and LRU eviction.E2E proof
Proved live: no-PR branch, unchanged head — one REST lookup and zero
gh pr viewcalls while heartbeats keep arriving.Proved live: PR appears mid-session on head change — the
session_pr_linktriple reaches the ingest queue.Proved live: negative cache across heartbeats — exactly one
.../pullslookup on an unchanged head.Proved live: rate-limit/auth backoff — backoff logged, later heartbeats still send, one lookup across the window.
Proved live: PR URL in session output — heartbeat advertises prLink and the ingest queue gets one triple; repeats re-send nothing.
Proved live: app sets the link — heartbeat advertises prLink and the ingest queue gets the triple.
Proved live: invalid app link — error response and the stored link stays unchanged.
Proved live: session-output link survives a later commit — same prLink, no second ingest item, no new lookup.
Proved live: app sets the link while the override write fails — error response and no new link advertised.
Proved live: Session on branch A whose URL was resolved, then switch to branch B while the GitHub lookup fails (offline/rate-limited): the heartbeat advertises no prLink rather than branch A's link.
Proved live: Session output (text or completed tool output) mentions an unrelated repo's PR URL; the worktree does not adopt it.
Proved live: Session output prints the worktree's own PR URL; the worktree adopts it.
Owner-manual checks: skipped, pending owner verification.
Owner request