Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(pull-requests): shared state + not settling? #9332

Mergedmaria-rcksmerged 11 commits intomain fromrefs/pull/9332/headmerged by maria-rcks View on GitHub

maria-rckscommented

Note

Written by gpt-5.6-sol on behalf of Maria

Threads could wait behind the one-minute settlement sweep and two-minute pull request cache, while transient host failures could hide a merged state already observed by the app. This sends successful in-app merges directly to settlement and safely reuses only immutable merged observations. The PR panel and both sidebar implementations now share the newest per-PR state, so a merge reaches every visible surface before paint without a second request. When that branch later exposes a different open pull request, the terminal thread link is replaced and the open panel follows it immediately. Verified with 110 focused server tests, 34 directly affected web tests, server and web typechecks, and repository-pinned formatting and lint; implemented by gpt-5.6-sol in the Codex harness.

relinked thread, view pr controls, sidebar, and pull request panel all target #9332


Note

Medium Risk Changes auto-settlement timing, PR summary caching semantics, and cross-view client state; bounded merge-event PubSub can drop events under load, and merged observations are sticky for up to five minutes on the client.

Overview Merges performed in-app now trigger thread settlement right away instead of waiting on the periodic sweep. PullRequestService emits merge events after a successful merge action, and ThreadSettlementReactor listens and runs a sweep scoped to threads linked to that PR—treating the event as merged state without another host lookup.

Strict settlement reads (recoverTransientFailure: false) can return a previously observed merged summary from cache instead of refreshing from the provider, so transient API failures do not undo a merge the app already knows about.

On the web, per-PR observed summaries are stored and merged across the PR panel and sidebar via useSharedPullRequestSummary, with rules that favor merged state and newer updatedAt so UI surfaces agree after a merge. threadPullRequestRefreshSource and linked-detail refresh from the panel are removed in favor of this shared state and simpler VCS refresh when the thread PR is inferred, not persisted.

Chat can relink a thread from a merged/closed linked PR to a different open PR on the same branch (persisted metadata + open panel), and skips panel onStateChange callbacks when a linked PR is already authoritative.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 62fe971a538d4d3fc636a50d223c9b033d7721de. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add shared pull-request state and merge-triggered settlement sweeps

  • PullRequestService publishes successful merge events to a bounded PubSub channel and strict summary reads reuse an already-observed merged result instead of refreshing the provider
  • ThreadSettlementReactor subscribes to merge events and runs a targeted sweep that settles only the matching linked thread using the event timestamp, bypassing the periodic schedule and summary lookups
  • Web client introduces observedPullRequestSummaryAtom, newestPullRequestSummary, and useSharedPullRequestSummary so linked-thread status and the detail panel reflect the newest or merged-precedent summary across components
  • ChatView can display and persist a different open pull request on the same branch when the persisted link is merged or closed, with serialized metadata writes per thread
  • Removes the threadPullRequestRefreshSource utility and narrows PullRequestDetailPanel.onStateChange to { repository, number, state }
  • Risk: PullRequestDetailPanel.onStateChange payload drops project and draft fields — any out-of-tree consumer expecting those fields will break; merge-event PubSub has capacity 64 so bursts beyond that drop events and fall back to the periodic sweep
Macroscope summarized 62fe971.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. apps/server/src/pullRequest/PullRequestService.ts line 2423OutdatedResolvedby maria-rcks
      apps/web/src/components/Sidebar.tsx line 846OutdatedResolvedby maria-rcks
    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The change spans server settlement orchestration and multiple client state surfaces, adding automatic merge-triggered settlement and persisted pull-request relinking. These cross-component runtime and user-visible behavior changes have a broader blast radius than an auto-approvable bug fix or bounded option.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. apps/web/src/components/ChatView.logic.ts line 123OutdatedResolvedby maria-rcks
    5. apps/web/src/components/ChatView.tsx line 3750OutdatedResolvedby maria-rcks
    6. maria-rcks changed the title

    7. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 191053552df17c3e0685746616f87f7eea96644d. Configure [here](https://www.cursor.com/dashboard/bugbot).
      apps/web/src/components/ChatView.tsx line 3758OutdatedResolvedby maria-rcks
    8. maria-rcks merged this854541a

    9. maria-rcks closed this

Sign in to join this conversation.