Safe Execution of Interdependent Core Logic (1Password B5 Case Study)
Failure modes of unguided agents on core logic
- Sequencing errors: backfilling UUID columns before updating insertion code → silent data loss in production.
- Ownership errors: treating shared DB tables as independently owned by a newly extracted microservice → deployment conflicts.
- Locally-reasonable, globally-wrong assumptions: agent assumed primary identifier format was ULID, propagated through multiple changes → entire refactoring session rolled back.
1Password B5 case study
Multi-million-line Go monolith (“B5”) refactored toward low-latency high-throughput “Unified Access” architecture.
- Extraction order matters — derived from dependency mapping (SSA analysis, SQL AST parsing, DataDog monitoring APIs): Vault first (distinct API + security boundaries), then Billing, then Authentication/Authorization; Identity remains core monolith.
- MustBegin migration: panicking
MustBeginDB transaction function → clean error-returning pattern across 3,000+ call sites.
Collaborative human-to-agent workflow (the repeatable pattern)
- Manifest generation — knowledge graph app uses SSA analysis → deterministic manifest of every target call site.
- Pattern classification — team groups call sites into a small set of structural patterns, writes explicit code template per pattern.
- Playbook specification — engineers compile detailed playbook: how executors run the migration, common failure modes, explicit stop-and-escalate rules (never guess).
- Isolated parallel execution — orchestrator launches executor agents in parallel, each in isolated Git worktree.
Result: actual migration executes in hours. Engineering time shifts from manual coding to designing analysis tools, drafting templates, configuring playbooks. Agents execute repetitive changes safely and predictably; leverage maximized.
Key principle
Deep refactoring of the 5M-LOC core is NOT “agents figure it out” — it is humans compiling deterministic manifests + templates + playbooks, agents executing under orchestration with escalation rules. Same division of labor as batch-1 finding (small reversible PRs, bounded active lanes), but sharper: determinism first, generation last.