Skip to content

Rebuild comment sync as a post-merge repair workflow - #11

Merged
jeremy merged 1 commit into
mainfrom
ci/post-merge-sync
Jul 27, 2026
Merged

Rebuild comment sync as a post-merge repair workflow#11
jeremy merged 1 commit into
mainfrom
ci/post-merge-sync

Conversation

@jeremy

@jeremy jeremy commented Jul 27, 2026

Copy link
Copy Markdown
Member

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_request runs off dependabot[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 actored dependabot[bot]; runs on the synced head were actored jeremy. Removing the dispatch fallback (#10) was necessary but insufficient.

New model

  • Layer 1 (no automation): repos are restructured to one-line pins with standalone zizmor ignores (basecamp-cli#576, hey-cli#142, fizzy-cli#192, cli#53, openclaw-basecamp#157), so Dependabot rewrites the bare # vX.Y.Z comments natively on its own PRs.
  • Layer 2 (this workflow): post-merge backstop. On workflow-file pushes to the default branch, recompute comments; when drifted, push a comment-only repair branch with the environment-scoped deploy key and open a PR that auto-merges once required checks pass. Every pin the repair touches is already reviewed — its CI executes exactly the action SHAs already on the default branch, so there is no sandbox to escape and no actor that matters.

Successor-commit invariants (checked before pushing, re-checked before arming auto-merge)

  • Repair commit's parent == the captured base SHA (committed on the detached base checkout, asserted anyway)
  • 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 assertion
  • Exactly one bot-owned repair branch/PR (bot/sync-action-pin-comments), bot-authored, based on the default branch — anything else errors without touching it
  • --force-with-lease pinned to the just-observed remote SHA (empty = must-not-exist); job-level concurrency serializes runs
  • Held-run approval scoped to the exact repair head (GITHUB_TOKEN-created PRs start held); repair merge's own push triggers the terminal no-op run

Also in this PR

  • Updater accepts SemVer build-metadata tags (v1.2.3+build.1) with regression tests (23 total) — closes the fail-closed-forever case from the earlier review
  • node --test glob unquoted so the shell expands it on any Node

Caller 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.

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.
Copilot AI review requested due to automatic review settings July 27, 2026 21:28
@jeremy
jeremy merged commit 45d3fc9 into main Jul 27, 2026
6 checks passed
@jeremy
jeremy deleted the ci/post-merge-sync branch July 27, 2026 21:29

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread .github/workflows/dependabot-sync-actions-comments.yml
Comment thread .github/workflows/dependabot-sync-actions-comments.yml

Copilot AI 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.

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.meta build-metadata tags (while ignoring metadata for precedence) with new tests.
  • Updates CI to run node --test with 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.

Comment thread .github/workflows/dependabot-sync-actions-comments.yml
Comment thread scripts/sync-action-pin-comments.mjs
Comment thread .github/workflows/dependabot-sync-actions-comments.yml
jeremy added a commit to basecamp/cli that referenced this pull request Jul 27, 2026
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.
jeremy added a commit to basecamp/openclaw-basecamp that referenced this pull request Jul 27, 2026
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.
jeremy added a commit to basecamp/fizzy-cli that referenced this pull request Jul 27, 2026
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.
jeremy added a commit to basecamp/hey-cli that referenced this pull request Jul 27, 2026
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.
jeremy added a commit to basecamp/basecamp-sdk that referenced this pull request Jul 27, 2026
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.
jeremy added a commit to basecamp/basecamp-cli that referenced this pull request Jul 27, 2026
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.
jeremy added a commit that referenced this pull request Jul 27, 2026
…al sleep (#15)

Closeout sweep: the TAG_RE doc comment (script and embedded copy) still
described only a prerelease suffix after #11 widened the regex to SemVer
build metadata; and the PR-API catch-up poll slept after its final
attempt, stretching the bounded window past its stated 30s.
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.

2 participants