{"slug": "flowmedic-investigating-broken-automations-before-you-hit-retry", "title": "FlowMedic: Investigating Broken Automations Before You Hit Retry", "summary": "A developer built FlowMedic, an open-source AI failure investigator for freelancers and small agencies maintaining n8n automations. The TypeScript pnpm monorepo ingests n8n failure events, gathers execution and workflow evidence through five read-only tools orchestrated by Temporal, and runs Gemma locally via Ollama through Mastra to produce a diagnosis and recovery proposal, with the backend independently gating any retry behind human approval. The developer verified the integration against a local n8n 2.43.7 instance and ships three reproducible scenarios, noting that scenario failures and the recovery adapter are simulated while model inference, database persistence and orchestration are real.", "body_md": "*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle](https://dev.to/challenges/hacktoberfest-week2-2026-10-12).*\n\n**An order-creation workflow times out. Do you retry it?**\n\nThe workflow stopped receiving a response, but the remote system might already have created the order. Another attempt could create a duplicate.\n\nThat uncertainty is the problem behind **FlowMedic**, an AI-powered failure investigator for freelancers and small agencies maintaining n8n automations.\n\nThese operators connect the systems businesses depend on: lead forms, CRMs, invoices, orders, and customer notifications. When something breaks, they need to reconstruct what happened, explain it to a client, and choose a sensible next step.\n\nFlowMedic brings that investigation into one workspace. It receives an n8n failure event, gathers available evidence, and uses **Gemma running locally through Ollama** to produce:\n\nThe dashboard combines those findings with execution details, an investigation timeline, and an audit history.\n\nThe intended customer is a freelancer or agency responsible for roughly **5–50 workflows**. My initial pricing hypothesis is **$29/month for a solo workspace**. The value to validate is having useful investigation context and recovery decisions in one place.\n\nI haven’t established willingness to pay, implemented billing, or measured customer time savings. Those are questions for customer validation rather than claims about the MVP.\n\nFlowMedic currently runs locally. The repository includes setup instructions and three reproducible scenarios that exercise the application pipeline.\n\nAn HTTP 429 response includes a retry delay. FlowMedic investigates the evidence and offers a human-approved, bounded demo retry.\n\nThe receiving step expects `email`, while the incoming payload contains `email_address`. The evidence helps the operator inspect the mapping. Replaying the unchanged workflow remains blocked.\n\nThe request body was sent, but its remote outcome is unknown. FlowMedic flags the uncertainty and blocks blind retry.\n\nThe scenario failures and executable recovery adapter are simulated. **Model inference, database persistence, Temporal orchestration, and operator decisions are real.**\n\nI also verified the integration against a local **n8n 2.43.7** instance. A production webhook deliberately failed, its Error Workflow delivered the event, and FlowMedic fetched permitted workflow and execution evidence before running a Gemma investigation.\n\nThis post includes the repository and local reproduction instructions; it does not include a hosted application or video walkthrough.\n\nThe repository includes the application, importable n8n examples, scenario fixtures, setup instructions, model evaluation reports, and verification notes.\n\nFlowMedic’s source is MIT licensed. Model weights and dependencies retain their respective licenses.\n\nFlowMedic is a **TypeScript pnpm monorepo** built with:\n\n**First, n8n reports a failure.**\n\nFlowMedic authenticates the delivery, redacts common secrets, normalizes the event, and stores it in PostgreSQL. A database uniqueness constraint protects against duplicate deliveries.\n\n**Next, Temporal coordinates the investigation.**\n\nFive typed, read-only tools gather execution details, workflow metadata, failure context, related incidents, and retry-policy evidence.\n\n**Mastra then calls Gemma with the gathered evidence.**\n\nThe backend explicitly runs the tools before generation; it does not assume Gemma supports native function calling. Native structured output and Zod validation constrain the diagnosis format.\n\n**The diagnosis and recovery proposal are persisted.**\n\nThe dashboard shows the explanation, supporting evidence, missing information, and proposed next step.\n\n**Finally, the workflow waits for a human decision.**\n\nThe backend independently checks recovery eligibility. A model recommendation cannot authorize a retry. Only eligible demo cases can execute the simulated recovery adapter; live n8n retries remain disabled.\n\nTemporal handles activity retries, backoff, and the approval wait. A verified worker-restart test showed an investigation continuing with its existing diagnosis and completing one simulated recovery.\n\nThe verification log records **53 passing automated tests**, successful typechecks and a production build, alongside actual model-backed scenario runs.\n\nI compared Gemma 1B and 4B using the same three fixed evidence inputs. Both passed every behavioral probe in two of the three scenarios, but they failed differently. The smaller model omitted an expected field name; the larger model identified both fields but failed a retry-recommendation check.\n\nThe real n8n test exposed another limitation: the model recognized the deliberate failure but also suggested an unsupported webhook problem.\n\nThose results remain documented. **Schema-valid output can still contain an incorrect explanation.** That is why FlowMedic exposes the evidence and keeps recovery authorization outside the model.\n\nI used Codex to help implement, test, and iterate on the project.\n\nAutomation logs can contain client information. Running Gemma locally gives an operator control over where investigation evidence is processed, without requiring a proprietary model API.\n\nOpen weights also let me compare model sizes on my own machine and inspect the tradeoff between runtime and output quality. The configured model and endpoint can change without replacing the surrounding incident workflow.\n\nMastra and Temporal make the orchestration inspectable too: how evidence is gathered, how generation is validated, what happens when an activity fails, and how a human decision reaches a waiting investigation.\n\nLocal inference does not make the system free to operate. Hardware, electricity, hosting, and maintenance still matter. It does provide a path to running the core investigation without a required per-request commercial model bill.\n\nThe current application is a trusted local, single-operator MVP. Public authentication, multi-tenancy, billing, and live n8n recovery remain future work.\n\nMy next validation step is to put it in front of an automation freelancer and watch them investigate a failure from their own workflow.", "url": "https://wpnews.pro/news/flowmedic-investigating-broken-automations-before-you-hit-retry", "canonical_source": "https://dev.to/rohan_saxena_aeb51c2d6c34/flowmedic-investigating-broken-automations-before-you-hit-retry-27jo", "published_at": "2026-10-19 05:04:04+00:00", "updated_at": "2026-10-19 05:18:18.816374+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models", "ai-products"], "entities": ["FlowMedic", "n8n", "Gemma", "Ollama", "Mastra", "Temporal", "PostgreSQL", "TypeScript"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/flowmedic-investigating-broken-automations-before-you-hit-retry", "markdown": "https://wpnews.pro/news/flowmedic-investigating-broken-automations-before-you-hit-retry.md", "text": "https://wpnews.pro/news/flowmedic-investigating-broken-automations-before-you-hit-retry.txt", "jsonld": "https://wpnews.pro/news/flowmedic-investigating-broken-automations-before-you-hit-retry.jsonld"}}