Rebuild comment sync as a post-merge repair workflow - #11
Conversation
The in-PR model is unwithstandable: ANY non-Dependabot push to a Dependabot branch — deploy key included — flips the actor of the retriggered pull_request runs off dependabot[bot], lifting GitHub's Dependabot sandbox (read-only token, no secrets) for the PR's freshly bumped, unreviewed action pins. Verified live: basecamp-cli#566 runs went dependabot[bot] -> jeremy across the sync push. New model: Dependabot maintains bare version comments on its own PRs (repos restructured to one-line pins with standalone zizmor ignores); this workflow is the post-merge backstop. On workflow-file pushes to the default branch it recomputes comments and, when drifted, opens a comment-only repair PR that auto-merges once checks pass. Every pin the repair touches is already reviewed; its CI executes exactly the action SHAs already on the default branch. Successor-commit invariants before pushing and again before arming auto-merge: repair parent == captured base SHA; action path@sha tuples byte-identical to base; staged diff confined to pinned uses lines (the updater independently asserts per-line token-only changes); exactly one bot-owned repair branch/PR, updated behind a ls-remote lease; held-run approval scoped to the exact repair head. Also: updater accepts SemVer build-metadata tags (+build.N) with regression tests — a pinned SHA whose only tag carried build metadata previously tripped the fail-closed SyncError forever; node --test glob unquoted so the shell expands it on any Node.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7009f7e2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR restructures the Dependabot action-pin comment syncing model to avoid Dependabot sandbox escapes by moving synchronization to a post-merge “repair PR” workflow on default-branch workflow-file changes, and extends the tag parser to accept SemVer build metadata in version comments.
Changes:
- Rebuilds the reusable workflow to run only on the default branch, compute drift, push a comment-only repair branch, open a repair PR, and arm auto-merge.
- Extends tag parsing/selection to accept
vX.Y.Z+build.metabuild-metadata tags (while ignoring metadata for precedence) with new tests. - Updates CI to run
node --testwith an unquoted glob so the shell expands it reliably.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/dependabot-sync-actions-comments.yml |
Replaces in-PR syncing with a post-merge repair-PR workflow, adds safety invariants, and auto-merge/held-run handling. |
scripts/sync-action-pin-comments.mjs |
Accepts SemVer build metadata in eligible version tags and ignores metadata for precedence. |
scripts/sync-action-pin-comments.test.mjs |
Adds regression coverage for build-metadata tag indexing and repair behavior. |
.github/workflows/ci.yml |
Adjusts Node test invocation so the shell expands the test glob consistently. |
Comments suppressed due to low confidence (1)
.github/workflows/dependabot-sync-actions-comments.yml:590
- Same author-login issue as above: the post-create verification requires author == "github-actions", but the PR author for GITHUB_TOKEN-created PRs is "github-actions[bot]". This will prevent auto-merge from being armed.
oid="$(jq -r '.[0].headRefOid' <<<"$prs")"
base="$(jq -r '.[0].baseRefName' <<<"$prs")"
author="$(jq -r '.[0].author.login' <<<"$prs")"
num="$(jq -r '.[0].number' <<<"$prs")"
if [ "$oid" != "$NEW_HEAD" ] || [ "$base" != "$BASE_BRANCH" ] || [ "$author" != "github-actions" ]; then
echo "::error::repair PR does not match the proven commit (head=${oid}, base=${base}, author=${author}); not arming auto-merge"
exit 1
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replaces the in-PR workflow_run caller: any non-Dependabot push to a Dependabot branch flips the retriggered runs' actor off dependabot[bot], lifting the Dependabot sandbox for the PR's unreviewed action bumps (verified live on basecamp-cli#566; see basecamp/.github#11). The reusable workflow now runs post-merge: on workflow-file pushes to the default branch it repairs drifted comments via a comment-only auto-merging PR — only reviewed code ever executes. Dependabot itself maintains the bare comments on its own PRs after the bare-pin restructure. Lands disabled; enabled per repo after a full-cycle exercise.
Replaces the in-PR workflow_run caller: any non-Dependabot push to a Dependabot branch flips the retriggered runs' actor off dependabot[bot], lifting the Dependabot sandbox for the PR's unreviewed action bumps (verified live on basecamp-cli#566; see basecamp/.github#11). The reusable workflow now runs post-merge: on workflow-file pushes to the default branch it repairs drifted comments via a comment-only auto-merging PR — only reviewed code ever executes. Dependabot itself maintains the bare comments on its own PRs after the bare-pin restructure. Lands disabled; enabled per repo after a full-cycle exercise.
Replaces the in-PR workflow_run caller: any non-Dependabot push to a Dependabot branch flips the retriggered runs' actor off dependabot[bot], lifting the Dependabot sandbox for the PR's unreviewed action bumps (verified live on basecamp-cli#566; see basecamp/.github#11). The reusable workflow now runs post-merge: on workflow-file pushes to the default branch it repairs drifted comments via a comment-only auto-merging PR — only reviewed code ever executes. Dependabot itself maintains the bare comments on its own PRs after the bare-pin restructure. Lands disabled; enabled per repo after a full-cycle exercise.
Replaces the in-PR workflow_run caller: any non-Dependabot push to a Dependabot branch flips the retriggered runs' actor off dependabot[bot], lifting the Dependabot sandbox for the PR's unreviewed action bumps (verified live on basecamp-cli#566; see basecamp/.github#11). The reusable workflow now runs post-merge: on workflow-file pushes to the default branch it repairs drifted comments via a comment-only auto-merging PR — only reviewed code ever executes. Dependabot itself maintains the bare comments on its own PRs after the bare-pin restructure. Lands disabled; enabled per repo after a full-cycle exercise.
Replaces the in-PR workflow_run caller: any non-Dependabot push to a Dependabot branch flips the retriggered runs' actor off dependabot[bot], lifting the Dependabot sandbox for the PR's unreviewed action bumps (verified live on basecamp-cli#566; see basecamp/.github#11). The reusable workflow now runs post-merge: on workflow-file pushes to main it repairs drifted comments via a comment-only auto-merging PR — only reviewed code ever executes. Lands disabled; enabled after a full-cycle exercise.
Replaces the in-PR workflow_run caller: any non-Dependabot push to a Dependabot branch flips the retriggered runs' actor off dependabot[bot], lifting the Dependabot sandbox for the PR's unreviewed action bumps (verified live on basecamp-cli#566; see basecamp/.github#11). The reusable workflow now runs post-merge: on workflow-file pushes to the default branch it repairs drifted comments via a comment-only auto-merging PR — only reviewed code ever executes. Dependabot itself maintains the bare comments on its own PRs after the bare-pin restructure. Lands disabled; enabled per repo after a full-cycle exercise.
Third and structural revision of the sync model, following the confirmed P1 on the in-PR design: any non-Dependabot push to a Dependabot branch — deploy key included — flips the actor of the retriggered
pull_requestruns offdependabot[bot], lifting GitHub's Dependabot sandbox (read-only token, no Actions secrets) for the PR's freshly bumped, unreviewed action pins. Verified live on basecamp/basecamp-cli#566: runs on the original head were actoreddependabot[bot]; runs on the synced head were actoredjeremy. Removing the dispatch fallback (#10) was necessary but insufficient.New model
# vX.Y.Zcomments natively on its own PRs.Successor-commit invariants (checked before pushing, re-checked before arming auto-merge)
uses:action-path@sha tuple sets byte-identical between base and repair (only comment tokens may move); staged-diff line guard + the updater's own per-line assertionbot/sync-action-pin-comments), bot-authored, based on the default branch — anything else errors without touching it--force-with-leasepinned to the just-observed remote SHA (empty = must-not-exist); job-level concurrency serializes runsAlso in this PR
v1.2.3+build.1) with regression tests (23 total) — closes the fail-closed-forever case from the earlier reviewnode --testglob unquoted so the shell expands it on any NodeCaller contract changed (push-to-default trigger,
pull-requests: write, repo setting "Allow GitHub Actions to create and approve pull requests"); caller PRs follow, landing while the workflows remain disabled, with a full-cycle exercise in one repo before enabling the fleet one at a time.