Skip to content

Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.

docs: add dependency-vs-ci-sweeper-collision failure story #230 (#257)

Muhammad Zeshan Malika9f61fcf1e78
diff --git a/STATE.md b/STATE.md
index e1aacde..49532c2 100644
--- a/STATE.md
+++ b/STATE.md
@@ -10,7 +10,6 @@ Last run: 2026-07-13T07:07:30Z (automated daily-triage workflow)
## Watch List
-- Expand contributor failure stories (dependency sweeper, multi-loop).
- Collect a production story for Post-Merge Cleanup.
- Validate `loop-init` scaffolds on fresh projects across all patterns.
diff --git a/docs/multi-loop.md b/docs/multi-loop.md
index d929b1d..1832031 100644
--- a/docs/multi-loop.md
+++ b/docs/multi-loop.md
@@ -70,4 +70,4 @@ Use a shared section in `STATE.md`:
Add CI Sweeper only after PR Babysitter attempt limits and verifier are proven for two weeks.
-See [stories/multi-loop-collision.md](../stories/multi-loop-collision.md) for a real collision story.
\ No newline at end of file
+See [stories/multi-loop-collision.md](../stories/multi-loop-collision.md) and [stories/dependency-vs-ci-sweeper-collision.md](../stories/dependency-vs-ci-sweeper-collision.md) for real-world collision stories.
\ No newline at end of file
diff --git a/stories/README.md b/stories/README.md
index 009fda2..6ae73e0 100644
--- a/stories/README.md
+++ b/stories/README.md
@@ -9,6 +9,7 @@ Real-world loop engineering — including failures. Contribute yours via [CONTRI
| [why-we-killed-ci-sweeper.md](./why-we-killed-ci-sweeper.md) | CI Sweeper | Budget, branch allowlist, kill switch |
| [dependency-sweeper-week-one.md](./dependency-sweeper-week-one.md) | Dependency Sweeper | Verifier must match CI install path |
| [multi-loop-collision.md](./multi-loop-collision.md) | Multi-loop | Branch lock + collision detection |
+| [dependency-vs-ci-sweeper-collision.md](./dependency-vs-ci-sweeper-collision.md) | Multi-loop | Pre-flight CI checks + priority locks |
| [l1-to-l2-graduation.md](./l1-to-l2-graduation.md) | Daily Triage | Calibration before auto-fix |
| [changelog-drafter-week-one.md](./changelog-drafter-week-one.md) | Changelog Drafter | Low-risk, high-ROI L1 win |
| [post-merge-cleanup-honest-win.md](./post-merge-cleanup-honest-win.md) | Post-Merge Cleanup | Off-peak cadence; verifier caught doc/API drift; bot-merge noise |
diff --git a/stories/dependency-vs-ci-sweeper-collision.md b/stories/dependency-vs-ci-sweeper-collision.md
new file mode 100644
index 0000000..1fc6d58
--- /dev/null
+++ b/stories/dependency-vs-ci-sweeper-collision.md
@@ -0,0 +1,31 @@
+# Multi-Loop Priority Collision — Dependency Sweeper vs CI Sweeper
+
+## Setup
+
+- **CI Sweeper**: `/loop 15m` (active hours) on red main
+- **Dependency Sweeper**: `/loop 6h`
+- **Shared Environment**: `main` branch and active CI runs
+
+## What Worked
+
+- CI Sweeper correctly picked up a test regression on `main` caused by an API contract change.
+- Dependency Sweeper correctly identified out-of-date patch dependencies.
+
+## What Broke
+
+- **Branch and CI Collision**: While CI Sweeper was running fix attempts on `main`, Dependency Sweeper kicked off its scheduled run and merged a "safe" minor dependency update directly to `main` without checking if `main` was already red.
+- **Budget Exhaustion**: This dependency update introduced a transitive regression, which broke additional tests. CI Sweeper, unaware of the dependency shift, continued trying to fix the original bug in a newly-broken environment, burning through the remaining daily token budget (~1.5M tokens) in under an hour.
+- **State File Conflict**: Both loops attempted to write to `loop-run-log.md` at the same time, leading to git push failures and lock retries that delayed human intervention.
+
+## Metrics
+
+| Metric | Value |
+|--------|-------|
+| Wasted tokens | ~1.5M |
+| Conflicting commits | 4 |
+| Human hours to debug | 3 hours |
+| Root cause | Dependency Sweeper ignored red CI status |
+
+## Lesson
+
+Never run low-priority mutation loops when high-priority fixes are active. We adjusted [multi-loop.md](../docs/multi-loop.md) to define a strict priority stack. Dependency Sweeper now runs a pre-flight check: it reads `ci-sweeper-state.md` and checks if `main` CI is green; if not, it skips execution and schedules a retry in 2 hours. We also added staggered cron execution schedules to prevent state file write collisions.