Skip to content

Daily upstream sync, package-style: only commits 7 days on upstream's main - #2

Merged
johannestreutlein merged 4 commits into
mainfrom
upstream-sync
Oct 28, 2026
Merged

johannestreutlein merged 4 commits into
mainfrom
upstream-sync

Conversation

@johannestreutlein

Copy link
Copy Markdown

A daily GitHub Actions job that merges upstream (Crazytieguy/codex-plugin-cc) into this fork's main, package-style, as npm's min-release-age does: only the newest upstream commit that has been on upstream's main without a break for at least 7 days. Every machine that installs this plugin updates itself from main, so the delay is a defense against supply-chain attacks. .github/upstream-sync/README.md describes the rule, the failure cases and how to merge by hand.

  • seen.tsv on the branch upstream-sync-state logs upstream's head whenever it changes; commit dates are never used. GitHub's activity log of upstream's main holds a merge back after a force-push or branch deletion.
  • Upstream changes to .github/ or .gitattributes are never merged automatically (so upstream cannot change the job); those merges are done by hand from a machine whose token may push workflow files.
  • A merge driver keeps version deleted from the plugin manifests.
  • The run fails, and GitHub emails, on a conflict, a failed activity-log call, a merged commit that upstream later removed, or 30 days without a possible merge.
  • No upstream code runs in the job. On pull requests it runs test.sh and a dry run.

After merging: run the workflow once by hand (gh workflow run upstream-sync.yml -R TruthfulAI-research/codex-plugin-cc, not a dry run) to check the push token, and check that the schedule is enabled (gh workflow list -R TruthfulAI-research/codex-plugin-cc).

Tests: bash .github/upstream-sync/test.sh.

🤖 Generated with Claude Code

johannestreutlein and others added 4 commits October 28, 2026 17:30
…seen

A daily GitHub Actions job (.github/workflows/upstream-sync.yml) runs
.github/upstream-sync/sync.sh. It records each upstream head with the time
it was first seen on the branch upstream-sync-state, and merges into main
the newest recorded commit that was first seen at least 7 days ago and is
still on upstream's main. The merge driver fork-manifest (.gitattributes)
and a check after each merge keep the version fields of the plugin
manifests deleted. The job uses plain git and jq, no third-party actions.
Pull requests that change these files run test.sh and a dry run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ays again

seen.tsv is now a log of upstream's head: a row whenever the head differs
from the last row's commit, even if that commit is in an earlier row. The
candidate is the newest row at least 7 days old whose commit is an ancestor
of every later row's commit, so it stayed in upstream's history without a
break. A commit that a force-push removed and that came back later counts
only from its new row. As with a package manager's minimum release age, a
commit that upstream reverts instead of removing is still merged on day 7;
the README says so. Rows must be in time order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s activity log

- Upstream commits that touch .github/ or .gitattributes (adds, edits,
  mode changes, symbolic links) are never merged automatically: the run
  fails and asks for a hand merge. A second check compares the merge
  result with main. So upstream can never change the job's scripts,
  workflow or merge driver. The check after a failed push is gone.
- Before merging, the job reads GitHub's activity log of upstream's main.
  A force-push or deletion of main after the candidate's row blocks the
  merge; if the head is still the last row's commit, it is logged again.
  If the log cannot be read, the run fails without merging.
- The run fails when upstream's main no longer has a commit that the
  fork merged, and when an upstream commit has waited 30 days.
- seen.tsv must end with a newline.
- test.sh: the fake fork carries the real sync files and workflow, and
  its hook models GitHub's rule as checked on 2026-10-28 (a new commit
  must not change .github/workflows/ compared with its first parent).
  New cases cover the checks above, a clock behind the last row, and
  merges on top of earlier sync merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johannestreutlein
johannestreutlein merged commit 234a68c into main Oct 28, 2026
2 checks passed
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