Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): PR guides work for pull requests on a fork's own repository #39601

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/39601/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

A project that is a checkout of a GitHub fork, with an upstream remote pointing at the parent, could not write or show review guides for pull requests opened on the fork itself. The PR Guide tab said the PR was in another repository, and write_pull_request_guides said no project was a checkout of the fork. The project's identity is keyed on the upstream parent, and both checks compared the PR only with that key.

  • ownPullRequestRepositories lists the repositories whose pull requests are the project's own: the main repository, plus the fork its origin remote names when it is on the same host.
  • PullRequestReviewGuideService.requireOwnRepository and the MCP projectForPullRequest match against that list. For a fork's own PR, the guide is fetched from the origin remote.

Fixes pingdotgg/t3code#39592

Reproduction on main

Commit 16d40942ac (origin/main). In a fresh worktree: T3CODE_DEV_SEED=0 vp run dev (fresh database). Created a git checkout with origin=https://github.com/juliusmarminge/t3code.git (a real GitHub fork of pingdotgg/t3code) and upstream=https://github.com/pingdotgg/t3code.git, and added it with t3 project add <path>. Signed in with a bearer session from t3 auth session issue, turned on reviewGuidesEnabled with server.updateSettings, then called the WebSocket RPC pullRequests.generateReviewGuide (the PR Guide tab's call) with {projectId, host: github.com, repository: juliusmarminge/t3code, number: 4}. Result: PullRequestOperationError "Guides are written from this project's checkout, and this pull request is in another repository. Write it from a project that is a checkout of that repository." The MCP path (write_pull_request_guides) matches projects in projectForPullRequest using the same canonical key, so it fails earlier with the reporter's exact "No project in this environment is a checkout of /" message; the failing handler test on the repro branch shows this. Both tests on factory/repro-39592 fail on main.

Evidence

Created a fresh fork checkout with an upstream remote, enabled review guides, opened #4, and clicked Guide → Write guide in the real web client. The same request fails on base and succeeds on head. This proves request acceptance, not completed guide generation.

BeforeAfter
16d40942ac76a4c52fb3
Before: fork PR rejected as another repositoryAfter: fork PR guide request accepted
Before recordingAfter recording

Scenario source. Evidence uploaded using the ghdrop skill.

Not shown:

  • Completed guide generation and rendering were not exercised: the scenario runner disables real text-generation models, and this proof ends at successful request acceptance.
  • The write_pull_request_guides MCP entry point was not exercised; this comparison covered the PR Guide UI and its WebSocket RPC.

Tests

  • vp test run src/pullRequest/PullRequestReviewGuideService.test.ts src/mcp/toolkits/pullRequests/handlers.test.ts without the fix: 2 failed (the repro tests), 40 passed
  • Same command with the fix: 42 passed
  • vp run check:changed: format, lint, knip, typecheck (3 packages) and tests (4 files, 46 tests) all pass
  • PR CI on 76a4c52: all 38 checks passed

Not in this change

  • A fork whose origin is on a different host than its upstream still only matches its upstream, in line with how issueBindings handles fork issues.
  • Client-side PR-to-project matching (packages/client-runtime/src/changeRequestLinks.ts) was not changed; the report and tests cover only the server paths.
  • CodeRabbit's trivial nitpick to make the parent remote differ in the new service test was left as is.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

    1. Pushed84f3099

    2. juliusmarminge merged thisd984b71

    3. juliusmarminge closed this

Sign in to join this conversation.