How can I create a time-spent-on-tasks report for a tree of tasks or single page of tasks?

Try this:

#+BEGIN_QUERY
{:title [:b "Tasks in current page with CLOCK entries"]
 :inputs [:query-page]
 :query [:find (pull ?b [*])
  :in $ ?page-name
  :where
   [?p :block/name ?page-name]
   [?b :block/page ?p]
   [?b :block/marker]
   [?b :block/content ?c]
   [(re-pattern "LOGBOOK:\\nCLOCK:[\\S\\s]+") ?rx]
   [(re-seq ?rx ?c)]
 ]
}
#+END_QUERY