Full flow run by Main/main.py on every round: fetches the pending errors from
tb_jobs, isolates the actual procedure that failed, reproduces and tests hypotheses always
inside a TRANSACTION + ROLLBACK, uses AI to confirm the root cause and generate the SQL
patch, saves the result and notifies Teams.
InputDBA.tb_jobs
OutputTB_ANALISE_IA + Teams card
Per error1–4 calls to OpenAI
Isolated failurelogs it and moves to the next JOB
How to read the diagram
Phase 1 — select procedure
Phase 2 — locate the block
Phase 3 — AI diagnosis
Phase 4 — log and notify
Decision point
Runs in sandbox (always ROLLBACK)
Exception / fallback path
Retry or bypass
Center column: normal flow of an analysis. Right column: branches (next candidate, static fallback, no
patch). The long dashed line loops around the diagram when no candidate procedure reproduces the error —
it jumps straight to "more errors in the list?".