@devries-cameron20 / composio Mirror · read-only / commits / e20332221
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 06:00 UTC

fix(release): tag merged release PRs under GitHub API 2026-03-10 (#5274)

This PR: - fixes the tag gate, which recorded the first merged release PR (https://github.com/ComposioHQ/composio/pull/5261) as `Abandoned` and created no tag - API version `2026-03-10` no longer returns `merge_commit_sha` on pull responses, so the gate read every merged PR as unmerged - `mergeCommitOf()` now reads the merge commit from the PR's `merged` issue event - replaces the release-head committer check, which no real release could pass: GitHub commits and signs every API-made commit as `web-flow`, never as the App - `isReleaseAppCommit()` now requires the App to be the last actor that set the release branch to the reviewed head, from the repository activity log. A writer can make a signed `web-flow` commit naming the App as author, but can't forge that log - updates the controller fixtures to the response shapes GitHub returns today (no `merge_commit_sha`, `web-flow` committer, activity and issue-event routes) ## Context Verified against live data: the fixed gate passes #5261 (App commit, olearycrew's approval, all candidate checks green, merge commit `7beddc0`), and `candidates.ts approve` pins both the npm and PyPI candidates of that release. The tag job runs `next` as it was before the merge, so #5261 itself can't be re-gated. It has to be reverted and requested again once this lands.

Alberto Schiabel committed Nov 9, 2026 at 12:59 UTC e203322213ea9adf59790c14a17ce20e4c52e282
7 files changed +66 -26
scripts/sdk-release/approval.ts
+39 -11
@@ -60,7 +60,6 @@ const CheckRuns = Schema.Struct({
60 });
61 const HeadCommit = Schema.Struct({
62 author: Schema.NullOr(Schema.Struct({ login: Schema.String })),
63 - committer: Schema.NullOr(Schema.Struct({ login: Schema.String })),
63 commit: Schema.Struct({ verification: Schema.Struct({ verified: Schema.Boolean }) }),
64 parents: Schema.Array(Schema.Struct({ sha: Sha })),
65 });
@@ -115,23 +114,52 @@ export const readReleasePull = (number: number) =>
114 return { pull, batch };
115 });
116
117 +const ZERO_SHA = '0'.repeat(40);
118 +const BranchActivity = Schema.Struct({
119 + after: Sha,
120 + actor: Schema.NullOr(Schema.Struct({ login: Schema.String })),
121 +});
122 +
123 /**
119 - * Whether the release PR head is the release App's own verified commit on the planned source. A
120 - * person can sign a commit that names the bot as author, but not one it committed.
124 + * Whether `sha` is the release App's own verified commit on the planned source, and the App set
125 + * the release branch to it last. GitHub commits and signs every API-made commit as `web-flow`,
126 + * and any writer can make one that names the App as author, so only the branch's activity log,
127 + * newest first, shows who moved it.
128 */
122 -export const isReleaseAppCommit = (sha: string, inputBase: string, appSlug: string) =>
123 - Effect.map(
124 - request('GET', `${REPOSITORY_PATH}/commits/${sha}`, HeadCommit),
125 - head =>
129 +export const isReleaseAppCommit = (sha: string, batch: ReleaseBatch, appSlug: string) =>
130 + Effect.gen(function* () {
131 + const head = yield* request('GET', `${REPOSITORY_PATH}/commits/${sha}`, HeadCommit);
132 + const activity = yield* request(
133 + 'GET',
134 + `${REPOSITORY_PATH}/activity?ref=${encodeURIComponent(`refs/heads/${releaseBranch(batch.id)}`)}&direction=desc&per_page=100`,
135 + Schema.Array(BranchActivity)
136 + );
137 + const lastSet = activity.find(entry => entry.after !== ZERO_SHA);
138 + return (
139 head.author?.login === `${appSlug}[bot]` &&
127 - head.committer?.login === `${appSlug}[bot]` &&
140 head.commit.verification.verified &&
141 head.parents.length === 1 &&
130 - head.parents[0].sha === inputBase
131 - );
142 + head.parents[0].sha === batch.inputBase &&
143 + lastSet?.after === sha &&
144 + lastSet.actor?.login === `${appSlug}[bot]`
145 + );
146 + });
147
148 export const isReleaseAppHead = (pull: Pull, batch: ReleaseBatch, appSlug: string) =>
134 - isReleaseAppCommit(pull.head.sha, batch.inputBase, appSlug);
149 + isReleaseAppCommit(pull.head.sha, batch, appSlug);
150 +
151 +const IssueEvent = Schema.Struct({ event: Schema.String, commit_id: Schema.NullOr(Sha) });
152 +
153 +/** The commit a merged PR left on its base. Pull responses no longer carry `merge_commit_sha`. */
154 +export const mergeCommitOf = (number: number) =>
155 + Effect.gen(function* () {
156 + const events = yield* Stream.runCollect(
157 + paginateArray(`${REPOSITORY_PATH}/issues/${number}/events`, IssueEvent)
158 + );
159 + const sha = events.findLast(event => event.event === 'merged')?.commit_id;
160 + if (!sha) return yield* fail('The merged release PR has no merge commit');
161 + return sha;
162 + });
163
164 /**
165 * The request issue named by a release PR's plan, only when the release App committed that plan.
scripts/sdk-release/batch.ts
+3 -4
@@ -1,6 +1,6 @@
1 import { Config, Effect, Option, Path, Schema, Stdio, Stream } from 'effect';
2 import { Base64 } from 'effect/encoding';
3 -import { readReleasePull, trustedIssue, verifyReleaseGate } from './approval';
3 +import { mergeCommitOf, readReleasePull, trustedIssue, verifyReleaseGate } from './approval';
4 import {
5 CONTENT_CONCURRENCY,
6 CreatedSha,
@@ -293,8 +293,7 @@ export const openReleasePull = (cwd: string, planned: ReleaseBatch, value: unkno
293 */
294 export const authorizeSourceTag = (pull: Pull, batch: ReleaseBatch, appSlug: string) =>
295 Effect.gen(function* () {
296 - if (!pull.merged || !pull.merge_commit_sha)
297 - return ReleaseState.make({ _tag: 'Abandoned', pull: pull.html_url });
296 + if (!pull.merged) return ReleaseState.make({ _tag: 'Abandoned', pull: pull.html_url });
297 const verdict = yield* verifyReleaseGate(pull, batch, appSlug).pipe(
298 Effect.as(Option.none<string>()),
299 Effect.catchTag('ReleaseError', error => Effect.succeedSome(error.message))
@@ -308,7 +307,7 @@ export const authorizeSourceTag = (pull: Pull, batch: ReleaseBatch, appSlug: str
307 }
308 const merged = yield* request(
309 'GET',
311 - `${REPOSITORY_PATH}/git/commits/${pull.merge_commit_sha}`,
310 + `${REPOSITORY_PATH}/git/commits/${yield* mergeCommitOf(pull.number)}`,
311 Commit
312 );
313 yield* ensure(
scripts/sdk-release/candidates.ts
+1 -1
@@ -395,7 +395,7 @@ const approveMode = Effect.gen(function* () {
395 // Written first, so the publish status still reaches the request issue if adoption fails. Only
396 // a plan the release App committed may name that issue: the tag ruleset should stop anyone
397 // else from pushing a release tag, and this keeps a forged one from steering the bot.
398 - const trusted = yield* isReleaseAppCommit(env.sha, batch.inputBase, env.appSlug).pipe(
398 + const trusted = yield* isReleaseAppCommit(env.sha, batch, env.appSlug).pipe(
399 Effect.provide(GitHub.layer(env.token))
400 );
401 if (trusted) yield* appendFile(env.outputPath, `issue=${batch.issue}\n`);
scripts/sdk-release/release-pr.ts
-1
@@ -13,7 +13,6 @@ export const Pull = Schema.Struct({
13 html_url: Schema.String,
14 state: Schema.String,
15 merged: Schema.optionalKey(Schema.Boolean),
16 - merge_commit_sha: Schema.optionalKey(Schema.NullOr(Sha)),
16 /** `null` when the author's account was deleted. */
17 user: Schema.NullOr(Schema.Struct({ login: Schema.String })),
18 head: Schema.Struct({
test/sdk-release-approval.test.ts
+3 -3
@@ -102,7 +102,7 @@ describe('source tag', () => {
102 };
103 expect(await issueOf({})).toEqual(Option.some(8));
104 expect(await issueOf({ closedUnmerged: true, headAuthor: 'writer' })).toEqual(Option.none());
105 - expect(await issueOf({ headCommitter: 'writer' })).toEqual(Option.none());
105 + expect(await issueOf({ branchSetter: 'writer' })).toEqual(Option.none());
106 });
107
108 test('a beta is tagged without the docs check, which never runs on a plan-only PR', async () => {
@@ -122,8 +122,8 @@ describe('source tag', () => {
122 ['the approval is for an older head', { oldReview: true }, 'lacks an approval'],
123 ['a human pushed the head', { headAuthor: 'writer' }, 'release App commit'],
124 [
125 - 'a human committed a head that names the App as author',
126 - { headCommitter: 'writer' },
125 + 'a human set the branch to a head that names the App as author',
126 + { branchSetter: 'writer' },
127 'release App commit',
128 ],
129 ['the head commit is unverified', { unverifiedHead: true }, 'release App commit'],
test/sdk-release-candidate-pin.test.ts
+2 -1
@@ -54,10 +54,11 @@ const pinAttempt = async (
54 const routes = {
55 [`/commits/${head}`]: {
56 author: { login: options.headAuthor ?? app },
57 - committer: { login: options.headAuthor ?? app },
57 + committer: { login: 'web-flow' },
58 commit: { verification: { verified: true } },
59 parents: [{ sha: batch.inputBase }],
60 },
61 + '/activity': [{ after: head, actor: { login: app } }],
62 '/actions/workflows/sdk.release.candidates.yml/runs': {
63 workflow_runs: [
64 {
test/sdk-release-controller-fixture.ts
+18 -5
@@ -82,8 +82,8 @@ export interface ControllerOptions {
82 readonly docs?: 'success' | 'failure' | 'pending' | 'missing';
83 /** Who authored the release PR head; the release App by default. */
84 readonly headAuthor?: string;
85 - /** Who committed the release PR head; the release App by default. */
86 - readonly headCommitter?: string;
85 + /** Who last moved the release branch; the release App by default. */
86 + readonly branchSetter?: string;
87 readonly unverifiedHead?: boolean;
88 /** Parent of the release PR head; the planned source by default. */
89 readonly headParent?: string;
@@ -98,7 +98,6 @@ export function fakeController(options: ControllerOptions = {}) {
98 html_url: 'https://github.com/ComposioHQ/composio/pull/9',
99 state: 'closed',
100 merged,
101 - merge_commit_sha: merged ? merge : null,
101 user: { login: `${APP_SLUG}[bot]` },
102 head: { sha: head, ref: 'sdk-release/batch-8', repo: { full_name: 'ComposioHQ/composio' } },
103 base: { ref: 'next' },
@@ -134,7 +133,6 @@ export function fakeController(options: ControllerOptions = {}) {
133 html_url: 'https://github.com/ComposioHQ/composio/pull/5',
134 state: 'open',
135 merged: false,
137 - merge_commit_sha: null,
136 head: { ...pull().head, ref: options.openRelease },
137 },
138 ]
@@ -170,10 +168,25 @@ export function fakeController(options: ControllerOptions = {}) {
168 if (path === `/commits/${head}`)
169 return response({
170 author: { login: options.headAuthor ?? `${APP_SLUG}[bot]` },
173 - committer: { login: options.headCommitter ?? `${APP_SLUG}[bot]` },
171 + // GitHub commits and signs every commit made through its API.
172 + committer: { login: 'web-flow' },
173 commit: { verification: { verified: !options.unverifiedHead } },
174 parents: [{ sha: options.headParent ?? base }],
175 });
176 + if (path.startsWith('/activity?ref=refs%2Fheads%2Fsdk-release%2Fbatch-8&'))
177 + return response([
178 + { after: '0'.repeat(40), actor: { login: 'merger' } },
179 + { after: head, actor: { login: options.branchSetter ?? `${APP_SLUG}[bot]` } },
180 + ]);
181 + if (path.startsWith('/issues/9/events?'))
182 + return response(
183 + merged
184 + ? [
185 + { event: 'merged', commit_id: merge },
186 + { event: 'closed', commit_id: null },
187 + ]
188 + : [{ event: 'closed', commit_id: null }]
189 + );
190 if (path === `/git/commits/${base}`)
191 return response({ sha: base, tree: { sha: base }, parents: [] });
192 if (path === `/git/commits/${merge}`)