r/FlutterDev • u/Spirited-Order-2671 • 2h ago
Tooling I built an open-source self-healing bot for Flutter production crashes. Would love your architectural feedback on this concept.
Hi everyone,
Like most Flutter developers, I've spent too much time dealing with the standard production incident cycle: a fatal crash gets reported in Firebase Crashlytics, you pull the stack trace, reproduce it, write a defensive fix, run tests, and push a hotfix branch.
I wanted to see if we could automate this entire triage & verification pipeline without turning it into a black-box AI mess.
So I built and open-sourced **CrashPilot**: https://pub.dev/packages/crash_pilot
### How the pipeline works:
- **Crash Ingestion:** A webhook (Firebase Cloud Function / Sentry) catches a fatal crash trace and triggers a GitHub Actions workflow (`workflow_dispatch`).
- **Dart AST Extraction:** Instead of passing entire source files to an LLM, CrashPilot parses the Dart Abstract Syntax Tree (using `package:analyzer`) to isolate the exact enclosing method and class where the crash occurred.
- **Surgical Patching:** An LLM generates a minimal 5-15 line defensive replacement.
- **CI Sandbox Verification:** The patch is applied in an isolated headless Ubuntu runner, where it executes `flutter analyze` and `flutter test`. It uses an automated reflection loop (up to 3 turns) if compilation or tests fail.
- **Automated PR:** Once verified with 0 errors and passing tests, it pushes a branch and opens a GitHub Pull Request with a regression unit test and root-cause summary.
### Where it currently stands:
- Published on pub.dev (v1.0.9) with 160/160 pub points.
- Tested end-to-end on a demo repository where it successfully created verified PRs for null-check crashes.
- Source code: https://github.com/vaibhavbadhe712/crash_pilot
- Example demo PR generated by the bot: https://github.com/vaibhavbadhe712/crash_pilot_demo/pull/2
### What I want to ask the community:
Before I spend time expanding this, I’d love your honest feedback:
- **Does this concept sound practically useful for real-world production setups, or does auto-PR generation feel too risky?**
- What edge cases should I be most concerned about? (e.g. Obfuscated traces, multi-file state management like BLoC, or bad backend payloads masquerading as client crashes?)
- What feature would you consider essential before you'd ever test this on a real app?
Thanks for any insights, criticisms, or architectural suggestions!