Production breaks at 2:47 PM on Tuesday. A customer reports a bug. Your AI system is giving wrong answers.Traditional approach:
git revert abc123 # Revert the commitgit push # Push to trigger CI/CD# Wait 5-10 minutes for deploy pipeline# Hope you reverted the right commit
Edgit approach:
# Check current deploymentedgit tag list prompts/extraction# Rollback by setting env tag to previous versionedgit tag set prompts/extraction production v1.0.0edgit push --tags --force# Under 50ms later, you're back to working version
Edgit uses a 4-level tag format: components/prompts/extraction/productionEnvironment tags (like production, staging) are mutable - they move to point at different versions. This is why you need --force when pushing: Git requires it to update remote tags that already exist.
# Current state (broken)components/prompts/extraction/production → v1.1.0# Rollback (instant)edgit tag set prompts/extraction production v1.0.0# Moves tag: components/prompts/extraction/production → v1.0.0# Push tag (--force required for mutable tags)edgit push --tags --force# GitHub Actions detects tag push and deploys# Conductor reads new version from runtime# Under 50ms globally, you're back to v1.0.0
Philosophy: Edgit creates/moves tags. GitHub Actions detects the tag push and deploys. Separation of concerns.
# View available versionsedgit tag list prompts/extraction# Shows: production → v1.1.0 (current/broken)# Shows: v1.1.0, v1.0.0, v0.9.0 available# Choose last known good version (e.g., v1.0.0)
# Rollback to last known goodedgit tag set prompts/extraction production v1.0.0# Push tags (--force required for mutable env tags)edgit push --tags --force# Verifyedgit tag list prompts/extraction# Output:# components/prompts/extraction/production → v1.0.0
# What changed between v1.0.0 and v1.1.0?git diff components/prompts/extraction/v1.0.0 components/prompts/extraction/v1.1.0# View commit messagegit show components/prompts/extraction/v1.1.0 --format=%B --no-patch
Total time: Under 2 minutes from “production is broken” to “production is fixed.”
# Only rollback the broken componentedgit tag set prompts/analysis production v1.9.0edgit push --tags --force# Keep the others# prompts/extraction still at v1.1.0# configs/validation still at v1.5.0
# What versions were deployed on Tuesday at 2:47 PM?# Use Git to find tags created around that timegit for-each-ref --sort=creatordate \ --format '%(creatordate:iso) %(refname:short)' \ refs/tags/components/ | grep "2024-11-12"# Identify versions that were active:# prompts/extraction: v1.0.5# prompts/analysis: v1.9.2# configs/validation: v1.4.0# scripts/transform: v2.1.3
Now recreate that exact state:
# Deploy to debug environmentedgit tag set prompts/extraction debug v1.0.5edgit tag set prompts/analysis debug v1.9.2edgit tag set configs/validation debug v1.4.0edgit tag set scripts/transform debug v2.1.3# Push tagsedgit push --tags --force
Test in debug environment:
curl https://debug.example.com/test \ -H "Content-Type: application/json" \ -d '{"input": "customer data from Tuesday"}'# You're now running the EXACT versions from Tuesday at 2:47 PM# Should reproduce the bug
# Test each version individually# Was it prompts/extraction v1.0.5?edgit tag set prompts/extraction debug v1.0.6 # Try next version# Test...# Was it prompts/analysis v1.9.2?edgit tag set prompts/analysis debug v1.9.3 # Try next version# Test...# Found it! prompts/analysis v1.9.2 has the bug
Now fix and deploy:
# Fix the bug in prompts/analysisvim components/prompts/analysis.md# Create new versionedgit tag create prompts/analysis v1.9.4# Test in debugedgit tag set prompts/analysis debug v1.9.4edgit push --tags --force# Verify fix...# Deploy to productionedgit tag set prompts/analysis production v1.9.4edgit push --tags --force
When: Production is on fire, customers are affected
# Don't investigate, just rollbackedgit tag set prompts/extraction production v1.0.0edgit push --tags --force# Investigate later in debug environmentedgit tag set prompts/extraction debug v1.1.0edgit push --tags --force
# Reduce canary percentage from 50% to 10%wrangler kv:key put --namespace-id=$KV_ID "rollout-percentage" "10"# Monitor error rates...# If still high, full rollbackedgit tag set prompts/extraction production v1.0.0edgit push --tags --force
# Rollback for specific regionedgit tag set prompts/extraction production-us-west v1.0.0edgit push --tags --force# Keep other regions on new versionedgit tag set prompts/extraction production-eu v1.1.0edgit tag set prompts/extraction production-asia v1.1.0edgit push --tags --force
# Document rollback commandecho "If issues: edgit tag set prompts/extraction production v1.0.0 && edgit push --tags --force" > ROLLBACK.md# Test rollback in stagingedgit tag set prompts/extraction staging v1.1.0edgit tag set prompts/extraction staging v1.0.0 # Verify rollback worksedgit push --tags --force
# During rollout, keep old version in canaryproduction: v1.0.0 # 90% trafficproduction-canary: v1.1.0 # 10% traffic# If canary has issues, just remove it (don't affect production)
- name: Deploy with Auto-Rollback run: | # Deploy new version edgit tag set prompts/extraction production v1.1.0 edgit push --tags --force # Wait for deploy sleep 60 # Check error rate ERROR_RATE=$(curl https://metrics.example.com/error-rate) if (( $(echo "$ERROR_RATE > 0.01" | bc -l) )); then echo "Error rate too high! Auto-rollback..." edgit tag set prompts/extraction production v1.0.0 edgit push --tags --force exit 1 fi
# Chaos engineering: practice rollbacks# Every month, do a surprise rollback drill# 1. Deploy test versionedgit tag set prompts/extraction production-drill v999.0.0edgit push --tags --force# 2. "Discover" the issue# 3. Practice rolling backedgit tag set prompts/extraction production-drill v1.0.0edgit push --tags --force# 4. Time how long it takes
# Find versions from yesterday 3 PM using Gitgit for-each-ref --sort=creatordate \ --format '%(creatordate:iso) %(refname:short)' \ refs/tags/components/ | grep "2024-11-11"# Identify and deploy versions that were activeedgit tag set prompts/extraction debug v1.0.4edgit tag set prompts/analysis debug v1.9.1edgit push --tags --force# Test with customer's inputcurl https://debug.example.com/test -d @customer-input.json
# Find what was deployed last weekgit for-each-ref --sort=creatordate \ --format '%(creatordate:iso) %(refname:short)' \ refs/tags/components/ | grep "2024-11-05"# Compare to current versionsedgit tag list prompts/analysis# Shows: prompts/analysis changed from v1.8.0 to v1.9.0# Test both versionsedgit tag set prompts/analysis benchmark-old v1.8.0edgit tag set prompts/analysis benchmark-new v1.9.0edgit push --tags --force# Benchmark performance difference
# Deploy both for comparisonedgit tag set prompts/extraction ab-test-a v1.5.0edgit tag set prompts/extraction ab-test-b v1.8.0edgit push --tags --force
# Full history of a component's tagsgit log --all --oneline -- 'refs/tags/components/prompts/extraction/*'# Who created v1.1.0?git show components/prompts/extraction/v1.1.0# All tags for a componentedgit tag list prompts/extraction
Git tags retain the commit history. To see what was deployed at a specific time, use Git directly:
# Find tag state at a specific dategit for-each-ref --sort=creatordate --format '%(creatordate:iso) %(refname:short)' refs/tags/components/# See all version tags for a componentgit tag -l 'components/prompts/extraction/v*'
#!/bin/bash# safe-rollback.shCOMPONENT=$1VERSION=$2ENV=$3echo "Checking if rollback is safe..."# 1. Check version existsif ! edgit tag list $COMPONENT | grep -q "$VERSION"; then echo "Version $VERSION doesn't exist" exit 1fi# 2. Check version exists in available versionsedgit tag show $COMPONENT@$VERSION > /dev/null 2>&1if [ $? -ne 0 ]; then echo "Warning: Cannot verify $VERSION details" read -p "Continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fifi# 3. Check current versionCURRENT=$(edgit tag list $COMPONENT --env $ENV)echo "Current version: $CURRENT"echo "Rolling back to: $VERSION"read -p "Confirm rollback? (y/n) " -n 1 -rechoif [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1fi# 4. Do rollbackedgit tag set $COMPONENT $ENV $VERSIONedgit push --tags --forceecho "Rolled back $COMPONENT to $VERSION in $ENV"
# Check tag was updatedgit show components/prompts/extraction/production# Should point to rollback version# Check CI/CD deployed to runtimecurl https://api.example.com/version# Should show rollback version# If using Cloudflare KV, check it was updatedwrangler kv:key get --namespace-id=$KV_ID "component-versions" | jq '.["prompts/extraction"].production'# Should show rollback version
# List all versionsedgit tag list prompts/extraction# If version was deleted, check Git historygit log --all --oneline -- components/prompts/extraction.md# Restore deleted taggit tag components/prompts/extraction/v1.0.0 <commit-hash>
# Might not be the component you think# Check all component versionsedgit tag list prompts/extractionedgit tag list prompts/analysis# Rollback multiple components if needededgit tag set prompts/extraction production v1.0.0edgit tag set prompts/analysis production v2.0.0edgit push --tags --force