Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions FORK.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This fork carries a small set of patches on top of upstream
[openai/codex](https://github.com/openai/codex) so the Vogt engine can drive it.
Upstream lands about 1,500 commits a month, so the patch set is kept small and
every patch is a separate, rebasable commit. The target is under about 10
every patch is a separate commit. The target is under about 10
carried commits. Extension points (config, managed hooks in
`requirements.toml`, app-server, MCP servers, external binaries) come before
core edits.
Expand Down Expand Up @@ -41,31 +41,34 @@ core edits.
Thus a release cut from the merged tree reports `0.167.0+fork.<sha>`.
- All fork work branches off `fork/main` and every fork pull request targets
`fork/main`. Never open, comment on, or push anything to openai/codex.
- Vogt pins `fork/main` commit SHAs, not tags and not `main`.
- Vogt pins `fork/main` commit SHAs, not tags and not `main`
(`VOGT_CODEX_SHA` plus the musl binary's sha256 in its
`engine/agent-versions.env`); stock npm Codex is refused.
- `fork/main` is mirrored into graft (repository `codex`). Workers land on
the graft line `backlog-1`; oversight cuts `graft/batch-<n>` PRs into
`fork/main` (at most daily) that merge through the merge queue. See
`docs/fork-upstream-sync.md`.

Upstream history is never rewritten. Upstream commits mirror an internal
OpenAI repository and carry `GitOrigin-RevId` trailers; leave them intact.

## Rebase procedure
## Upstream sync procedure

Run this for each new upstream stable tag (`rust-vX.Y.Z`), whenever a tag
ships. There is no weekly schedule: GitHub runs `schedule` only from the
default branch, which is the upstream mirror, so the drift check is run on
`workflow_dispatch` and from the runbook at `docs/fork-upstream-sync.md`.

1. `git fetch upstream --tags` and check out a fresh branch from the tag.
2. Cherry-pick (or rebase) the carried patch series from `fork/main` onto it,
one commit at a time. A patch that no longer applies cleanly is reworked or
dropped in its own commit, never squashed into another patch.
3. Run the patched crates' tests: app-server, tui, core spawn, agents_md,
hooks. Regenerate the app-server schema fixtures.
4. Replay the proxy fixtures against the new Responses request shapes.
5. Update `fork/main` to the result with `git push --force-with-lease` and
publish the release. A rebase onto a new tag is not a fast-forward, and a
plain `--force` is never used. The procedure itself, including why each
published release tag must stay reachable, is the runbook at
`docs/fork-upstream-sync.md`. The release it publishes is tagged
`fork-<full sha>`, not the bare SHA.
Upstream is **merged** into `fork/main` through a `sync-upstream-<date>`
pull request that goes through the merge queue (the PR #37 model, decision
D1, 2026-11-13). `fork/main` is never rebased or force-pushed: graft follows
it, and its follower treats a non-fast-forward move as a divergence. The
steps, the graft follower, the CI and release runners, and how Vogt pins a
release are in `docs/fork-upstream-sync.md`.

Superseded: until 2026-11-13 the carried series was rebased onto each tag and
`fork/main` moved with `git push --force-with-lease`. That is retired; the
runbook keeps it as a historical note only.

Record the new base tag and any dropped or reworked patch in the table below.
`.github/workflows/fork-upstream-drift.yml` fails when a newer stable tag has
Expand Down Expand Up @@ -101,9 +104,10 @@ After it was re-enabled, the issue bots (`issue-deduplicator`, `issue-labeler`,
`fork-release` active. `postmerge-ci` (push to `main`, no fork guard) is not
registered yet and so cannot be disabled ahead of time: after the next mirror
sync of `main`, cancel its run and `gh workflow disable postmerge-ci`.
`fork-release` builds x86_64 only, on the self-hosted GCP `rust-heavy` runner,
whose image bakes the musl build packages (WI-1514); only its short publish job
runs GitHub-hosted. `fork-upstream-drift` is the check that the recorded base tag, or the
`fork-release` builds x86_64 only, pinned to node-f
(`[self-hosted, bigmem, node-f]`, WI-4161), and installs the musl build tools
when the runner lacks them; only its short publish job runs GitHub-hosted.
Every push to `fork/main` publishes `fork-<full sha>`. `fork-upstream-drift` is the check that the recorded base tag, or the
"Upstream fixes taken through" marker, is still the newest stable tag
(WI-1125). It has no schedule: run it on `workflow_dispatch`, or from the
sync runbook.
Expand Down
44 changes: 27 additions & 17 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ ref, so entries never cancel each other.

### Runners

Same-repo PRs, queue entries and `workflow_dispatch` run on the self-hosted GCP
Spot `rust-heavy` runner. A PR from another fork stays on GitHub-hosted
Same-repo PRs, queue entries and `workflow_dispatch` run on node-f: the main
half on `[self-hosted, rust-heavy, node-f]` and the app-server half on
`[self-hosted, bigmem, node-f]`. `ci-bigmem-0` is not used (its scratch disk is
too slow for a Codex workspace build). `fork-release` is pinned to
`[self-hosted, bigmem, node-f]` too. A PR from another fork stays on GitHub-hosted
`ubuntu-24.04`, so untrusted code never reaches a persistent runner. A
`merge_group` event is always trusted: only a maintainer can enqueue.

Expand All @@ -80,18 +83,25 @@ the entry's `merge_group` run. Don't rebase a queued PR by hand.

## Upstream syncs

A rebase of `fork/main` onto a new upstream tag is a force-push
(`docs/fork-upstream-sync.md`), not a queued merge. Drain or pause the queue
before you push the rebase. A sync that merges `upstream/main` instead (PR
#37) goes through the queue like any PR, and because the selection diffs
against the upstream merge-base, it tests the carried patches on the new
base and nothing else. The ruleset below bypasses only the repository
admin role, which is what lets the `--force-with-lease` push through.

## Turning the queue on (operator)

`fork/main` has no branch protection and no ruleset today, so `fork-ci` is not
required and the queue is off. The workflow supports the queue without
needing it. The exact ruleset is in the WI-1886 PR description: one branch
ruleset on `fork/main` that requires `fmt, clippy, test` and adds a
`merge_queue` rule.
A sync merges upstream into `fork/main` through a `sync-upstream-<date>` PR
(the PR #37 model; `docs/fork-upstream-sync.md`). It goes through the queue
like any PR, and because the selection diffs against the upstream merge-base,
it tests the carried patches on the new base and nothing else. `fork/main` is
never rebased or force-pushed: graft follows it, and a non-fast-forward move
diverges the mirror. Don't run a sync while a graft batch PR is open or
queued.

## Graft batches

Workers land on the graft line `backlog-1`; oversight cuts `graft/batch-<n>`
PRs into `fork/main` with `graft-mirror pr-batch backlog-1 --base fork/main`,
at most daily. A batch merges through the queue (MERGE method, so each land
keeps its commit), with an Opus-level review when it touches exec, sandbox,
approvals or auth.

## The queue ruleset

Ruleset 25362303 ("fork/main merge queue") is active on `fork/main`: it
requires `fmt, clippy, test` and runs a merge queue with the MERGE method
(grouping ALLGREEN, check timeout 90 min). Only the repository admin role
bypasses it. The original proposal is in the WI-1886 PR description.
116 changes: 94 additions & 22 deletions docs/fork-upstream-sync.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,115 @@
# Upstream sync

How `fork/main` is rebased onto each new upstream stable tag. The branch model
and the carried-patch table live in `FORK.md`; this is the runbook.
How upstream is brought into `fork/main`. The branch model and the
carried-patch table live in `FORK.md`; this is the runbook.

Upstream shipped 40 stable tags (`rust-v0.144` to `rust-v0.162`) in three
months and about 1,559 commits in 30 days, so this runs on every stable tag.
months and about 1,559 commits in 30 days, so a sync runs on every stable tag.
There is no weekly schedule: GitHub runs `schedule` only from the repository's
default branch, and that branch is `main`, the upstream mirror. The drift
check below is run on `workflow_dispatch` and by following this runbook.

## Merge model (current)

A sync **merges** upstream into `fork/main` through a pull request. It never
rebases `fork/main` and never force-pushes it (decision D1, 2026-11-13;
PR #37 is the first sync done this way).

Why: `fork/main` is followed by graft (see "Graft follower" below). graft's
follower never force-pushes, and a non-fast-forward move of a followed branch
is a divergence: the mirror holds, and every land on the graft line would sit
on history that no longer exists on GitHub. A merge commit is a fast-forward
of `fork/main`, so the follower imports it like any other move.

## Steps

1. `git fetch upstream --tags` and note the newest `rust-vX.Y.Z` stable tag
(skip `alpha` and `dev` tags).
2. Branch from that tag and replay the carried patch series from `fork/main`,
one commit at a time. A patch that no longer applies is reworked or dropped
in its own commit, never folded into another patch.
3. Test the patched crates: app-server, tui, core spawn, agents_md, hooks.
4. Regenerate the app-server schema fixtures and commit the diff.
5. Replay the Responses proxy fixtures against the new request shapes and fix
(skip `alpha` and `dev` tags), or the upstream `main` commit to take.
2. Check with oversight that no graft batch PR into `fork/main` is open or
queued. One writer of `fork/main` at a time: land the open batch first, or
merge the sync first and batch after.
3. Branch `sync-upstream-<YYYY-MM-DD>` off the tip of `fork/main` and
`git merge` the upstream tag or commit into it. Resolve conflicts in the
merge commit; a carried patch that needs rework gets its own follow-up
commit on the same branch.
4. Test the patched crates: app-server, tui, core spawn, agents_md, hooks.
5. Regenerate the app-server schema fixtures and commit the diff.
6. Replay the Responses proxy fixtures against the new request shapes and fix
anything that drifted.
6. Update `upstream_version` in `.github/workflows/fork-release.yml` and the
base tag recorded in `FORK.md`, and update the carried-patch table.
7. Move `fork/main` to the result with
`git push --force-with-lease=refs/heads/fork/main:<expected-old-sha>`.
A rebase onto a new tag is **not a fast-forward**, so a plain push is
rejected and a plain `--force` is never used: `--force-with-lease` refuses
to overwrite the branch if someone else has moved it since you last saw it.
8. The `fork-release` workflow then publishes a GitHub release tagged
`fork-<full sha>`. A bare 40-hex SHA is not a valid tag name, which is why
the tag carries the prefix.
7. Update `upstream_version` in `.github/workflows/fork-release.yml`, the
"Upstream fixes taken through" marker and sync record in `FORK.md`, and the
carried-patch table.
8. Open a pull request from the sync branch into `fork/main`. It goes through
the merge queue like any other PR (`docs/ci.md`); because `fork-ci` diffs
against the upstream merge-base, it tests the carried patches on the new
base and trusts upstream's CI for the rest.
9. Once it merges, the `fork-release` workflow publishes a GitHub release
tagged `fork-<full sha>` (a bare 40-hex SHA is not a valid tag name, which
is why the tag carries the prefix). Oversight then syncs the graft line
onto the new `fork/main` before cutting the next batch.

## Graft follower

`fork/main` is mirrored into the graft repository `codex`. GitHub `fork/main`
stays the source of truth; graft only writes it through merged batch PRs.

- Workers clone the graft line `backlog-1` (`g clone codex <dir> --line
backlog-1`), run checks for the crates they touched, and land with
`g land`. They do not push branches or open pull requests.
- Oversight cuts batch PRs with
`graft-mirror pr-batch backlog-1 --base fork/main`, which pushes
`graft/batch-<n>` and opens a PR into `fork/main`. The batch merges
through the `fork/main` merge queue (MERGE method, so each land keeps its
own commit, and the queue adds its group diff and workspace
`cargo check`).
- Batches are cut at most daily, or sooner for a release-relevant fix: each
batch costs about two hours of runner time plus a release build.
- A batch is reviewed as a whole, at Opus level when it touches exec,
sandbox, approvals or auth; otherwise a lighter review.
- Conflicts between a sync and in-flight lands are resolved in graft by the
worker that owns the area (`g sync`, fix, `g land`), never by rewriting
`fork/main`.
- If `fork/main` is ever force-pushed anyway, the mirror has to be removed
and re-imported, the graft line rebuilt, and every unbatched land re-landed
by hand. The merge model exists to avoid that.

## CI and release runners

- `fork-ci` runs same-repo PRs, queue entries and `workflow_dispatch` on
node-f: the main half on `[self-hosted, rust-heavy, node-f]` and the
app-server half on `[self-hosted, bigmem, node-f]` (it was OOM-killed on the
10 GiB docker runner). `ci-bigmem-0` is not used: its scratch disk is too
slow for a Codex workspace build. PRs from other forks stay on GitHub-hosted
`ubuntu-24.04`.
- `fork-release.yml` builds on `[self-hosted, bigmem, node-f]`
(`nodef-gha-public-rust`, 24 GiB, `CARGO_BUILD_JOBS: 5`) and installs the
musl build tools when the runner lacks them (WI-4161). Every push to
`fork/main` publishes a release tagged `fork-<full sha>`; the publish job
runs GitHub-hosted.

## How Vogt consumes a release

The Vogt engine pins a fork release in its `engine/agent-versions.env`:
`VOGT_CODEX_SHA` is the full `fork/main` commit, alongside the sha256 of the
`x86_64-unknown-linux-musl` codex binary from the `fork-<sha>` release. The
engine installs only that pinned fork build and refuses stock npm Codex.
Moving the pin is a separate Vogt change; a fork merge never moves it.

## Superseded: rebase procedure

Until 2026-11-13 a sync rebased the carried series onto each new upstream
stable tag and moved `fork/main` with
`git push --force-with-lease=refs/heads/fork/main:<expected-old-sha>`. That
is retired by D1 because it rewrites the followed branch. It is kept here as
a record only; do not run it.

## Release tags stay reachable

The Vogt engine pins `fork/main` by commit SHA and installs the release tagged
`fork-<sha>` (WI-1142). Once a release is published its tag must keep pointing
at the commit it was built from, and that commit must stay reachable — never
delete a release tag and never garbage-collect its commit. Moving `fork/main`
does not move a tag, so older releases keep working after every rebase.
does not move a tag, so older releases keep working after every sync.

## Watching upstream

Expand All @@ -60,7 +132,7 @@ and dev tags excluded) is newer than both the rebase base recorded in
`.github/workflows/fork-release.yml`) and the separate `Upstream fixes taken
through:` marker in `FORK.md`. The marker is how a cherry-pick is recorded
without moving the rebase base. It also fails when the carried-patch table
grows past ten rows. It only reports; the rebase stays the steps above.
grows past ten rows. It only reports; the sync is the steps above.

Last run, 2026-10-15: `FORK.md` and `fork-release.yml` still record the rebase
base `rust-v0.162.0`. The newest stable tag on upstream is `rust-v0.162.1`,
Expand Down
Loading