fix(fork): push mirror fast-forwards with a deploy key - #27
Conversation
The hourly fork-sync-mirror job has been failing since upstream commit a148e08 modified .github/workflows/release.yml: the job pushed with the default GITHUB_TOKEN, which can never hold the workflows permission, so GitHub rejected any fast-forward range touching workflow files and main went stale. Check out the mirror job with the FORK_SYNC_PUSH_KEY deploy key (read-write, repo-scoped) so the push goes over SSH, which is exempt from that token restriction. Verified the key can push a workflow-file-modifying commit before wiring it in. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
Thermo-nuclear code quality review
No major structural issues found.
This is a direct, minimal credential-path fix: actions/checkout ssh-key for the mirror job is the canonical way around GITHUB_TOKEN’s hard workflows push restriction. No new branching, no abstraction churn, no file-size pressure (137 lines), and no missed code-judo simplification. Meets the approval bar.
Sent by Cursor Automation: Thermo-nuclear PR review
Review: aggressive passThe diagnosis is right and the mechanism is the correct one — But the change does something the description doesn't mention, and I think it blocks. 🔴 Blocking — this makes mirror pushes start triggering workflowsPushes authenticated with So today the hourly mirror push to
What actually happens the first hour after merge is that it hangs, because The long-term damage is the part I'd push back hardest on, because this repo has already written down the exact rule this breaks. From
Suggested fix — apply the established pattern rather than inventing a new one: # .github/workflows/deploy-relay.yml
jobs:
deploy_relay:
# fork:begin relay-upstream-only — see .fork/customizations.yaml#relay-upstream-only
if: github.repository == 'pingdotgg/t3code'
# fork:end relay-upstream-onlyplus a manifest entry and a guard test alongside I'd also drop 🟡 The secret going missing silently re-creates this exact incidentIf - name: Require the push key
run: |
if [ -z "${{ secrets.FORK_SYNC_PUSH_KEY }}" ]; then
echo "::error::FORK_SYNC_PUSH_KEY is unset — the mirror push will be rejected on any range touching .github/workflows/*."
exit 1
fi🟡 Nothing detects that this job is brokenThe actual cost of this incident wasn't the token — it was The 🟢
|
Address review on the deploy-key change. Deploy-key pushes, unlike GITHUB_TOKEN pushes, trigger push workflows, so every hourly mirror advance would have fired everything watching push: main. - Gate deploy_relay on github.repository == 'pingdotgg/t3code' (fenced, manifest entry relay-upstream-only, guard test), matching release-upstream-only: independent of runner labels, so installing Blacksmith on the fork can never start deploying production. - Drop main from ci.yml push triggers inside the ci-on-custom fence; main is a pure mirror upstream CI already validated. Guard extended to pin main's absence. - Mirror job: preflight that FORK_SYNC_PUSH_KEY exists (checkout falls back to token auth silently otherwise), drop contents: write (SSH key does the push; token needs only read), report failures to a find-or-create [fork-sync] issue so a stale mirror is loud, and document the git-plumbing-only invariant that keeps the write key away from unreviewed upstream code. - Document the deploy key and its ruleset bypass requirement in .fork/AGENTS.md and .fork/README.md §5 instead of the PR body. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Addressed in 5afcc53 — point by point: 🔴 Deploy-key pushes trigger 🟡 Missing secret fails silently — preflight added. First step of 🟡 No detection — failure alarm added. 🟢 🟢 No-execution invariant pinned as a SECURITY INVARIANT comment on the 🟢 Ruleset note moved into Verification: full fork guard suite green (155 tests, including the two new/extended guards), 🤖 Generated with Claude Code |


Problem
The hourly
fork-sync-mirrorjob has failed on every run since ~2026-07-28T00:13Z. Upstream commita148e0819modified.github/workflows/release.yml, and the mirror pushes with the defaultGITHUB_TOKEN— a GitHub App token that can never hold theworkflowspermission (it is not grantable via thepermissions:block). GitHub therefore rejected the fast-forward push andmainwent stale, 13 commits behind upstream.Fix
Check out the
mirrorjob with the newFORK_SYNC_PUSH_KEYdeploy key (read-write, scoped to this repo only), so the push goes over SSH — SSH keys are exempt from the workflow-file token restriction. Thedriftjob doesn't push and is unchanged.Already done outside this PR:
mainmanually fast-forwarded to upstream476d69cd1(the exact operation the job performs), so the mirror is current again.fork-sync-mirror push key(id 158540815) added and its private key stored as theFORK_SYNC_PUSH_KEYActions secret.Note
If the
mainbranch ruleset from.fork/AGENTS.md(block direct pushes except the mirror) is ever configured, the deploy key must be on its bypass list.🤖 Generated with Claude Code