Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(deps-bot): allow rebasing (#18065)

Nimara78951237347
diff --git a/.github/workflows/dependabot-security-maintainer.lock.yml b/.github/workflows/dependabot-security-maintainer.lock.yml
index ecc1b7891f..3940b83f2e 100644
--- a/.github/workflows/dependabot-security-maintainer.lock.yml
+++ b/.github/workflows/dependabot-security-maintainer.lock.yml
@@ -1,4 +1,4 @@
-# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d12cd3d36a32367d2e254a90c02d17558ed7b27bb1546b2ef2642b94c7ba3186","body_hash":"1bfa8a3708fecd4d99da392a80bcefd60fa2f6ea848d4cf5bc17b2d4292106d1","compiler_version":"v0.86.2","strict":true,"agent_id":"claude","agent_model":"claude-opus-5","engine_versions":{"claude":"2.1.277"}}
+# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d12cd3d36a32367d2e254a90c02d17558ed7b27bb1546b2ef2642b94c7ba3186","body_hash":"ea22266c7720b9c632ffee611a40b66dd276e179df7de62e80a9470daaa4e6eb","compiler_version":"v0.86.2","strict":true,"agent_id":"claude","agent_model":"claude-opus-5","engine_versions":{"claude":"2.1.277"}}
# gh-aw-manifest: {"version":1,"secrets":["CLAUDE_API_KEY","COPILOT_GITHUB_TOKEN","GH_ACCESS_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_LANGFUSE_OTLP_BASIC_AUTH","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"6aab9e5b5c91c615506061f09bedd81a23babe3c","version":"v0.86.2"},{"repo":"pnpm/setup","sha":"703c52620218391530e48b9e8870d5c0082e1b9b","version":"v2.1.0"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44","digest":"sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44","digest":"sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44","digest":"sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.9","digest":"sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196","pinned_image":"ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196"},{"image":"ghcr.io/github/github-mcp-server:v1.9.0","digest":"sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e","pinned_image":"ghcr.io/github/github-mcp-server:v1.9.0@sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e"}]}
# This file was automatically generated by gh-aw (v0.86.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
#
diff --git a/.github/workflows/dependabot-security-maintainer.md b/.github/workflows/dependabot-security-maintainer.md
index 84a77b506f..eefa990ae2 100644
--- a/.github/workflows/dependabot-security-maintainer.md
+++ b/.github/workflows/dependabot-security-maintainer.md
@@ -306,6 +306,8 @@ Every denied call still costs a full model turn, so follow these exactly.
the dependency upgrade and list every covered Dependabot alert number and
GHSA ID, and every covered code-scanning alert number with its Snyk rule ID,
CVE, and image.
+ Include this maintainer hint: "If merging another dependency PR causes
+ conflicts, comment `/rebase-security-pr` here to repair this branch and rerun CI."
This workflow intentionally allows multiple independent PRs. The generic
`create_pull_request` instruction to stop after the call means: do not modify,
retry, probe, or publish that completed branch again. It does not end this
diff --git a/.github/workflows/rebase-security-pr.yml b/.github/workflows/rebase-security-pr.yml
new file mode 100644
index 0000000000..3e2d334b19
--- /dev/null
+++ b/.github/workflows/rebase-security-pr.yml
@@ -0,0 +1,187 @@
+name: Repair security dependency pull request
+
+on:
+ issue_comment:
+ types: [created]
+
+permissions:
+ contents: read
+ pull-requests: read
+
+concurrency:
+ group: security-pr-${{ github.event.issue.number }}-${{ github.event.comment.body == '/rebase-security-pr' }}
+ cancel-in-progress: false
+
+jobs:
+ repair:
+ if: >-
+ github.repository == 'langfuse/langfuse' &&
+ github.event.issue.pull_request != null &&
+ github.event.comment.body == '/rebase-security-pr'
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ outputs:
+ authorized: ${{ steps.authorize.outputs.authorized }}
+ updated: ${{ steps.repair.outputs.updated }}
+ steps:
+ - name: Authorize command and select security PR
+ id: authorize
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ with:
+ script: |
+ const permission = await github.rest.repos.getCollaboratorPermissionLevel({
+ ...context.repo, username: context.payload.comment.user.login,
+ });
+ if (!['admin', 'maintain', 'write'].includes(permission.data.permission))
+ throw new Error('Only repository writers can request a repair.');
+ const { data: pr } = await github.rest.pulls.get({ ...context.repo, pull_number: context.issue.number });
+ const target = pr.title.match(/^chore\(deps\): bump `?((?:@[\w.-]+\/)?[\w.-]+)`? to ([\d]+\.[\d]+\.[\d]+(?:[-+][\w.-]+)?)$/);
+ if (pr.state !== 'open' || pr.user.login !== 'github-actions[bot]' ||
+ pr.base.ref !== 'main' || pr.head.repo?.full_name !== context.payload.repository.full_name ||
+ !pr.head.ref.startsWith('deps/security-') || !target ||
+ !pr.body?.includes('<!-- gh-aw-workflow-id: dependabot-security-maintainer -->'))
+ throw new Error('Expected an open security-maintainer PR from this repository.');
+ for (const [key, value] of Object.entries({ authorized: 'true', head: pr.head.sha,
+ branch: pr.head.ref, dependency: target[1], version: target[2] })) core.setOutput(key, value);
+
+ - name: Checkout trusted main
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: main
+ fetch-depth: 0
+ persist-credentials: false
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 24
+ package-manager-cache: false
+ - uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
+ with:
+ install: false
+ cache: false
+ - name: Install trusted tooling
+ run: pnpm install --frozen-lockfile --ignore-scripts --ignore-pnpmfile
+
+ - name: Merge main and repair dependency conflicts
+ id: repair
+ env:
+ HEAD_SHA: ${{ steps.authorize.outputs.head }}
+ HEAD_REF: ${{ steps.authorize.outputs.branch }}
+ DEPENDENCY: ${{ steps.authorize.outputs.dependency }}
+ TARGET_VERSION: ${{ steps.authorize.outputs.version }}
+ run: |
+ set -euo pipefail
+ export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null
+ git config core.hooksPath /dev/null
+ BASE_SHA="$(git rev-parse HEAD)"
+ export BASE_SHA
+ echo "base=$BASE_SHA" >> "$GITHUB_OUTPUT"
+ git fetch --no-tags origin "refs/heads/$HEAD_REF"
+ [[ "$(git rev-parse FETCH_HEAD)" == "$HEAD_SHA" ]]
+ # This uses main's installed YAML parser before installing PR dependencies.
+ node --input-type=module <<'JS'
+ import assert from 'node:assert/strict';
+ import { execFileSync } from 'node:child_process';
+ import { writeFileSync } from 'node:fs';
+ import { createRequire } from 'node:module';
+ const { parse } = createRequire(`${process.cwd()}/web/package.json`)('yaml');
+ const git = (...args) => execFileSync('git', args, { encoding: 'utf8' }).trim();
+ const { BASE_SHA, HEAD_SHA, DEPENDENCY, RUNNER_TEMP } = process.env;
+ const base = git('merge-base', BASE_SHA, HEAD_SHA);
+ const files = git('diff', '--name-only', `${base}..${HEAD_SHA}`).split('\n');
+ for (const path of files) {
+ assert(/^(pnpm-(workspace|lock)\.yaml|(?:[\w.-]+\/)*package\.json)$/.test(path), `Disallowed file: ${path}`);
+ for (const ref of [base, HEAD_SHA]) assert(git('ls-tree', ref, '--', path).startsWith('100644 blob '), `Not a regular file: ${path}`);
+ if (path === 'pnpm-lock.yaml') continue;
+ const [before, after] = [base, HEAD_SHA].map(ref => parse(git('show', `${ref}:${path}`)));
+ const allowed = path.endsWith('.yaml') ? ['overrides', 'catalog', 'catalogs', 'minimumReleaseAgeExclude']
+ : ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
+ for (const key of new Set([...Object.keys(before), ...Object.keys(after)]))
+ if (!allowed.includes(key)) assert.deepEqual(after[key], before[key], `Disallowed change: ${path}:${key}`);
+ for (const entry of after.minimumReleaseAgeExclude ?? [])
+ if (!(before.minimumReleaseAgeExclude ?? []).includes(entry)) assert(/^(?:@[\w.-]+\/)?[\w.-]+@\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/.test(entry), 'Expected exact release-age exclusion');
+ }
+ const lock = parse(git('show', `${HEAD_SHA}:pnpm-lock.yaml`));
+ const prefix = `${DEPENDENCY}@`;
+ const versions = Object.keys(lock.packages).filter(key => key.startsWith(prefix)).map(key => key.slice(prefix.length).split('(')[0]);
+ writeFileSync(`${RUNNER_TEMP}/security-versions.json`, JSON.stringify(versions));
+ JS
+ git checkout --detach "$HEAD_SHA"
+ if git merge-base --is-ancestor "$BASE_SHA" HEAD; then
+ echo "updated=false" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ if ! git -c merge.conflictStyle=diff3 merge --no-commit --no-ff "$BASE_SHA"; then
+ [[ -n "$(git diff --name-only --diff-filter=U)" ]]
+ while IFS= read -r path; do
+ case "$path" in
+ pnpm-lock.yaml) ;; # pnpm resolves this generated file below.
+ pnpm-workspace.yaml)
+ # Only combine insertions; differing edits need a human decision.
+ awk '/^\|{7}/ {base=1; next} /^=======/ {base=0; next} base {exit 1}' "$path"
+ for stage in 1 2 3; do git show ":$stage:$path" > "$RUNNER_TEMP/workspace-$stage"; done
+ git merge-file --union -p "$RUNNER_TEMP/workspace-2" "$RUNNER_TEMP/workspace-1" "$RUNNER_TEMP/workspace-3" > "$path"
+ ;;
+ *) echo "Cannot automatically resolve $path"; exit 1 ;;
+ esac
+ done < <(git diff --name-only --diff-filter=U)
+ fi
+ # Reject duplicate keys introduced by combining insertions.
+ node -e "require(require.resolve('yaml', { paths: ['./web'] })).parse(require('node:fs').readFileSync('pnpm-workspace.yaml', 'utf8'))"
+ pnpm install --lockfile-only --no-frozen-lockfile --ignore-scripts --ignore-pnpmfile 2>&1 | tee "$RUNNER_TEMP/security-pnpm.log"
+ [[ "$(<"$RUNNER_TEMP/security-pnpm.log")" != *"Ignoring broken lockfile"* ]]
+ pnpm install --frozen-lockfile --ignore-scripts --ignore-pnpmfile
+ pnpm why -r --json "$DEPENDENCY" | jq -e --arg target "$TARGET_VERSION" --slurpfile versions "$RUNNER_TEMP/security-versions.json" \
+ 'any(.version == $target) and all(.version as $v | $versions[0] | index($v) != null)'
+ pnpm dedupe --check --ignore-scripts --ignore-pnpmfile
+ git add -- 'pnpm-lock.yaml' 'pnpm-workspace.yaml'
+ git diff --exit-code
+ git diff --cached --check
+ while IFS= read -r path; do
+ case "$path" in
+ package.json|*/package.json|pnpm-lock.yaml|pnpm-workspace.yaml) ;;
+ *) echo "Unexpected change relative to main: $path"; exit 1 ;;
+ esac
+ done < <(git diff --cached --name-only "$BASE_SHA")
+ echo "updated=true" >> "$GITHUB_OUTPUT"
+
+ - name: Publish updated branch and trigger CI
+ if: steps.repair.outputs.updated == 'true'
+ env:
+ GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
+ HEAD_REF: ${{ steps.authorize.outputs.branch }}
+ BASE_SHA: ${{ steps.repair.outputs.base }}
+ run: |
+ set -euo pipefail
+ export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null
+ [[ -n "$GH_TOKEN" ]]
+ [[ "$(git ls-remote origin refs/heads/main | cut -f1)" == "$BASE_SHA" ]]
+ git -c core.hooksPath=/dev/null -c user.name='github-actions[bot]' \
+ -c user.email='41898282+github-actions[bot]@users.noreply.github.com' \
+ -c commit.gpgsign=false commit --no-verify -m 'chore(deps): merge main into security upgrade'
+ # Normal push refuses concurrent branch changes; no history is rewritten.
+ git -c core.hooksPath=/dev/null -c credential.helper= \
+ -c 'credential.https://github.com.helper=!gh auth git-credential' \
+ push origin "HEAD:refs/heads/$HEAD_REF"
+
+ report:
+ needs: repair
+ if: always() && needs.repair.outputs.authorized == 'true'
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ pull-requests: write
+ steps:
+ - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
+ env:
+ RESULT: ${{ needs.repair.result }}
+ UPDATED: ${{ needs.repair.outputs.updated }}
+ with:
+ script: |
+ const url = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
+ const message = process.env.RESULT !== 'success'
+ ? 'Repair failed. Check the run for the reason; conflicting dependency edits need manual resolution. If a branch advanced, retry `/rebase-security-pr`.'
+ : process.env.UPDATED === 'true'
+ ? 'Merged main into this PR, repaired and verified the lockfile, and pushed the same branch. CI will run again.'
+ : 'This PR already includes main; no changes needed.';
+ await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number,
+ body: `${message}\n\n[Workflow run](${url})` });