Repository navigation
feat(github): Patch pull request merge state in delayed plugin tasks - #4208
Merged
Merged
Conversation
After a page's card queries ran out of time, a shared 30 s cache marker made every read of those pull requests skip GitHub. An Attach of an uncached pull request in that window then returned "Object not found". `prefetch` can now return an outcome per URL, and core passes it to that URL's `canView` and `resolve` on the same page as `ctx.prefetchOutcome`. The GitHub plugin returns `out_of_time` for the pull requests that the page ran out of time for, and only those reads show the cached entry. An Attach and other single reads get no outcome, so they ask GitHub. The shared marker is gone. Co-Authored-By: BYK <[email protected]>
A failed patch query split in halves down to one pull request each, inside one heartbeat and with no time limit. During a GitHub outage that is a tree of queries before the daily reconcile runs. A failed patch query now waits for the next heartbeat as a whole, so an outage costs one query per chunk of 25. Only the page card read still splits, inside its 20 s budget, so `loadInHalves` moves next to it. Co-Authored-By: BYK <[email protected]>
When the patch read a head commit other than the cached one, it skipped the write and counted as done. Its pending merge state and checks then stayed fresh for the full hour. That patch is now dropped like one that finds no pull request: its pending fields stay fresh for 15 s, so the next card read asks GitHub. Co-Authored-By: BYK <[email protected]>
The snooze picker read a found pull request's draft state from its live card as soon as the row showed. Before the card arrived it said "not a draft", so a fast pick watched an open draft as a ready pull request. An open pull request row in the picker now waits for its card, as the `#` menu does. Co-Authored-By: BYK <[email protected]>
The live card now replaces a saved object's row, and it came with the Attach slot. A saved object is already part of the Conversation, so the slot only showed "Attached", or took up space empty for a viewer who is not a participant, and moved the row's state chip. A saved object's row now has no Attach slot, as before the live card. Co-Authored-By: BYK <[email protected]>
The row of a saved object has no Attach slot, but a link that an Attach saved has only its link. On `main` its row showed the live card with its "Attached" chip, and it does again. Known objects again say which saved links are only links. The attach journeys move from the object link spec to their own spec, so each stays under the file length limit. Co-Authored-By: BYK <[email protected]>
Webhooks start one patchPullRequest task per pull request, head commit and 5 s window, with a 5 s start delay. While GitHub still computes the merge state, the task throws and the queue retries it. On the last delivery, the task keeps merge state pending for 15 s, as the heartbeat patch did. The patch list, its lock and its heartbeat drain go away. Core adds delaySeconds to tasks.start and lastDelivery to the started task context. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Checks belong to the head commit. A base retarget, or a same-head webhook with mergeable null while the merge state is unknown, now marks only the merge state pending and patches it. Known check counts stay. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior/tests/integration/api/github-object-refresh.test.ts
Webhooks now start patch tasks, so the test needs the task queue adapter. It also checks which pull requests get a patch.
BYK
approved these changes
Nov 24, 2026
A page that linked one pull request twice, such as /pull/12 and /pull/12#discussion_r1, gave out_of_time to the last link only. The other link then asked GitHub after the page's budget ran out. Co-Authored-By: BYK <[email protected]>
Co-Authored-By: BYK <[email protected]> # Conflicts: # packages/junior-github/src/issue-links.ts # packages/junior-github/src/pull-request-patches.ts # packages/junior/tests/integration/api/github-object-refresh.test.ts # packages/junior/tests/integration/api/github-page-budget.test.ts
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e9c6678. Configure here.
…quest once its card arrives Open pull request rows wait for their cards, so the picker first highlighted the top row that does not wait, often a merged one, and kept it there. Enter then picked that row instead of the top result. The highlight now follows the first row that can be picked, unless the viewer moved it by key or pointer. Co-Authored-By: BYK <[email protected]>
A patch task for an older head kept reading and writing the shared pull request entry after a push. When its read failed or answered another head, it cut the new head's pending fields to 15 s. A delivery whose head is no longer the cached head now returns without reading GitHub, writing, or expiring. The new push's task owns the entry. Co-Authored-By: BYK <[email protected]>
23 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Follows up merged #4204.
GitHub computes a pull request's merge state shortly after a push, and check events carry no counts, so a webhook marks both
pendingand a patch reads them later. Until now the patch waited in a plugin-state list that the heartbeat drained about once a minute. This moves each patch to a delayed plugin task, so it runs about 5 s after its event instead of at the next heartbeat.Core
ctx.tasks.starttakesdelaySeconds, which goes to the queue send. The queue holds the first delivery for that long.PluginStartedTaskContextgetslastDelivery. Core sets it from the queue delivery count, so a plugin can write a fallback on the last try without knowing the maximum.createApp({ pluginTaskQueue })passes the send options and the delivery count through, so an in-process queue can honor them.extend/build-a-plugin.md.GitHub
pull_request,check_suite, andcheck_runwebhooks startpatchPullRequestwith key<cache key>:<head SHA>:<floor(eventMs / 5000)>anddelaySeconds: 5. Events for one head in one 5 s window share a task. A later event starts a new task with its own retries. The payload carries the cache key (pulls:owner/repo#N) and the head SHA.mergeable, or a webhook came after the read, it throwsGitHubPullRequestPatchPendingErrorand the queue retries it with core's 30/60/120/240 s backoff.UNKNOWNmerge state is written as pending with the 15 s TTL, as the heartbeat's last attempt did. A pull request missing from the answer, a read of another head, or a query that fails on the last delivery also leaves the pending fields fresh for only 15 s.pull-request-patcheslist, its lock, and its heartbeat drain are gone. An old list in plugin state expires on its own TTL.Max wait and failed deliveries
plugin.taskspan is marked as an error witherror.type(GitHubPullRequestPatchPendingErrorfor a merge state that is still computing) andapp.plugin.task.attempt.UNKNOWNdoes not throw. A last delivery whose query fails throws, and core logsplugin.task.failed.Also in this PR
/pull/12and/pull/12#discussion_r1, givesout_of_timeto every link, so none of them asks GitHub after the page's budget ran out.via @BYK.
--
View Session [Sentry]