fix(e2e): cancel plugin preflight body reads · openclaw/openclaw@089f8c7
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -46,7 +46,7 @@ async function withTimeout(label, timeoutMs, run) {
|
46 | 46 | timeout.unref?.(); |
47 | 47 | }); |
48 | 48 | try { |
49 | | -return await Promise.race([run(controller.signal), timeoutPromise]); |
| 49 | +return await Promise.race([run(controller.signal, timeoutPromise), timeoutPromise]); |
50 | 50 | } finally { |
51 | 51 | if (timeout) { |
52 | 52 | clearTimeout(timeout); |
@@ -863,11 +863,12 @@ async function assertClawHubPreflight() {
|
863 | 863 | const body = await withTimeout( |
864 | 864 | `ClawHub package preflight response for ${packageName}`, |
865 | 865 | limits.timeoutMs, |
866 | | -() => |
| 866 | +(_signal, timeoutPromise) => |
867 | 867 | readBoundedResponseText( |
868 | 868 | response, |
869 | 869 | `ClawHub package preflight response for ${packageName}`, |
870 | 870 | limits.bodyMaxBytes, |
| 871 | +timeoutPromise, |
871 | 872 | ), |
872 | 873 | ); |
873 | 874 | throw new Error( |
@@ -877,11 +878,12 @@ async function assertClawHubPreflight() {
|
877 | 878 | const rawDetail = await withTimeout( |
878 | 879 | `ClawHub package preflight response for ${packageName}`, |
879 | 880 | limits.timeoutMs, |
880 | | -() => |
| 881 | +(_signal, timeoutPromise) => |
881 | 882 | readBoundedResponseText( |
882 | 883 | response, |
883 | 884 | `ClawHub package preflight response for ${packageName}`, |
884 | 885 | limits.bodyMaxBytes, |
| 886 | +timeoutPromise, |
885 | 887 | ), |
886 | 888 | ); |
887 | 889 | const detail = await withTimeout( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -171,6 +171,15 @@ describe("plugins Docker assertions", () => {
|
171 | 171 | ); |
172 | 172 | }); |
173 | 173 | |
| 174 | +it("passes ClawHub preflight body timeouts into the bounded reader", () => { |
| 175 | +const script = readFileSync(ASSERTIONS_SCRIPT, "utf8"); |
| 176 | + |
| 177 | +expect(script).toContain("run(controller.signal, timeoutPromise)"); |
| 178 | +expect( |
| 179 | +script.match(/readBoundedResponseText\([\s\S]*?limits\.bodyMaxBytes,\n\s+timeoutPromise,/gu), |
| 180 | +).toHaveLength(2); |
| 181 | +}); |
| 182 | + |
174 | 183 | it("keeps sweep artifact paths aligned with the assertion scratch root", () => { |
175 | 184 | const scripts = [ |
176 | 185 | "scripts/e2e/lib/plugins/sweep.sh", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。