   (when s (assert d))
   (when d (assert gather)) 
 ;  (assert (contains? #{:uncached :lazy :eager  :eager-nosub :eager-nokids} c))
-  (binding [*collect-equal-outputs* gather
+  (binding [*sf-cache*              (HashMap.)
+            *collect-equal-outputs* gather
             *decompose-cache*       (when d (HashMap.))
             *state-abstraction*     s
             *left-recursive*        (= dir :left)

  (add-output! stub sp))


(defn- get-stub-output  [s] (first (get-outputs s)))
(defn- get-stub-output! [s] (util/safe-singleton (get-outputs s)))

;; Just give output directly if subproblem is ready
;; Return true if waiting
(defn- connect-and-watch-stub! [p c f]
  (assert (instance? angelic.search.implicit.dash_astar.Stub c))
  (if-let [sp (get-stub-output c)]

(defn- connect-and-watch-stub-up! [p c f]
  (when (connect-and-watch-stub! p c f) (summaries/summary-changed! p)))

(defn- make-wrapping-stub [[sf in-set] inner-stub sp-fn]
  (let [ret (traits/reify-traits [summaries/or-summarizable (simple-stub sf in-set)])]
    (connect-and-watch-stub! ret inner-stub #(set-stub-output! ret (sp-fn ret %)))
    ret))

