electron-chromium-upgrade
Original:🇺🇸 English
Translated
Guide for performing Chromium version upgrades in the Electron project. Use when working on the roller/chromium/main branch to fix patch conflicts during `e sync --3`. Covers the patch application workflow, conflict resolution, analyzing upstream Chromium changes, and proper commit formatting for patch fixes.
1installs
Sourceelectron/electron
Added on
NPX Install
npx skill4agent add electron/electron electron-chromium-upgradeTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Electron Chromium Upgrade: Phase One
Summary
Run repeatedly, fixing patch conflicts as they arise, until it succeeds. Then run and commit changes atomically.
e sync --3e patches allSuccess Criteria
Phase One is complete when:
- exits with code 0 (no patch failures)
e sync --3 - has been run to export all changes
e patches all - All changes are committed per the commit guidelines below
Do not stop until these criteria are met.
CRITICAL Do not delete or skip patches unless 100% certain the patch is no longer needed. Complicated conflicts or hard to resolve issues should be presented to the user after you have exhausted all other options. Do not delete the patch just because you can't solve it.
Context
The branch is created by automation to update Electron's Chromium dependency SHA. No work has been done to handle breaking changes between the old and new versions.
roller/chromium/mainKey directories:
- Current directory: Electron repo (always run commands here)
e - (parent): Chromium repo (where most patches apply)
.. - : Patch files organized by target
patches/ - : Patch system documentation
docs/development/patches.md
Workflow
- Delete the in both the
.git/rr-cacheandelectronfolder to ensure no accidental rerere replays occur from before this upgrade phase attempt started.. - Run (the
e sync --3flag enables 3-way merge, always required)--3 - If succeeds → skip to step 6
- If patch fails:
- Identify target repo and patch from error output
- Analyze failure (see references/patch-analysis.md)
- Fix conflict in target repo's working directory
- Run in affected repo
git am --continue - Repeat until all patches for that repo apply
- IMPORTANT: Once succeeds you MUST run
git am --continueto export fixese patches {target} - Return to step 1
- When succeeds, run
e sync --3e patches all - Read NOW, then commit changes following those instructions exactly.
references/phase-one-commit-guidelines.md
Before committing any Phase One changes, you MUST read and follow its instructions exactly.
references/phase-one-commit-guidelines.mdCommands Reference
| Command | Purpose |
|---|---|
| Clone deps and apply patches with 3-way merge |
| Continue after resolving conflict (run in target repo) |
| Export commits from target repo to patch files |
| Export all patches from all targets |
| List targets and config paths |
Patch System Mental Model
patches/{target}/*.patch → [e sync --3] → target repo commits
← [e patches] ←When to Edit Patches
| Situation | Action |
|---|---|
During active | Fix in target repo, then |
| Modifying patch outside conflict | Edit |
| Creating new patch (rare, avoid) | Commit in target repo, then |
Fix existing patches 99% of the time rather than creating new ones.
Patch Fixing Rules
- Preserve authorship: Keep original author in TODO comments (from patch field)
From: - Never change TODO assignees: must retain original name
TODO(name) - Update descriptions: If upstream changed (e.g., →
DCHECK), update patch commit message to reflect current stateCHECK_IS_TEST
Final Deliverable
After Phase One, write a summary of every change: what was fixed, why, reasoning, and Chromium CL links.
Electron Chromium Upgrade: Phase Two
Summary
Run repeatedly, fixing build issues as they arise, until it succeeds. Then run to validate Electron launches and commit changes atomically.
e build -k 999e start --versionRun Phase Two immediately after Phase One is complete.
Success Criteria
Phase Two is complete when:
- exits with code 0 (no build failures)
e build -k 999 - has been run to check Electron launches
e start --version - All changes are committed per the commit guidelines below
Do not stop until these criteria are met. Do not delete code or features, never comment out code in order to take short cut. Make all existing code, logic and intention work.
Context
The branch is created by automation to update Electron's Chromium dependency SHA. No work has been done to handle breaking changes between the old and new versions. Chromium APIs frequently are renamed or refactored. In every case the code in Electron must be updated to account for the change in Chromium, strongly avoid making changes to the code in chromium to fix Electrons build.
roller/chromium/mainKey directories:
- Current directory: Electron repo (always run commands here)
e - (parent): Chromium repo (do not touch this code to fix build issues, just read it to obtain context)
..
Workflow
- Run (the
e build -k 999flag is a flag to ninja to say "do not stop until you find that many errors" it is an attempt to get as much error context as possible for each time we run build)-k 999 - If succeeds → skip to step 6
- If build fails:
- Identify underlying file in "electron" from the compilation error message
- Analyze failure
- Fix build issue by adapting Electron's code for the change in Chromium
- Run to build just the failed target we were specifically fixing
e build -t {target_that_failed}.o- You can identify the target_that_failed from the failure line in the build log. E.g. the target name is
FAILED: 2e506007-8d5d-4f38-bdd1-b5cd77999a77 "./obj/electron/chromium_src/chrome/process_singleton_posix.o" CXX obj/electron/chromium_src/chrome/process_singleton_posix.oobj/electron/chromium_src/chrome/process_singleton_posix.o
- You can identify the target_that_failed from the failure line in the build log. E.g.
- Read NOW, then commit changes following those instructions exactly.
references/phase-two-commit-guidelines.md - Return to step 1
- CRITICAL: After ANY commit (especially patch commits), immediately run in the electron repo
git status- Look for other modified files that only have index/hunk header changes
.patch - These are dependent patches affected by your fix
- Commit them immediately with:
git commit -am "chore: update patch hunk headers" - This prevents losing track of necessary updates
- Look for other modified
- Return to step 1
- When succeeds, run
e builde start --version - Check if you have any pending changes in the Chromium repo by running
git status- If you have changes follow the instructions below in "A. Patch Fixes" to correctly commit those modifications into the appropriate patch file
Before committing any Phase Two changes, you MUST read and follow its instructions exactly.
references/phase-two-commit-guidelines.mdBuild Error Detection
When monitoring output, filter for errors using this regex pattern:
error:|FAILED:|fatal:|subcommand failed|build finished
e build -k 999The build output is extremely verbose. Filtering is essential to catch errors quickly.
Commands Reference
| Command | Purpose |
|---|---|
| Builds Electron and won't stop until either all targets attempted or 999 errors found |
| Build just one specific target to verify a fix |
| Validate Electron launches after successful build |
Two Types of Build Fixes
A. Patch Fixes (for files in chromium_src or patched Chromium files)
When the error is in a file that Electron patches (check with ):
grep -l "filename" patches/chromium/*.patch- Edit the file in the Chromium source tree (e.g., )
/src/chrome/browser/... - Create a fixup commit targeting the original patch commit:
bash
cd .. # to chromium repo git add <modified-file> git commit --fixup=<original-patch-commit-hash> GIT_SEQUENCE_EDITOR=: git rebase --autosquash --autostash -i <commit>^ - Export the updated patch: e patches chromium
- Commit the updated patch file in the electron repo following the , then commit changes following those instructions exactly. READ THESE GUIDELINES BEFORE COMMITTING THESE CHANGES
references/phase-one-commit-guidelines.md
To find the original patch commit to fixup:
git log --oneline | grep -i "keyword from patch name"The base commit for rebase is the Chromium commit before patches were applied. Find it by checking the ref.
refs/patches/upstream-headB. Electron Code Fixes (for files in shell/, electron/, etc.)
When the error is in Electron's own source code:
- Edit files directly in the electron repo
- Commit directly (no patch export needed)
Dependent Patch Updates
IMPORTANT: When you modify a patch, other patches that apply to the same file may have their hunk headers invalidated. After committing a patch fix:
- Run git status in the electron repo
- Look for other modified .patch files with just index/hunk header changes
- Commit these with: git commit -m "chore: update patch hunk headers"
Critical: Read Before Committing
- Before ANY Phase One commits: Read
references/phase-one-commit-guidelines.md - Before ANY Phase Two commits: Read
references/phase-two-commit-guidelines.md
Skill Directory Structure
This skill has additional reference files in :
references/- patch-analysis.md - How to analyze patch failures
- phase-one-commit-guidelines.md - Commit format for Phase One
- phase-two-commit-guidelines.md - Commit format for Phase Two
Read these when referenced in the workflow steps.