Skip to content
Skill

Deploy from stale worktree silent rollback

Diagnoses Cloud Run or Docker deploys that silently ship stale code from an old checkout

Deploy from stale worktree silent rollback is an open-source agent skill for cloud and infrastructure. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
5
Last commit
License
MIT
Listing updated

Similar skills

About Deploy from stale worktree silent rollback

This skill helps an agent investigate a production regression where a freshly deployed Cloud Run or Docker image lacks recently merged fixes. It walks through identifying the serving revision and its Cloud Build source tarball, unpacking that tarball, and byte-comparing files against git history and local worktrees to find which checkout the deploy actually read from.

The skill also covers a pre-deploy preflight run from the deploy directory: fetching origin, reading the branch line of git status, checking ahead and behind counts, confirming the working tree is clean, and verifying that HEAD actually advanced after a pull. It describes a silent failure mode where a stale index lock leaves the tree at an old commit while pull output appears successful.

Fixes covered include an instant traffic switch to a known-good revision and a rebuild from a current main checkout, plus a guard snippet for deploy scripts and a verification step that greps the new build's tarball. It expects gcloud and git access to the project, and examples are written for shell use.

When your agent uses it

Diagnose "I deployed a new Cloud Run / Docker image but a bunch of recently merged fixes regressed in production." Use when: (1) the deploy script does `gcloud builds submit ... "${SCRIPT_DIR}"` or `docker build <dir>` (build context = local filesystem, NOT a git ref), (2) the user has many git worktrees / multiple checkouts of the same repo, (3) the user reports "redeployed but the fix from PR #X isn't live" or "lots of fixes regressed after my deploy", (4) the deployed revision created at time T was authored by the user themselves (not CI). Root cause: deploy was run from a worktree whose HEAD predates the merged PRs; the build packaged stale local files, silently rolling back N commits worth of merged fixes. Provides the authoritative diagnostic (download Cloud Build source tarball + byte-diff against git history to identify the source commit) and the fix (rebuild from current main checkout, or instant traffic-switch rollback to the last known-good revision). v1.1 adds a pre-deploy preflight (5 lines from

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (21 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the agent-traffic-control plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-control

Or copy only this skill to ~/.claude/skills/deploy-from-stale-worktree-silent-rollback:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/deploy-from-stale-worktree-silent-rollback &&
cp -R "$tmp/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback" ~/.claude/skills/deploy-from-stale-worktree-silent-rollback &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/deploy-from-stale-worktree-silent-rollback inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/deploy-from-stale-worktree-silent-rollback to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/deploy-from-stale-worktree-silent-rollback &&
cp -R "$tmp/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback" ~/.agents/skills/deploy-from-stale-worktree-silent-rollback &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/deploy-from-stale-worktree-silent-rollback inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/deploy-from-stale-worktree-silent-rollback to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/deploy-from-stale-worktree-silent-rollback &&
cp -R "$tmp/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback" ~/.cursor/skills/deploy-from-stale-worktree-silent-rollback &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/deploy-from-stale-worktree-silent-rollback inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback

Or copy the folder to ~/.gemini/skills/deploy-from-stale-worktree-silent-rollback yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/deploy-from-stale-worktree-silent-rollback:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/deploy-from-stale-worktree-silent-rollback &&
cp -R "$tmp/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback" ~/.copilot/skills/deploy-from-stale-worktree-silent-rollback &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/deploy-from-stale-worktree-silent-rollback inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git

Then copy agent-traffic-control/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback into your agent's skills folder as deploy-from-stale-worktree-silent-rollback. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Revision and build tracing
Finds the serving Cloud Run revision and the Cloud Build job and source archive behind it.
Source tarball comparison
Unpacks the build source and matches deployed files against commits in git history.
Stale worktree detection
Locates which local checkout or worktree matched the deployed files and how far behind it was.
Pre-deploy branch preflight
Checks branch, ahead and behind counts, and uncommitted changes before a build runs.
Silent pull detection
Catches cases where a pull reports an update but HEAD and the files did not move.
Rollback and rebuild steps
Offers an instant traffic switch to a prior revision or a clean rebuild from main.

Good for

  • Find out why a redeployed Cloud Run service is missing fixes that were merged to main
  • Check whether the current deploy directory is up to date with origin/main before building
  • Roll Cloud Run traffic back to the last working revision
  • Add a guard to a deploy script that refuses to ship from a non-main or behind checkout
  • Verify that a new build's source archive contains a specific fix

Deploy from stale worktree silent rollback FAQ

When does Deploy from stale worktree silent rollback trigger?

It is meant for cases where a deploy script builds from a local directory rather than a git ref, the user has several checkouts of the same repo, and a redeploy seems to have reverted recently merged fixes.

What tools does Deploy from stale worktree silent rollback need?

It relies on gcloud commands for Cloud Run and Cloud Build, git, and standard shell tools such as tar, grep and diff. The skill itself has no bundled scripts; its commands are written inline in SKILL.md.

Does Deploy from stale worktree silent rollback change anything automatically?

No. It provides diagnostic commands and recommended fixes such as traffic switching, checkout changes and a deploy script guard, which the user runs themselves.

Which platforms does Deploy from stale worktree silent rollback support?

The content does not tie it to a specific client, so it follows the shared agent skills format.

How do I install Deploy from stale worktree silent rollback in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/deploy-from-stale-worktree-silent-rollback to use it in all your projects, or to .claude/skills/deploy-from-stale-worktree-silent-rollback in one project. Or install the agent-traffic-control plugin, which includes it: /plugin marketplace add wan-huiyan/agent-traffic-control, then /plugin install agent-traffic-control@wan-huiyan-agent-traffic-control.

Does Deploy from stale worktree silent rollback run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Deploy from stale worktree silent rollback?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Deploy from stale worktree silent rollback?

The closest alternatives to Deploy from stale worktree silent rollback are Vibe safe deploy, Flask debug cross worktree edit stale, Cloudflare pages stale assets, Gem devops guidelines and Git worktree.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from wan-huiyan/agent-traffic-control