How to use Devin to clean closed branch previews
Devin added branch provenance to preview deployments and guarded cleanup with PR-state rechecks, keeping ambiguous or newly deployed resources before merge.
Suggested prompt
Suggested prompt written by Agents In Use, not the source author. Replace bracketed inputs and review tool permissions first.
Add source-branch provenance to preview deployments and plan cleanup only for unambiguously owned previews whose related PRs all closed after deployment. Preserve reopened PRs, main previews, active deploys, and ambiguous histories. Recheck PR and deployment state immediately before deletion, retain caps/time budgets, and leave untraceable historical resources for manual review.
Reach people exploring AI agents
See placements →What happened
Source-aware preview cleanup merged with ownership guards and last-minute PR/deployment checks; historical untraceable previews required manual cleanup.
Reported by devin-ai-integration[bot] on GitHubHow the agent did it
- The agent added source-branch provenance to preview workflow run names.
- It planned deletions only for unambiguously owned previews whose PRs all closed later.
- It rechecked PR and deployment state immediately before resource cleanup.
Where a person stepped in
The public PR records task constraints and automated review or checks. Its recorded merger is a bot account; a named human final approval is not established.
Devin changed Kody's preview cleanup after live branch previews accumulated and exhausted Cloudflare Durable Object namespace capacity. The existing sweep only removed a branch preview once its Worker disappeared, so a still-running preview could survive after every associated pull request had closed.
The patch made workflow run names record the source branch and taught the sweep to recover that ownership. It kept a preview whenever ownership was ambiguous, a deployment was still running or the branch had no associated PR. A preview qualified for deletion only when all source-branch PRs were closed and their final closure followed its deployment.
Before deleting, the tool checked PR state again and looked for a newly started deployment. Cleanup retained the existing resource-removal path, per-run cap and time budget. Tests covered reopened PRs, main-branch previews, deployment ordering and conflicting run histories.
Older previews without the new provenance were removed manually; main-branch expiry remained a separate decision. The PR merged through kody-bot on October 14 after reported checks. Its result is a guarded cleanup policy for newly traceable branch previews, not proof that every historical or main-branch preview now expires automatically.
Prompt
Suggested prompt (written by Agents In Use, not the author's)
Source: GitHub · devin-ai-integration[bot]
Frequently asked questions
Why were live previews accumulating?
The old sweep waited for their Workers to disappear before considering cleanup.
What happens with ambiguous ownership?
The preview is kept rather than guessed to be stale.
Were historical previews automatically fixed?
Older previews lacking provenance were cleaned manually.
More details
About this account
The patch made workflow run names record the source branch and taught the sweep to recover that ownership. It kept a preview whenever ownership was ambiguous, a deployment was still running or the branch had no associated PR. A preview qualified for deletion only when all source-branch PRs were closed and their final closure followed its deployment.
Primary agent-authored PR and public API opened. Results and checks are reported by the PR, not independently reproduced. Bot merge is not evidence of human review. Prompt is suggested by Agents In Use, not a quoted original.
Credit: devin-ai-integration[bot] on GitHub
Source published 14 Oct 2026
Source checked 14 Oct 2026
Tools and topics
Devin · GitHub · Cloudflare Workers
Repository maintenance · Recorded checks
Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.