Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): sync linked PR status on hosts without the stacks API #14460

Closedevbuildsnet(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/14460/headopened View on GitHub

What Changed

VcsProcess.classifyNonZeroExit now classifies a gh failure whose stderr contains HTTP 404 as not-found. That lets the existing GitHubPullRequestNotFoundError fallback in getPullRequestStack run, so a host that does not serve the stacks endpoint is read as "not stacked" instead of a failed lookup.

One regression test feeds the raw gh: Not Found (HTTP 404) process output through VcsProcess and asserts the not-found classification without retaining stderr.

Why

On a GitHub Enterprise Server release without native stacks, the ordinary PR read succeeds and reports merged, but gh api .../stacks?pull_request=N exits with gh: Not Found (HTTP 404). The process boundary only recognized the GraphQL not-found messages for gh, so this came back as command-failed. getPullRequestStack already documents 404 as "no stack", but the fallback never ran.

PullRequestSyncReactor.syncGroup deliberately withholds a snapshot until the stack answer arrives, so sibling layers are linked before a terminal snapshot can settle the thread. With the stack read failing forever, the merged summary was never persisted: the detail panel showed Merged while the sidebar badge stayed pending and the thread never settled. The panel also kept offering Retry stack lookup.

Fixing the classification is the smallest change that restores the intended flow. The reactor's hold-until-stack-known behavior is unchanged, so a genuine transient failure still preserves the previously synced stack and retries.

Authentication, rate-limit, and transient failures are not affected: they match earlier branches of the classifier and still reach the stack read as errors, which keep a known stack and retry. An access-scoped 404 cannot be mistaken for "unstacked" in practice, because both callers (the sync reactor and the detail panel read) only ask for the stack after a summary read of the same PR on the same host and credentials succeeded.

Related: #12645 takes the same classification change and adds an extra access-probe request per stack read. This PR is the minimal version.

Validation

  • vp test run for VcsProcess.test.ts, GitHubCli.test.ts, GitHubPullRequestCli.test.ts, and PullRequestSyncReactor.test.ts: 186 passed. The new test fails on main with failureKind: "command-failed".
  • Server tsc --noEmit, targeted vp lint, and vp fmt --check pass on the changed files.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (no UI change)
  • I included a video for animation/interaction changes (not applicable)

Fixes #14458

Diagnosed and implemented with Claude Fable 5.1 in Claude Code.

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: ec03d0c1-7a70-4d7c-a5c8-d1aab33d1be8

      📥 Commits

      Reviewing files that changed from the base of the PR and between c2fa9fc911daeac97df4760f95fc57dca42b84c8 and 62f1fd70baf530718d1353c6dab2a96c098dd031.

      📒 Files selected for processing (2)
      • apps/server/src/vcs/VcsProcess.test.ts
      • apps/server/src/vcs/VcsProcess.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


      📝 Walkthrough

      Walkthrough

      VcsProcess now classifies gh api failures containing http 404 as not-found. A test verifies the failure kind and confirms that the error message excludes provider stderr.

      Changes

      GitHub API 404 classification

      Layer / File(s)Summary
      Classify HTTP 404 responses
      apps/server/src/vcs/VcsProcess.ts, apps/server/src/vcs/VcsProcess.test.ts
      The gh not-found classification now matches http 404. The test checks the VcsProcessExitError failure kind and confirms its message excludes provider stderr.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~8 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: saphid

      Merge Risk: ⚪ Minimal · up to 62f1f

      The change allows PR status synchronization on hosts without the stacks endpoint while preserving ordinary PR-read failure handling. No actionable merge-blocking risk remains after normal checks.

      Security Architecture Review

      Security architecture risk: 🔵 Low · up to 62f1f

      This restores synchronization on hosts without stack support. No permission bypass or new data exposure was demonstrated, but a 404 is accepted as a final no-stack answer without establishing every possible cause.

      Retained concerns No architecture-level concerns identified.

      Security review details

      Security Blast Radius

      • observed — The inspected synchronization path derives one project, host, repository, and PR reference for both reads. Its resulting commands persist linked-PR status and sibling links; this path does not issue a merge, deployment, credential change, or execution command.

      Trust Boundaries and Controls

      • observed — Summary and stack reads use canonical project routing, and both cache wrappers include the routing credential fingerprint when available. This supplies identity-scoping counterevidence, not proof that the provider grants identical permissions to both endpoints.
      • observed — A held merged summary can be returned even when transient-failure recovery is disabled. Consequently, successful summary retrieval alone does not demonstrate a fresh authorization check before the stack lookup.
      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly describes the primary outcome: linked PR status synchronization now works on hosts without the stacks API.
      Description check✅ PassedThe description includes What Changed, Why, validation results, checklist status, issue linkage, and clarification that no UI changes require screenshots or video.
      Linked Issues check✅ PassedIssue #14458 requires unsupported GitHub Enterprise stacks responses to stop blocking ordinary PR synchronization while preserving authentication, rate-limit, and transient failure handling. `VcsProce…
      Out of Scope Changes check✅ PassedThe pull request changes only VcsProcess.classifyNonZeroExit and its regression test. These changes directly support issue #14458 by enabling the existing missing-stack fallback. No unrelated produc…
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Autopilot is currently an internal CodeRabbit preview.


      Comment `@coderabbitai help` to get the list of available commands.
    3. juliusmarminge added labelsmacroscope-review

    4. Approvability

      Verdict: Approved at 62f1fd7

      Macroscope's review found this PR approvable — This is a small, focused server bug fix that maps unsupported gh stack endpoints to the existing “not stacked” fallback, with a targeted regression test. It does not alter defaults, schemas, deployment behavior, or static-analysis settings.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Note

      Written by claude-opus-5-5 on behalf of Maria

      Thanks for this. I'm closing it as part of PR triage. This is already fixed on main.

      From the review: Stack reads on main already classify HTTP 404 responses directly and return no stack, allowing linked pull request status to sync on hosts without the stacks API.

      If you think this was a mistake, message me on Twitter at @maria_rcks and I'll take another look.

    6. maria-rcks closed this

Sign in to join this conversation.