Skip to main content

🛠️ Self-Healing & Repair

Algorithmic trading environments must be resilient and self-healing. If you experience deployment failures, database routing discrepancies, expired authentication tokens, or missing git submodules, the Hoox CLI features a dedicated hoox repair command group designed to diagnose issues, check infrastructure status, and recover your workspace automatically.

1. Running the 5-Step System Diagnostics

If your trading gateway throws errors or the dashboard reports connection issues, run a comprehensive diagnostic sweep:
The diagnostics engine runs a strict, sequential analysis of your entire monorepo environment. Each of the 5 steps completes and reports back:
  • Submodule Integrity (verify all 9 workers are cloned)
  • Dependency Resolution (verify bun workspaces)
  • TypeScript Type Safety (run tsc —noEmit)
  • Cloudflare Edge Bindings (verify D1, KV, R2, Queues)
  • Hardware Secrets Validation (verify API keys are bound)

2. Targeted Component Repairs

If a diagnostic check fails, you do not need to redeploy the entire stack. You can run highly targeted repairs:

Repair Command Quick Reference


3. Full System Interactive Rebuild

In the event of a catastrophic system failure, execute a full interactive self-healing rebuild:

The Rebuild Sequence

When triggered, the CLI walks you through a structured recovery protocol:
  • Phase 1 — D1 Database Backup: Exports current ledger to backups/recovery-pre-rebuild.sql.
  • Phase 2 — Infrastructure Tear-Down: Deletes corrupted D1, KV, and Queue instances.
  • Phase 3 — Fresh Provisioning: Recreates all database tables and config buckets on Cloudflare.
  • Phase 4 — Sequenced Redeployment: Re-compiles and deploys all 9 edge workers in correct dependency order.
  • Phase 5 — Database Seeding: Restores backup SQL data and re-applies schema migrations.
  • Phase 6 — KV Sync: Applies the 16-key configuration manifest defaults.
The hoox repair rebuild command performs destructive resets on D1 and KV instances. Ensure you carefully read the interactive prompts and confirm database backup completion before letting the script proceed!

4. Common Troubleshooting Scenarios


5. Emergency Decision Tree


Pro Tips

  • Scheduled Health Checks: Set up a cron job to run hoox repair check daily and email yourself the results.
  • Pre-Deploy Checklist: Always run hoox repair check and hoox test before deploying to production.
  • Secrets Rotation: Rotate exchange API keys quarterly. Use hoox secrets set to update — no redeployment needed.

🔗 Next Steps

Last modified on July 18, 2026