Repository navigation
Keep the removed environment pull request SDK methods working through the GitHub PR Status plugin - #7205
Merged
ymichael merged 3 commits intoNov 6, 2026
Conversation
… the GitHub PR Status plugin #6125 deleted bb.sdk.environments.pullRequest, markPullRequestReady, markPullRequestDraft and mergePullRequest outright, so published plugins that still call them (genui, linear) throw a TypeError. Retire them the way the Git reads were retired: runtime adapters with the old result shapes that forward to bb--github-pr-status, a build warning naming the replacement RPC call, and an api_to_audit entry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A plugin's bb.sdk replaced plugins.callRpc with the caller-token SDK, but sdk.environments still came from the shared base SDK, so the retired adapters reached bb--github-pr-status as an anonymous client. The plugin answers client reads from its saved row, which for a long-merged PR can still say open while markReady (a fresh read) finds no PR. Build the retired environment members on the caller-token callRpc in wrapSdkForPlugin so pullRequest waits for a fresh row, as the old route and a direct plugin callRpc do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…types Exporting it from environments.ts pulled the plugins-area types into bundled-types, changing @get-bb/plugin-sdk's published surface. Its own module stays outside the type graph the plugin SDK bundles. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/restore-runtime-shims-for-removed-pr-sdk-methods-thr_jjr3pxi44d
branch
from
November 6, 2026 23:33
08688e4 to
0acad6b
Compare
ymichael
deleted the
bb/restore-runtime-shims-for-removed-pr-sdk-methods-thr_jjr3pxi44d
branch
November 6, 2026 23:46
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.
Human comments
What was wrong
#6125 (first shipped in bb 0.47.0) deleted the server plugin SDK methods
bb.sdk.environments.pullRequest,markPullRequestReady,markPullRequestDraftandmergePullRequestoutright, along with core's routes. Every other retirement took the name out of the typings only. The runtime kept working and the build warned with the replacement. Published plugins that still call these four now getTypeError: ... is not a function. Community plugins genui (project/environments.ts,project/source.ts) and linear (server.ts's PR-merged → Done write-back, hidden behind anas nevercast) are broken today, and about 14 marketplace plugins reference the methods.What changed
These four follow the pattern the Git plugin's retired reads use (
retired-environment-reads.ts,retired-sdk-members.ts):packages/sdk/src/areas/retired-environment-pull-requests.ts, mixed intosdk.environmentsnext to the Git read adapters. TheEnvironmentsAreatypings are unchanged. Each one forwards to the bundled GitHub PR Status plugin (bb--github-pr-status) and returns the old shape:pullRequest({ environmentId })callspullRequestswithkeys: [environmentId]and returns that row:availablewithpullRequest,absent, orunavailablewithmessage. The plugin's row schema is the same as the oldThreadPullRequestfield for field. It returnsunavailableif the plugin sends back no row.markPullRequestReady/markPullRequestDraft/mergePullRequestcallmarkReady/markDraft/merge. They return{ ok: true, action: "pull_request_ready" | "pull_request_draft" | "pull_request_merge", message }, and merge also returnsmethod. The messages are the same strings the old route returned.not_foundrefusal becomes 404environment_not_found. Aconflictrefusal becomes 409pull_request_action_failedand keeps the plugin's reason ("Pull request is not a draft", "No pull request found", …), matching the old route's 409s. When the plugin is disabled, the call fails with the RPC error, as the Git read adapters do.apps/server/src/services/plugins/plugin-api.ts). A plugin'sbb.sdkalready sendsplugins.callRpcwith the plugin's caller token.sdk.environments, though, came from the shared base SDK, so the adapters reachedbb--github-pr-statusas an anonymous client. The plugin answers client (app viewer) reads from its saved row and refreshes it in the background. For a PR merged long ago, that saved row can still sayopen, whilemarkReady, which always reads fresh, finds no PR.wrapSdkForPluginnow builds the retired environment members (these four and the Git reads) on the caller-tokencallRpc, viacreateRetiredEnvironmentMembersfrom@bb/sdk(its own module, so the published plugin SDK types are unchanged).pullRequestthen waits for a row fresher than 10 seconds, as the old route and a directcallRpcfrom a plugin do.packages/plugin-build/src/retired-sdk-members.ts. The four names join the sameenvironments.<name>scan (member access, optional chaining, bracket access, destructuring). The warning names the replacement call, e.g.bb.sdk.plugins.callRpc({ pluginId: "bb--github-pr-status", method: "merge", input: { environmentId, method } }), and points at the github-pr-status skill. Builds still never fail.docs/api_to_audit.md, in a new "Retired environment pull request methods" section next to the Git reads entry.No wire, CLI or published SDK surface changes.
check-plugin-sdk-version.mjsreports "Plugin SDK surface unchanged".How you verified
packages/sdk/test/retired-environment-pull-requests.test.tsdrives the real SDK over the HTTP transport. It covers the read's row passthrough and the missing-row case, each action's RPC path, input and old result shape, and the 409 and 404 refusal mappings. Each test fails on main, where the members don't exist.retired-sdk-members.test.tsadds detection of all four names in the forms genui and linear use (includingbb.sdk.environments.pullRequest({ environmentId }) as never, destructuring with an alias, and optional chaining). It also checks the exact merge warning text and thatpullRequestsRPC calls aren't flagged.pullRequeston an environment with an open PR returned{"outcome":"available","pullRequest":{"number":6248,…,"checks":{"state":"passing",…}}}, the shape genui'spullRequestInfoand linear'spr-runnerread.pullRequeston a branch without a PR returned{"outcome":"absent"}.markPullRequestReadyon that environment was refused before any write:409 pull_request_action_failed HTTP 409: No pull request found. That contradicted the read. Observe the owned child exit in the shutdown regression #6248 was merged on Oct 25, and the read was a saved Oct 24 row, served because my harness called with no caller token (an app viewer read). Inside a plugin the same thing happened, becausesdk.environmentsdidn't carry the token. That is fixed in the second commit.bb pull-request show env_p5z4xpvfaknow returnsabsent, matching the action.plugin-sdk.test.tsadds a running-server test. It calls a plugin'sbb.sdk.environments.pullRequestandmarkPullRequestReadyand asserts that both requests carry the plugin'sx-bb-plugin-callertoken. It fails without theplugin-api.tschange. The existing whoami test covers how the token resolves to a plugin caller.mergePullRequeston an unknown environment returned404 environment_not_found.pnpm exec turbo run test typecheck lint --filter=@bb/sdk --filter=@bb/plugin-buildpasses (sdk 137 tests, plugin-build 262).@bb/servertypecheck and lint pass, and the two caller tests inplugin-sdk.test.tspass. Full suites are left to CI.🤖 Generated with Claude Code