You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 978268a
Browse filesBrowse the repository at this point in the historyBrowse files
authored and
rsi-pr-agent
committed
fix(fork-sync): wait for setup, follow the trunk, root at the main checkout (#1835)
## Problem
The latest `/fork-sync` audit lane hit snags that cost hand work.
1. A fresh worktree ran before setup finished
2. Local `hyprws` stayed behind after a push
3. Reruns from other checkouts lost sync state
4. `fork:fixup-fold` broke once upstream moved on
5. The skill missed two steps
## Change
### 1. Setup wait
- **Preload:** `scripts/lib/await-setup.ts`
- **Running:** waits on `.t3/setup-running`
- **Failed:** exits 1 with the `setup-failed` tail
### 2. Trunk follow
- **Clean checkout:** `reset --keep` to the tip
- **No checkout:** `update-ref`
- **Otherwise:** prints why, plus the sha
Acts only when local `hyprws` sits at the lease.
### 3. Main checkout root
The run resolves its root to the main checkout, so reports and the kept worktree live in one place for every lane.
### 4. Fixup fold base
Replays from the merge base of `--base` (still `upstream/main`) and the head.
### 5. Skill and doc
- Grep the lease sha before keeping a deletion
- Run tests inside the package
- Document the state home and trunk follow
**Corrections:** the audit's `ci.url` finding was wrong: the field is `ci.run`, and it is set.
**Cut as overbuilt:** an insertion resolver and a run lock; hook re-apply already covers reshaped owners.
## Scope and approval
Fork tooling only, from the fork-sync audit; no app code changes.
## Verification
| Command | Result |
| --- | --- |
| `vp test run` sync, setup, fixup-fold tests | 86 passed |
| `vp run typecheck` | exit 0 |
| `vp run fork:ci` | exit 0 |
| `vp run check:changed` | exit 1, unrelated |
**Unrelated failure:** `GitManager.test.ts` "includes CLAUDE.md for Claude writers only when it differs from AGENTS.md" fails alone on this base; no server code changed.
New tests cover both trunk-follow paths, a rerun from inside the kept worktree, the setup wait, and the moved upstream base.
Claude Opus 5.5, Claude Code in T3 Code.
## Fork trailers
Squashes:
- 78707fa fix(fork-sync): wait for setup, follow the trunk, root at the main checkout (#1835) (#1835)
- 50ef483 fixup! fix(fork-sync): wait for setup, follow the trunk, root at the main checkout (#1835) (#1835)
Fork-Domain: fork-meta
Fork-Tier: bugfix
Fork-Upstreamable: no
Co-authored-by: donjor <[email protected]>
| blocked | one attention issue for any red run, via `gh`|`gh` refuses the write |
26
-
| report |`.t3/fork-sync/<tag>.json`, typed, written before any post||
26
+
| report |the main checkout's `.t3/fork-sync/<tag>.json`, typed, before any post ||
27
27
28
28
A tag the fork already sits on reports `already applied`, after closing the open sync attention issue.
29
29
`--dry-run` rebases and runs candidate CI, then stops: no trunk push, no issue, no close.
@@ -54,8 +54,9 @@ A candidate replays every fork commit, so stale-delete has nothing new to judge.
54
54
55
55
## Local trunk
56
56
57
-
A run publishes the rebased stack by force push to `origin/hyprws` under a lease; local clones see the rewrite only after `git fetch origin hyprws`.
58
-
The local `hyprws` cannot follow a rewrite: `git pull --ff-only` refuses and leaves the stale branch in place.
57
+
A run publishes the rebased stack by force push to `origin/hyprws` under a lease.
58
+
After the push, local `hyprws` moves to the new tip when it still sits at the lease and its checkout has no tracked changes (`git reset --keep`).
59
+
Otherwise the run prints why it kept the branch; `git pull --ff-only` cannot follow a rewrite.
59
60
Reset it in the canonical checkout, then rerun whatever refused:
60
61
61
62
```bash
@@ -138,7 +139,9 @@ Commit it at the tip of the kept sync worktree; a rerun on the same tag and leas
138
139
The next sync's rebase folds each fixup into its owner, and `fork:ci` proves it folds there, naming the owner when the fixup names the wrong one.
139
140
Autosquash discards a fixup's body, so a reason worth keeping goes in its own commit.
140
141
141
-
**Kept sync worktree.** Created through the `t3.json` setup step, so a stop has dependencies installed; the local gate reinstalls the frozen lockfile first, since the rebase can move it.
142
+
**Kept sync worktree.** Lives in the main checkout's `.t3/fork-sync`, whichever checkout runs the sync.
143
+
`vp run fork:sync` first waits for the invoking checkout's own setup, so a fresh lane never races its install.
144
+
Created through the `t3.json` setup step, so a stop has dependencies installed; the local gate reinstalls the frozen lockfile first, since the rebase can move it.
142
145
It carries every stop's rows between runs, so the report keeps them.
143
146
A red candidate, a green dry run, or a refused push keeps it, so its tip and tip fixups reach the next run.
144
147
A new tag or moved lease rebases from scratch, then cherry-picks the old tip commits onto it.
0 commit comments