Skip to content

perf(server): PR watch folds no longer read every run of the thread - #51

Merged
Andrey170170 merged 1 commit into
dev_vmfrom
perf/pr-watch-fold-reads
Nov 13, 2026
Merged

Andrey170170 merged 1 commit into
dev_vmfrom
perf/pr-watch-fold-reads

Conversation

@Andrey170170

Copy link
Copy Markdown
Owner

Summary

The fork's PR watch fold loaded every run of a thread to find one queued wake, once in the reactor's fold check and again when the orchestrator rewrote the wake. Long threads paid for their whole run history on each watch pass with news, which upstream has been removing from its own hot paths (pingdotgg#29521, pingdotgg#36100, pingdotgg#36130). Both reads are now narrow; behavior is unchanged.

 PullRequestWatchReactor.queuedWakeOf
-  getThreadRecords(thread, ["runs"])                      # every run
+  getThreadRecords(thread, ["runs"], { runStatuses: ["queued"] })

 Orchestrator pull-request-watch.sync (wake present)
-  getThreadRecords(thread, ["runs"]).find(userMessageId)  # every run
-  getRunMessage(thread, run.id)
+  getMessagesById(thread, [wake.messageId])               # indexed
+  getRun(thread, message.runId)                           # only if the message exists

Evidence

  • Typecheck of apps/server is clean.
  • runtimeLayer.test.ts, PullRequestSyncReactor.test.ts and Orchestrator.control-reads.test.ts pass (257 tests), including both fold cases: news folds into a queued wake and is told again once the agent is past it, and one PR's fold is sent alone while another PR's news queues its own wake.

Merge Danger

Door: two-way

Blast Radius: PR-watch wakes

A wrong lookup would show up as a second wake instead of a folded one, or a rejected sync. Reverting restores the old reads.

🤖 Generated with Claude Code

The reactor's fold check and the orchestrator's queued-wake rewrite each
loaded all of a thread's runs to find one wake. The reactor now reads only
queued runs, and the orchestrator finds the wake by its message ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T16:41:21.582343Z 0f23473 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates queued pull request wake lookup and dispatch. The reactor filters for queued runs. The orchestrator resolves the wake’s message and run by ID, maps projection errors, and reuses the fetched message when updating the wake.

Changes: Queued pull request wake flow

Layer / File(s) Summary
Queued wake lookup and dispatch
apps/server/src/orchestration-v2/PullRequestWatchReactor.ts, apps/server/src/orchestration-v2/Orchestrator.ts
The reactor queries queued runs and checks for the wake’s message ID. The orchestrator loads the message by ID and its run by runId, maps projection errors, and reuses the fetched message when updating the queued wake.

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

Suggested reviewers: juliusmarminge, t3dotgg, yash-singh1

Merge Risk: Minimal · up to 0f234

This change reduces how much data is read when folding pull request watch news into a queued wake, and behavior is reported as unchanged. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: PR watch folds no longer read every run of a thread. It follows the conventional commit form and matches the objectives and the raw summary (queued-run reads and mess…
Description check Passed The description follows the template. It has a Summary that explains the problem and the change, a diff, Evidence with typecheck and test results, and a Merge Danger section. It does not use the templ…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: PR watch folds no longer read every run of a thread. It follows the conventional commit form and matches the objectives and the raw summary (queued-run reads and message lookup in the orchestrator and reactor).

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the problem and the change, a diff, Evidence with typecheck and test results, and a Merge Danger section. It does not use the template's Problem, Change, Scope, and Verification headings. Scope is not addressed: there is no linked issue for the bug, and the description cites upstream PRs instead. It also does not state the model and harness used, though it names Claude Code. The description is mostly complete, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 497e071 and 0f23473.

Files selected for processing: 2

  • apps/server/src/orchestration-v2/Orchestrator.ts
  • apps/server/src/orchestration-v2/PullRequestWatchReactor.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

@Andrey170170
Andrey170170 merged commit 86aa981 into dev_vm Nov 13, 2026
1 check passed
@Andrey170170
Andrey170170 deleted the perf/pr-watch-fold-reads branch November 13, 2026 16:44
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