Skip to content

Release SDK updates - #141

Open
kernel-internal[bot] wants to merge 2 commits into
mainfrom
stainless/release
Open

Release SDK updates#141
kernel-internal[bot] wants to merge 2 commits into
mainfrom
stainless/release

Conversation

@kernel-internal

@kernel-internal kernel-internal Bot commented Aug 4, 2026

Copy link
Copy Markdown

710780c ci: promote through merge-commit pull requests
bf366f0 ci: add stlc promotion workflows


Note

Medium Risk
Workflows can force-push release branches and auto-merge into production using elevated GitHub App permissions; misconfiguration or ancestry drift could block or incorrectly sync repos.

Overview
Adds two GitHub Actions workflows that wire kernel-python-sdk-staging to production kernel-python-sdk using merge-commit PRs (not squash/rebase) so both repos stay on one ancestry chain.

Promote SDKs (stlc-promote.yml) runs on staging main pushes: mints a GitHub App token for the production repo, skips work when production’s tree already matches staging, otherwise force-pushes staging main to production stainless/release, opens a “Release SDK updates” PR if needed, and enables auto-merge with a merge commit.

Sync SDK repos (stlc-sync.yml) adds a back-sync job (cron, manual, or prod-released dispatch) that fast-forwards staging main from production when staging is behind, with a guard that fails if staging is not an ancestor of production. Production release events can dispatch prod-released to staging (optional STAGING_DISPATCH_TOKEN). Staging pushes to non-generated commits can dispatch seal-custom-code to kernel/kernel (optional CONFIG_DISPATCH_TOKEN).

Reviewed by Cursor Bugbot for commit 710780c. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 5 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 710780c. Configure here.

- name: Fetch production main
run: |
git remote add production "https://github.com/kernel/kernel-python-sdk.git"
git -c "http.https://github.com/.extraheader=" fetch production main

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back-sync lacks production auth

Medium Severity

The back-sync job fetches production/main over anonymous HTTPS after stripping checkout credentials, while promote uses a GitHub App token for the same production repo. If kernel/kernel-python-sdk is private, git fetch production main fails and back-sync never runs, leaving staging out of date despite a working promote path.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 710780c. Configure here.

exit 0
fi
payload=$(jq -n --arg sha "$SHA" --arg repo "${{ github.repository }}" '{event_type:"seal-custom-code",client_payload:{target:"all",sha:$sha,repo:$repo}}')
curl --fail-with-body -sS -X POST -H "Authorization: Bearer $DISPATCH_TOKEN" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/kernel/kernel/dispatches" -d "$payload"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back-sync triggers seal dispatch

Medium Severity

The seal-dispatch job runs on every staging push to main and only skips commits whose message contains Stainless-Generated-From or whose author is stlc-bot. When back-sync fast-forwards staging main to production/main, that push still fires seal-dispatch and can emit seal-custom-code for production merge commits, mislabeling automated back-sync as custom staging code.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 710780c. Configure here.

run: |
existing=$(gh pr list --repo "$PRODUCTION_REPO" --head stainless/release --state open --json number --jq '.[0].number')
if [ -z "$existing" ]; then
gh pr create --repo "$PRODUCTION_REPO" --base main --head stainless/release --title "Release SDK updates" --body "$(git log --oneline production/main..origin/main)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR body breaks shell quoting

Low Severity

The promote step builds gh pr create --body via unescaped $(git log --oneline production/main..origin/main) inside double quotes. Commit subjects containing double quotes, backticks, or $ can terminate or alter the shell word and cause gh pr create to fail or pass a truncated body, leaving no open promote PR while later merge steps still run.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 710780c. Configure here.

if [ -z "$existing" ]; then
gh pr create --repo "$PRODUCTION_REPO" --base main --head stainless/release --title "Release SDK updates" --body "$(git log --oneline production/main..origin/main)"
fi
gh pr merge stainless/release --repo "$PRODUCTION_REPO" --merge --auto || echo "Auto-merge unavailable; merge the promote PR manually with a merge commit."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-merge failures report success

High Severity

The promote job runs gh pr merge with --auto but appends || echo, so a non-zero exit from the CLI (auto-merge disabled, branch protection, failing required checks, merge conflicts, or insufficient app permissions) still leaves the workflow step and job green. Staging can remain unpromoted to production while automation looks healthy.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 710780c. Configure here.

existing=$(gh pr list --repo "$PRODUCTION_REPO" --head stainless/release --state open --json number --jq '.[0].number')
if [ -z "$existing" ]; then
gh pr create --repo "$PRODUCTION_REPO" --base main --head stainless/release --title "Release SDK updates" --body "$(git log --oneline production/main..origin/main)"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing promote PR never updated

Low Severity

The step is named “Open or update the promote PR”, but when an open PR from stainless/release already exists the script skips gh pr create and never refreshes title or body. Later staging pushes still force-update the head branch, so the open PR can list an outdated git log while containing newer commits.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 710780c. Configure here.

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