From f77eeb6fb564eb12ee421bb828c837c30054510c Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Sun, 8 Mar 2026 21:36:35 +0800 Subject: [PATCH] enable autoPause --- .../src/logseq/agents/runtime_provider.cljs | 78 +++++-------------- .../agents/e2b_runtime_provider_test.cljs | 2 + 2 files changed, 21 insertions(+), 59 deletions(-) diff --git a/deps/workers/src/logseq/agents/runtime_provider.cljs b/deps/workers/src/logseq/agents/runtime_provider.cljs index c5789aaf55..8b254a48fa 100644 --- a/deps/workers/src/logseq/agents/runtime_provider.cljs +++ b/deps/workers/src/logseq/agents/runtime_provider.cljs @@ -418,9 +418,10 @@ [^js env] (parse-int (env-str env "E2B_HEALTH_INTERVAL_MS") 300)) +;; default to 1 hour (defn- e2b-sandbox-timeout-ms [^js env] - (parse-int (env-str env "E2B_SANDBOX_TIMEOUT_MS") (* 5 60 1000))) + (parse-int (env-str env "E2B_SANDBOX_TIMEOUT_MS") (* 60 60 1000))) (defn- e2b-api-opts [^js env] @@ -655,8 +656,8 @@ "runtime-provider" "e2b"} (string? session-id) (assoc "runtime-session-id" session-id))] (cond-> {:timeoutMs timeout-ms - :lifecycle {:onTimeout "pause" - :autoResume true}} + :autoPause true + :autoResume true} (seq env-vars) (assoc :envs env-vars) (string? session-id) (assoc :metadata metadata)))) @@ -787,33 +788,6 @@ {:reason :invalid-snapshot-id :snapshot snapshot})))))) -(defn- (clj (last args) :keywordize-keys true)] (is (= "e2b-key" (:apiKey opts))) + (is (true? (:autoPause opts))) (is (= "pause" (get-in opts [:lifecycle :onTimeout]))) (js/Promise.resolve #js {:sandboxId "e2b-sbx-1" @@ -395,6 +396,7 @@ :template nil} (select-keys (second @calls) [:type :argc :template]))) (is (= "e2b-key" (get-in (first @calls) [:opts :apiKey]))) + (is (true? (get-in (first @calls) [:opts :autoPause]))) (is (= "pause" (get-in (first @calls) [:opts :lifecycle :onTimeout]))) (is (= "sess-e2b-fallback-template" (get-in (first @calls) [:opts :metadata :session-id])))