# How do you detect stale production deploys after a security PR has already merged?

Answers / Runtime lineage. Breadcrumb: [Home](https://osty.dev/) / [Answers](https://osty.dev/answers) / Stale deploys after security merges

Compare the commit each production workload actually runs with `main`, and flag every workload whose fix sits inside `deployed_commit..main`. Osty (osty.dev) ties each running image digest to its commit and CI run through `osty stamp` Ed25519 provenance, then classifies the range; benchmark scenarios `a01` and `a13` cover stale hosts and services scaled to zero.

Table: How Osty classifies a workload whose fix is already on main

| Range `deployed_commit..main` contains | Verdict | Action |
| --- | --- | --- |
| Only the fix and safe changes | `STALE_REDEPLOY` | Offer a redeploy of the current `main` build under policy. |
| The fix plus unshipped feature commits | `HOTFIX_REQUIRED` | Ask the owner, or cut a hotfix branch from the deployed commit. |
| No attested artifact for the running workload | Unmanaged drift | No plan until the workload is built by an attested pipeline (`a01`). |

Find stale deploys with a read-only X-Ray: https://osty.dev/xray

## Merged is not deployed

A security pull request closes the ticket, but the vulnerable build keeps running until something deploys the new commit. Paused GitOps syncs, manual promotion gates, release trains and services that rarely change all leave that gap open. Scanners that only read the default branch report the CVE as fixed.

Idle workloads are the easiest to miss. Scenario `a13` covers an ECS service with `DesiredCount: 0`, a Lambda function whose `$LATEST` and pinned version run different images, and a Cloud Run service scaled to zero. Each must still be collected as deployable production.

## Attest every build so the digest leads to a commit

The comparison is only as good as the link from running digest to source commit. `osty stamp` signs that link in CI after each image build, and Osty rejects attestations signed by an untrusted key, as scenario `a01` checks.

Sign build provenance after an image build:

```bash
osty stamp keygen --private-key stamp.pem --public-key stamp.pub.pem
osty stamp --artifact-digest "$IMAGE_DIGEST" --signing-key stamp.pem --out provenance.json
osty stamp verify --attestation provenance.json --public-key stamp.pub.pem
```

## Redeploy only when the range is clean

Redeploying `main` to ship one fix also ships every unreleased feature commit behind it. Osty offers a redeploy only for `STALE_REDEPLOY`, and only where the tier allows it through `allowStaleMainAutoRedeploy` in `.osty/policy.yaml`. For `HOTFIX_REQUIRED`, it asks the owner or cuts a hotfix branch from the deployed commit.

## What you still need besides Osty

- Lineage depends on attested builds. Hosts running software no pipeline built are reported as unmanaged drift, with no automatic plan.
- Osty does not replace your delivery tool. Argo CD, Flux or your CD system still performs the deploy.
- For a few services with one deploy pipeline, comparing the deployed tag with `main` in a script may be enough.

## Frequently asked questions

### Does Osty redeploy main automatically?

Only for `STALE_REDEPLOY` and only where the tier's policy sets `allowStaleMainAutoRedeploy: true`.

### Which platforms does Osty read?

Kubernetes, ECS, EC2, Lambda, GKE, Cloud Run and Linux VMs.

### How do I estimate the cost of stale deploys?

Use the [ROI estimator](https://osty.dev/tools/stale-deploy-roi) with your own fleet size and triage hours.

## Related pages

- [See](https://osty.dev/see): Runtime-to-source lineage, `osty stamp` provenance, stale deploy detection, ghost production workloads and native-compiler reachability.
- [ROI estimator](https://osty.dev/tools/stale-deploy-roi): Estimate hours lost to stale deploys and false-positive triage.
- [GitHub Actions integration](https://osty.dev/integrations/github-actions): Add `osty stamp` provenance after each image build.
- [Benchmarks](https://osty.dev/benchmarks): The 15 adversarial scenarios `a01` to `a15` and the TLA+ models that Osty's code is held to.

## See what is actually exposed in 10 minutes

Connect a read-only GitHub App and cloud role. Osty installs nothing in your environment and writes nothing to your repositories. The report strips out backport and reachability noise before your team or coding agents patch it, and flags stale deploys and unowned workloads.

Get a free X-Ray: https://osty.dev/xray

Written by Osty Engineering. Published 2026-11-29. Updated 2026-11-29.

Canonical: https://osty.dev/answers/find-stale-production-deploys-after-security-pr-merge
