For such debugging, perhaps a custom state handler that retrieves and prints (or sends alert via Slack?) the exception of a failed task run may be more helpful than a GraphQL query?
Personally, I think for local debugging you can just use a debugger of your IDE that allows you to step into the next step, and at each step, you should see the variables/inputs.
And also, when running your flows locally and debugging, such a GraphQL query wouldn't help since it would only be populated when doing a backend run, not when running flow locally.
But if you still want to go that route you described with GraphQL queries, check out this PR that added Restarts in the UI repo:
https://github.com/PrefectHQ/ui/pull/285/files
My understanding of the process in this PR:
⢠it queries for Failed task runs (something also what you try to do),
⢠it queries for downstream tasks of failed task runs (for you it seems you want to go the opposite direction to fetch upstream task runs, but maybe the syntax already helps),
⢠then it restarts the task runs in the right order (respecting all the dependencies) and sets new task run states after completion (also something similar to what you try to do with rerunning specific task runs).