# Multi-Server Agent Workflow ## The Problem Agents work across multiple servers (vast1, vast2, laptop, etc.) in their domain. How do we prevent branch chaos while enabling parallel development? ## The Solution: Domain Branches + Host Overlays ### 1. Default: Domain-Scoped Branches ```bash # One branch per logical change, regardless of where you work on it git checkout -b dataops/redis-cluster-optimization # Work from laptop vim cache/redis_config.py git commit -m "Optimize Redis connection pooling" # Continue from vast1 (git worktree or fresh clone) git checkout dataops/redis-cluster-optimization vim cache/performance_tuning.py git commit -m "Add memory-mapped config loading" # Push from anywhere git push origin dataops/redis-cluster-optimization ``` ### 2. Host-Specific Changes: Separate Overlay Branches ```bash # If you need different config per server git checkout -b env/host/vast1/redis-memory-limits # Only touch: overlays/production/vast1/cache_config.yaml git checkout -b env/host/vast2/redis-memory-limits # Only touch: overlays/production/vast2/cache_config.yaml ``` ### 3. Coordinated Multi-Host Rollouts ```bash # Create tracking issue first gh issue create --title "DTO Cache Upgrade Rollout" --body "..." # Stack small PRs per host git checkout -b env/host/vast1/dto-cache-upgrade git checkout -b env/host/vast2/dto-cache-upgrade git checkout -b env/host/laptop/dto-cache-upgrade # Merge queue ensures ordered deployment ``` ## Merge Queue Behavior ### Class-A (Serialized): Host Overlays ``` env/host/* → batch_size: 1, strict_order: true deployment/environments/* → batch_size: 1 ``` ### Class-B/C (Parallel): Domain Logic ``` dataops/* → batch_size: 3, if CI green aiml/* → batch_size: 3, if CI green signalcore/* → batch_size: 2, if CI green ``` ## Branch Lifecycle ### 1. Create Domain Branch ```bash # Working on DTO lineage improvements git checkout -b dataops/lineage-performance-v2 # Commit from laptop git commit -m "Add caching layer to lineage queries" # Continue from vast1 git worktree add ../dto-vast1 dataops/lineage-performance-v2 cd ../dto-vast1 git commit -m "Add production-scale test data" ``` ### 2. Extract Host-Specific Needs ```bash # Realize vast1 needs different memory limits git checkout -b env/host/vast1/lineage-memory-boost # Edit: overlays/production/vast1/lineage_config.yaml # Keep domain branch clean of host specifics git checkout dataops/lineage-performance-v2 # Continue with logic changes only ``` ### 3. Coordinate PRs ```bash # Domain change PR (can be parallel) gh pr create --title "DTO Lineage Performance V2" \ --head dataops/lineage-performance-v2 # Host overlay PR (will be serialized) gh pr create --title "Vast1: Lineage Memory Limits" \ --head env/host/vast1/lineage-memory-boost \ --label "class-a,overlay-change,host:vast1" ``` ## Labels Drive Behavior ### Required Labels ```yaml # Domain changes - domain:dataops - scope:performance - class-b # Host changes - class-a - overlay-change - host:vast1 - needs-pause # Until owner approves ``` ### CI Gate Rules ```python # Path-based routing if path.startswith('overlays/') or path.startswith('deployment/environments/'): queue_class = 'A' # Serialized require_labels = ['host:*', 'overlay-change'] if path.startswith('dataops/') and not overlay_path: queue_class = 'B' # Can batch require_validation = ['dto-schema', 'port-conflicts'] ``` ## Anti-Patterns to Avoid ### ❌ Server Names in Domain Branches ```bash # DON'T DO THIS vast1-dataops-fixes laptop-testing-branch vast2-maybe-works ``` ### ❌ Mixed Scope PRs ```bash # DON'T: Domain logic + host config in one PR dataops/cache-upgrade-plus-vast1-config # DO: Split into separate PRs dataops/cache-upgrade env/host/vast1/cache-config-update ``` ### ❌ Multi-Host Overlay PRs ```bash # DON'T: Touch multiple hosts in one PR env/host/all-hosts/memory-increase # DO: One host per PR env/host/vast1/memory-increase env/host/vast2/memory-increase ``` ## Real Example: Syncthing Bandwidth Limits ### Scenario You're on laptop, need to update Syncthing config across vast1 and vast2 with different bandwidth limits. ### Execution ```bash # 1. Create domain branch for the feature git checkout -b dataops/syncthing-adaptive-bandwidth # 2. Work on core logic (from laptop) vim integrations/syncthing_client.py git commit -m "Add adaptive bandwidth calculation" # 3. Test on vast1 git worktree add ../dto-vast1 dataops/syncthing-adaptive-bandwidth cd ../dto-vast1 # Test, iterate, commit improvements # 4. Create host-specific overlays git checkout -b env/host/vast1/syncthing-bandwidth-100mb vim overlays/production/vast1/syncthing_config.yaml git commit -m "Set vast1 bandwidth limit to 100MB/s" git checkout -b env/host/vast2/syncthing-bandwidth-50mb vim overlays/production/vast2/syncthing_config.yaml git commit -m "Set vast2 bandwidth limit to 50MB/s" # 5. Create coordinated PRs gh pr create --head dataops/syncthing-adaptive-bandwidth \ --title "Syncthing Adaptive Bandwidth Algorithm" gh pr create --head env/host/vast1/syncthing-bandwidth-100mb \ --title "Vast1: Syncthing 100MB/s limit" \ --label "class-a,overlay-change,host:vast1" gh pr create --head env/host/vast2/syncthing-bandwidth-50mb \ --title "Vast2: Syncthing 50MB/s limit" \ --label "class-a,overlay-change,host:vast2" ``` ### Merge Order 1. Domain PR merges first (or in parallel with others) 2. Host overlays merge one at a time via Class-A queue 3. Deployment happens in controlled sequence ## Tool Support ### Git Worktree for Multi-Server ```bash # Set up parallel workspaces git worktree add ../dto-laptop main git worktree add ../dto-vast1 main git worktree add ../dto-vast2 main # Work on same branch from different servers cd ../dto-vast1 && git checkout dataops/my-feature cd ../dto-vast2 && git checkout dataops/my-feature ``` ### Branch Cleanup Automation ```bash # Auto-delete merged branches git config --global branch.autosetupmerge always git config --global branch.autosetuprebase always # Cleanup script ./scripts/cleanup-merged-branches.sh ``` ## Summary - **Branch by domain/feature, not by server** - **Use overlays for host-specific configuration** - **Labels and paths drive merge queue behavior** - **One logical change = one branch, regardless of where you work** - **Host overlays get serialized; domain logic can be parallel** - **Git worktree lets you work the same branch from multiple servers** This keeps the history clean, enables parallel work, and ensures safe deployment across your infrastructure. --- *Generated by DTO Platform Team - Multi-Server Workflow Standards*