# Deploy from stale worktree silent rollback

> Deploy from stale worktree silent rollback is an open-source agent skill for cloud and infrastructure. Diagnoses Cloud Run or Docker deploys that silently ship stale code from an old checkout. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/wan-huiyan/agent-traffic-control/tree/main/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback
- **Repository:** https://github.com/wan-huiyan/agent-traffic-control
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** deploy-from-stale-worktree-silent-rollback
- **Collection:** https://github.com/wan-huiyan/agent-traffic-control
- **Categories:** [cloud and infrastructure](https://ai-powered.com/categories/cloud-and-infrastructure), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

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

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback)
- [License: MIT](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/deploy-from-stale-worktree-silent-rollback)

## Features

- **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

## Install

### Claude Code

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):

```sh
/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`:

```sh
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.

### Codex

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

```sh
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.

### Cursor

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

```sh
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.

### Gemini CLI

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

```sh
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.

### VS Code

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

```sh
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.

### Other agents

Get the folder:

```sh
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.

## 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.

## Alternatives

- [Vibe safe deploy](https://ai-powered.com/skills/vibe-safe-deploy): Vibe safe deploy is an open-source agent skill for cloud and infrastructure.
- [Flask debug cross worktree edit stale](https://ai-powered.com/skills/flask-debug-cross-worktree-edit-stale): Flask debug cross worktree edit stale is an open-source agent skill for developer tools.
- [Cloudflare pages stale assets](https://ai-powered.com/skills/cloudflare-pages-stale-assets): Cloudflare pages stale assets is an open-source agent skill for cloud and infrastructure.
- [Gem devops guidelines](https://ai-powered.com/skills/gem-devops-guidelines): Gem devops guidelines is an open-source agent skill for cloud and infrastructure.
- [Git worktree](https://ai-powered.com/skills/git-worktree): Git worktree is an open-source agent skill for developer tools.
- [Shipping and launch](https://ai-powered.com/skills/shipping-and-launch): Shipping and launch is an open-source agent skill for cloud and infrastructure.
- [Deploy runbook](https://ai-powered.com/skills/deploy-runbook): Deploy runbook is an open-source agent skill for developer tools.
- [Debugging and error recovery](https://ai-powered.com/skills/debugging-and-error-recovery): Debugging and error recovery is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/deploy-from-stale-worktree-silent-rollback
