Skip to content

Preserve concurrent PR comment changes when thread resolution fails - #35315

Merged
OrcaWin merged 4 commits into
mainfrom
OrcaWin/fix-pr-thread-rollback
Oct 29, 2026
Merged

OrcaWin merged 4 commits into
mainfrom
OrcaWin/fix-pr-thread-rollback

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​88 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​87
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​74 $\color{#cf222e}{\Huge{\mathbf{−}}}$​39 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​35

ELI5

A failed Resolve or Unresolve action could erase a reply that had already posted successfully or leave it styled differently from the rest of its thread. Restore the thread’s resolved state while keeping the current conversation.

What Changed

resolveReviewThread captures only comments in the thread it changes. If the request fails, existing captured IDs recover their own previous isResolved values. New current members of that thread inherit its first known captured resolved state, including replies whose REST payload omits isResolved. Current content, reactions, ordering, changes to other threads, and list membership stay intact. Removed rows are not reinserted, and a cleared cache entry stays absent.

The existing Checks panel thread-resolution functions now live in lib/pr-comment-thread-resolution.ts, so the store and panel use one implementation. The shared restore function preserves other comment fields for panel rollbacks too.

Why

Both the Checks panel’s manual Resolve action and AI acknowledgement path call the GitHub store action. That action previously captured the entire PR comment array, optimistically toggled one thread, and replaced the cache with the entire old array on a false result or transport error. A successful reply, reaction, or other-thread resolution completed during that wait was discarded locally. A cleared entry could also be recreated with the obsolete snapshot.

Deterministic production-store reproduction: start a deferred thread resolution, post a reply successfully, then fail the resolution. Before this change the cache shrinks from two comments to one. The target origin/main source still has the whole-array rollback, and targeted open-PR searches found no duplicate.

Linked Issue

Found during the authorized UX and state correctness audit; no existing issue.

Visual Proof

Pending. No component markup, layout, styling, or new interaction is introduced. Deferred API responses provide deterministic data-ordering evidence. Rendered Electron validation has not run for this draft.

Testing

  • Before implementation: 6/6 regression cases failed through the production store on baseline 66e2d398278.
  • Final correction: 5 focused files / 38 tests passed, including the shared helper, rollback suite, thread actions, PR comments, and snapshotted resolver. Root-coordinated pnpm tc:web passed.
  • Regressions cover false and thrown failures after a successful reply, same-comment reactions, other-thread resolution, cache clearing, and an explicit paired source with local-cache isolation.
  • The shared-helper tests verify preservation of edited fields, reactions, current membership, per-ID missing resolution values, new same-thread members, and server-removed rows. Resolved-thread Unresolve failures are covered for false and thrown results with a REST reply lacking isResolved; paired-source coverage verifies local-cache isolation.
  • Changed-file lint, formatting, and git diff --check passed.
  • Tests ran on Linux with ORCA_BACKGROUND_LAUNCH=1 and a disk-backed temporary directory.
  • The full affected gate remains pending and has not been represented as passed.

Review

The action keeps the same source-scoped cache keys and local/runtime RPC contracts. The shared restore maps over the current list, so it never inserts captured comments or rewinds fields unrelated to resolution.

Same-thread overlapping resolve/unresolve ordering remains outside this PR. A separate confirmed case exists in the default triage panel: regrouping remounts the control, allowing a second operation while the first is pending; two failures can restore a speculative snapshot. A separate shared pending-operation fix is being prepared. This draft does not claim that case is fixed, and its full affected aggregate remains pending.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source or artifacts changed.

Notes

No platform-specific behavior, native process changes, or new remote protocol is introduced. The same renderer action serves local and paired sources; paired-source failure isolation is covered. GitLab’s panel rollback also uses the shared field-scoped restore, while its host request path is unchanged. No folder/worktree assumption is introduced. Mobile has no caller of this renderer-only action.

Checklist

  • Focused fix with deterministic failing-before production-store evidence
  • Automated regressions and focused lint/format validation
  • Existing logic reused between panel and store
  • Full affected gate completed
  • Rendered Electron validation completed

Drop duplicate false/throw variants, the cleared-cache and paired-source
cases, and the helper case already covered by the remaining lib tests.
@OrcaWin
OrcaWin marked this pull request as ready for review October 29, 2026 00:55
@OrcaWin
OrcaWin merged commit 601bf63 into main Oct 29, 2026
29 checks passed
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Failed thread updates now restore only isResolved while keeping the current comments.

  • Failed thread resolutions keep newer comments in the list.

No actionable issues were found. Tests were reviewed, not run.

OrcaWin explicitly deferred overlapping operations on the same thread to a separate fix. OrcaWin also disclosed that the full affected gate and rendered Electron checks remain pending.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Capture target thread] --> B[Set requested resolved state]
  B --> C[Wait for host response]
  C -->|Success| D[Keep current comments]
  C -->|Failure| E{Cache data still exists?}
  E -->|No| F[Leave entry absent]
  E -->|Yes| G[Restore resolution fields in current list]
  G --> H[Keep replies, edits, reactions, and membership]
Loading

Reviews (1) · Last reviewed commit: "test(github): trim thread rollback tests..." · Reviewed by Greptile

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