Skip to content

Worktrees: related pull requests from evidence, never from names (#337, #338) - #381

Closed
raiseCatError wants to merge 1 commit into
release/v0.18.0from
feature/worktree-pr-evidence
Closed

raiseCatError wants to merge 1 commit into
release/v0.18.0from
feature/worktree-pr-evidence

Conversation

@raiseCatError

Copy link
Copy Markdown
Owner

Audit of #337/#338 found the related-PR action permanently unavailable (No pull request evidence yet). Based on release/v0.18.0; TerminalApp untouched.

  • src/worktrees/relatedPr.ts: a PR is related only when its head branch in the PR's own repository equals the worktree's branch exactly. Fork PRs with the same branch name, PRs whose head repository GitHub did not report (fail closed), detached worktrees and partial names are not evidence. atHead reports separately whether the worktree's HEAD is the PR's head commit (unknown stays unknown).
  • /worktrees controller: pullRequests option (the host's cached /github listing; the manager never fetches), relatedPr action available only with evidence, p → openPullRequest intent.
  • GitHub search summaries now include headRefOid and headRepository { nameWithOwner } (sanitized; malformed SHAs dropped), so forks can be told apart without fetching details.

Audit notes (no change needed): GitHub writes remain impossible (executeRemoteWrite always throws; transport is query-only GraphQL and GET-only REST) — the merge flow stays a preview, as #338 requires; worktree removal stays non-forced Git with exact review.

Remaining host step: pass the listing to /worktrees and open /github on openPullRequest. Tests: tests/worktreeRelatedPr.test.ts plus existing GitHub/worktree suites.

#337 with #338. The related-PR action was always "No pull request evidence
yet". It is now available when the host passes its cached /github listing
(no fetching in the manager), and `p` returns an openPullRequest intent.

relatedPullRequests counts a PR only when its head branch, in the PR's own
repository, is exactly the worktree's branch. A fork's PR with the same
branch name, a PR whose head repository GitHub did not report, a detached
worktree and partial branch names are not evidence. Whether the worktree is
at the PR's head commit is reported separately.

To tell fork PRs apart from summaries, the search query now asks for
headRefOid and headRepository; PrSummary carries them (sanitized; a
malformed commit id is dropped). Wiring the listing and the intent into
TerminalApp is the remaining host step.
@raiseCatError

Copy link
Copy Markdown
Owner Author

Integrated, not merged here: this head (8a40b76a) is part of the release line that shipped in v0.20.0 through the authoritative release PR #392 (merge commit 65e4de55). Closing because its changes reached master by that route; the branch is kept for history.

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