open-swe/docs/upstream-sync/cherry-pick-runbook.md
Adam Moussa 589cd236c6
chore: cherry-pick clean upstream fixes + cherry-pick runbook (#117)
* fix: make plan view mobile friendly (#1636)

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit 7ee3e05724)

* fix: return to thread after plan approval (#1637)

Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit f32e492ab4)

* feat: reviews block agenda, sticky headers, accurate diff scroll (#1653)

Rework the AI-sorted blocks experience on the PR reviews page into a
Google-Docs-style outline: the left sidebar is now a clean number+title
agenda with scroll-spy highlighting of the active block; each block shows
its title + description (sticky) above its diff; and diff rows are pinned to
a uniform height so scroll-to lands precisely via the virtualizer's own
geometry instead of an estimate-driven correction loop.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit 0b76afdc955e33805c7623d1502a75a9c7c9c1b7)

* fix: jump + ResizeObserver settle for review scroll-to (#1655)

Replace smooth-scroll plus frame-count correction loops on the PR
reviews page with an instant jump that re-asserts its target via a
ResizeObserver (the real "layout settled" signal). Block/file
navigation and finding/comment centering now land deterministically as
off-screen cards mount, files expand, and annotation cards measure,
instead of racing a smooth-scroll animation against height
reconciliation. Holds bail on user wheel/touch input and after a short
ceiling, and a new navigation cancels the previous hold.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Johannes du Plessis <johannes@langchain.dev>
(cherry picked from commit 7530653bba7774d66a54b8bef0d2bbc25f519942)

* fix: purge expired thread_wakeup crons (#1656)

* fix: purge expired thread_wakeup crons

One-shot wakeup crons set an end_time that stops re-firing but the cron
row is never deleted, so dead rows accumulate (86 in prod). Add a purge
that deletes thread_wakeup crons past their end_time, called
opportunistically before scheduling a new wakeup, plus a one-time
backfill script. Conservative: matches only kind=thread_wakeup with a
past end_time.

* chore: retrigger Open SWE review

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit 9e5a1924ef306269322c31342a1831e57831cfee)

* fix: add top padding to sticky review block header (#1660)

* fix: add top padding to sticky review block header

The sticky per-block header on the reviews page had padding below but
none above, so the block number badge sat glued against the top edge
when pinned. Add matching top padding for breathing room.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

* chore: use py-2 shorthand for review block header padding

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit 23bd4a63fc5ba0fe853babf79ed33feb866cc8b2)

* fix: use global tokens for sidebar filter popover border (#1661)

The filter popover renders via base-ui Menu.Portal into document.body,
outside the .agents-ui container where the --ui-* CSS variables are
scoped. As a result border-[var(--ui-border)] resolved to an undefined
variable and border-color fell back to currentColor, producing a strong
near-black border (separators/hover/labels were similarly off).

Switch the portaled popup styling to the same global shadcn tokens the
theme/settings popover (SidebarUserMenu) already uses (border-border,
bg-border, bg-muted, text-muted-foreground). These are defined at :root
so they resolve inside portals too, and match the settings popover.

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit 63eb9a08209f683016abf01cdcc548bc5905f158)

* fix: preserve dashboard redirect after login (#1668)

* fix: preserve dashboard redirect after login

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

* test: cover plan login redirect in e2e

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>

---------

Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit bc7ce59169b5350da7286164afb83a7b037b528d)

* Disable React StrictMode (#1654)

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
(cherry picked from commit 6575c327a3ac2b107a6e79a04fa61168d779dbf0)

* docs(upstream-sync): add cherry-pick runbook

Repo-specific runbook for bringing upstream (langchain-ai/open-swe) commits
into the fork: triage-sync discovery, the git cp workflow, the triage ledger,
themed-branch layout, and conflict/regression handling.

---------

Co-authored-by: Johannes du Plessis <johannes@langchain.dev>
Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Ramon Nogueira <ramon.nogueira@langchain.dev>
Co-authored-by: Ramon Nogueira <270434257+ramon-langchain@users.noreply.github.com>
Co-authored-by: Caroline di Vittorio <43390382+carolinedivittorio@users.noreply.github.com>
2026-07-03 11:48:40 -04:00

4.7 KiB

Cherry-picking upstream into the fork

This repository is a long-lived fork of langchain-ai/open-swe (git remote upstream). Upstream changes are brought in one commit at a time with git cherry-pick, and every diverged commit is tracked in a triage ledger so a decision is made once and not revisited. dev is the integration branch; the broader strategy lives in the fork-maintenance section of CLAUDE.md.

Setup (once per clone)

make install-hooks

Installs the triage hooks and the git cp alias by pointing core.hooksPath at .githooks/. Because that shadows the machine-global hook directory (~/.config/git/hooks, which holds the mandatory security pre-push), .githooks/pre-push is a shim that re-execs the global hook, and the installer verifies that delegation before it changes anything. git never auto-adopts a repository's core.hooksPath, so this step cannot be skipped.

Note: core.hooksPath applies repo-wide, but .githooks/ is a tracked directory. The hooks (and the security shim) only run on branches that actually contain .githooks/. Keep it present on dev and main so no branch loses the security pre-push.

Finding what to pick

make triage-sync    # git fetch upstream, then append new dev..upstream/main commits
                    # to the ledger as `untriaged` (PR # + subject parsed from each)

triage-sync is the discovery step: it records every diverged commit as untriaged and bumps "Last synced" to the new upstream/main tip. Triage those rows (decide deferred / wont-merge and which branch), then pick the ones you want. The underlying views if you prefer raw git:

git fetch upstream
git log --oneline --no-merges dev..upstream/main   # everything diverged
git show <sha>                                      # inspect before deciding

Cross-check candidates against the ledger first — most diverged commits already carry a decision (already-in-dev, regression, deferred, or landed) and should not be re-examined.

Bringing in commits: git cp

git cp -x <sha>              # pre-check the ledger, cherry-pick -x, auto-reconcile
git cp -x <sha1> <sha2> ...  # several, applied in the given order
git cp --continue            # after resolving a conflict; also reconciles
git cp --force <sha>         # override a SHA the ledger marks "Won't merge"

git cp reads docs/upstream-sync/triage.jsonl before touching the tree and refuses a known-reject SHA (override with --force). On success it runs make triage-reconcile, which moves each applied SHA to Landed in the ledger and stages triage.jsonl + triage.md for you to commit.

Apply commits in upstream chronological order (oldest first), not the order you happen to list them — a later commit often depends on an earlier one, and out-of-order picks conflict needlessly:

git log --reverse --topo-order --format=%h dev..upstream/main

The triage ledger

docs/upstream-sync/triage.jsonl is the source of truth: one JSON row per upstream SHA, keyed on the SHA (stable, unlike the local SHAs cherry-pick rewrites). docs/upstream-sync/triage.md is generated from it and must not be hand-edited. Dispositions are landed, wont-merge, deferred, untriaged.

scripts/triage.py set <sha> --disposition deferred --branch slack-tooling --reason "..."
make triage-render      # regenerate triage.md from the jsonl
make triage-check       # CI gate: fail if triage.md is stale

A SHA marked wont-merge is hard-blocked by both git cp and the prepare-commit-msg hook. Override for a one-off re-evaluation with git cp --force, SH_CHERRYPICK_ALLOW_REJECT=1, or git config sh.cherrypick.blockRejects false.

Branch layout

Never cherry-pick onto dev directly. Work on a themed branch off dev and open a PR into dev; the ledger's branch column records where each deferred commit is meant to land (for example slack-tooling, gateway-routing, plan-approval, durable-dispatch). Keep each PR to one theme so conflict resolution stays within one subsystem.

Raw git cherry-pick

The hooks fire on a plain git cherry-pick -x <sha> too: post-commit journals each applied pick and prepare-commit-msg blocks known-rejects. Run make triage-reconcile once at the end to land the picks in the ledger, then commit triage.jsonl + triage.md.

Conflicts

# resolve the files, then:
git add <files>
git cherry-pick --continue    # or: git cp --continue
git cherry-pick --abort       # bail out of the whole pick
git cherry-pick --skip        # drop just this commit and continue the batch

A commit that conflicts because dev already carries a newer version of the same code is a regression, not a merge — skip it and record the decision as wont-merge in the ledger rather than forcing it in.