Upstream Patches
PulumiOfficialPublished by Pulumi
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a standardized procedure for maintaining patches applied to Terraform provider submodules. It utilizes a dedicated script to handle the lifecycle of patches, including initialization, editing, rebasing, and removal. The workflow emphasizes identifying the specific owning patch before making modifications to ensure history integrity and prevent accidental regressions or duplicate patch creation.
What it does
- Initializes upstream submodules and applies existing patches.
- Provides a safe checkout environment to edit, amend, or remove specific patches.
- Supports rebasing patches onto new upstream commits.
- Facilitates the removal of entire patches or specific hunks within a patch.
- Ensures changes are correctly written back to the patch directory after editing.
- Offers recovery guidance for interrupted rebase or checkout operations.
When to use it
- When fixing regressions introduced by an existing provider patch.
- When upgrading a Terraform provider and resolving resulting patch conflicts.
- When a specific patch or hunk is no longer required and needs removal.
- When rebasing existing patches onto a newer upstream version of a provider.
Advantages
- Maintains a clean and predictable patch history.
- Prevents ephemeral changes from being lost during provider upgrades.
- Provides clear guardrails to avoid direct, unmanaged edits to submodules.
- Supports both interactive and non-interactive patch modification workflows.
Usage examples
- “I need to fix a bug in the existing provider patch that modifies the resource schema.”
- The agent will identify the owning patch, perform a checkout, apply the fix to the specific commit, and check the changes back into the patch directory.
- “Remove the patch file 0005-deprecated-feature.patch from the repository.”
- The agent will delete the specified patch file, run the check_in process to update the repository state, and verify the patch count.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/pulumi/upstream-patches/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip upstream-patches.zip -d .agents/skills
Documentation by Pulumi
Upstream Patches
upstream/ is a git submodule pointing to the upstream Terraform provider. patches/ contains patch files applied on top of it. Use ./scripts/upstream.sh to manage patch state.
Default Behavior
If fixing a regression introduced by an existing patch, amend the owning patch commit.
Do not create a new patch unless the user explicitly asks.
Commands Reference
| Command | Description |
|---|---|
./scripts/upstream.sh init | Initialize upstream and apply patches to working directory |
./scripts/upstream.sh init -f | Destructively discard checkout/rebase state and re-initialize upstream |
./scripts/upstream.sh checkout | Create branch with patches as commits for editing |
./scripts/upstream.sh rebase -i | Interactively edit patch commits |
./scripts/upstream.sh rebase -o <commit> | Rebase patches onto a new upstream commit |
./scripts/upstream.sh check_in | Write commits back to patches and exit checkout mode |
Guardrails
Never commit directly to
upstream/withoutcheckout/check_in.Direct edits under
upstream/outside checkout are ephemeral duringupgrade-provider; the tool resets submodule state.Do not hand-edit
patches/*.patchunless intentionally doing raw patch surgery.Prefer non-interactive rewrite flow over interactive rebase for agents.
Find Owning Patch First
Before editing patch content, identify the owning patch/commit.
./scripts/upstream.sh checkout
# Find candidate patch files by touched file path or unique hunk text
rg -n "path/to/file|unique_symbol" patches/*.patch
# Optional: inspect candidate patch header/hunks
sed -n '1,120p' patches/00NN-Example.patch
# Map patch file to commit in upstream checkout branch
patch=patches/00NN-Example.patch
subject=$(sed -n 's/^Subject: \[PATCH\] //p' "$patch" | head -n1)
cd upstream
git log --oneline pulumi/patch-checkout --grep "$subject"
# If needed, disambiguate by touched path
git log --oneline pulumi/patch-checkout -- path/to/file
cd ..If rg is unavailable, use grep -En for the patch search. Set target_sha to the owning commit and edit that commit, not HEAD.
Amend Existing Patch (Preferred, Non-Interactive)
./scripts/upstream.sh checkout
cd upstream
target_sha=<owning-commit-sha>
base_sha=$(git rev-parse "${target_sha}^")
tmp_branch="rewrite-${target_sha:0:8}"
# Rebuild history from parent of target commit
git checkout -b "$tmp_branch" "$base_sha"
git cherry-pick "$target_sha"
# Apply fix and amend target commit
# ...edit files...
git add <files>
git commit --amend --no-edit
# Replay remaining commits
git cherry-pick "${target_sha}..pulumi/patch-checkout"
# If cherry-pick conflicts occur:
# resolve files
# git add <resolved files>
# git cherry-pick --continue
# Move checkout branch to rewritten history
git branch -f pulumi/patch-checkout HEAD
git checkout pulumi/patch-checkout
git branch -D "$tmp_branch"
cd ..Interactive fallback:
./scripts/upstream.sh checkout
./scripts/upstream.sh rebase -i
# mark target commit as edit, amend, then continueRemove Entire Patch
Use when a patch should be deleted completely.
rm patches/00NN-Description.patch
./scripts/upstream.sh checkout
./scripts/upstream.sh check_inRemove Part of a Patch
Use when only selected hunks/files should be removed from an existing patch.
Find owning patch/commit (
target_sha) and use the amend workflow above.Revert only unwanted changes from the target commit, then amend.
Example during amend step:
cd upstream
# Restore specific docs-only files from parent of amended commit
git checkout HEAD^ -- path/to/docs-only-file path/to/another-doc-file
git add path/to/docs-only-file path/to/another-doc-file
git commit --amend --no-edit
cd ..Create New Patch (Only If Requested)
./scripts/upstream.sh checkout
cd upstream
# ...make changes...
git add <files>
git commit -m "Describe new patch"
cd ..
./scripts/upstream.sh check_inRebasing Patches to a New Upstream Version
./scripts/upstream.sh checkout
# Rebase onto the new upstream commit
./scripts/upstream.sh rebase -o <new_commit_sha>
# Resolve any conflicts that arise
# Write updated patch files
./scripts/upstream.sh check_inVerification Checklist
Before check_in:
Confirm expected patch count change (
0by default;-1for full patch removal).Confirm whether target patch should remain present (default yes) or be removed (explicit deletion case).
Confirm you are editing the owning commit, not adding a new commit by accident.
After check_in:
Verify patch count matches expectation.
Verify target patch number/purpose is still present when expected.
Verify no unexpected new
00NN-*.patchwas introduced.
Interrupted Checkout or Rebase
Preserve work by default. Inspect git -C upstream status, complete the active git am/rebase, verify that every patch was applied, and run ./scripts/upstream.sh check_in before rerunning automation. An interrupted checkout invokes git am separately for each patch, so later patch files may not have been reached.
Use ./scripts/upstream.sh init -f only when intentionally discarding all interrupted work. It can remove conflict resolution, patch commits, operation metadata, and untracked files; it is not routine recovery for a stuck checkout.
Files
- ATTRIBUTION.mdAdded by AutoGineer876 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md5.6 KiB
- agents/openai.yaml272 B
- use_cases.yaml521 B
ATTRIBUTION.md
Attribution
This folder is an unmodified copy of the Agent Skill "upstream-patches", distributed by AutoGineer (https://autogineer.com/agent-skills).
Commit: 82f222a529a499e8005a820000148cc5e28c934c
Published by: Pulumi (https://github.com/pulumi)
Publisher: Pulumi (https://github.com/pulumi)
Licence: Apache License 2.0 (https://github.com/pulumi/agent-skills/blob/82f222a529a499e8005a820000148cc5e28c934c/LICENSE)
Licence evidence: repository licence LICENSE
Retrieved: 2026-11-07
The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.
Files added by AutoGineer
ATTRIBUTION.md: this file, written by AutoGineer
LICENSE: copied from LICENSE
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Pulumi
- Publisher
- Pulumi (Official)
- Source
- pulumi/agent-skills · package-maintenance/skills/upstream-patches · commit 82f222a
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Pulumi.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download upstream-patches.zip