test: use agent wait for OpenAI web search smoke · openclaw/openclaw@9431633
steipete
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -404,33 +404,30 @@ function gatewayCall(method, params) {
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | | -const sendRes = gatewayCall("chat.send", { |
| 407 | +const sendRes = gatewayCall("agent", { |
408 | 408 | sessionKey, |
409 | 409 | message, |
410 | 410 | thinking: "minimal", |
411 | 411 | deliver: false, |
412 | | - timeoutMs: 120000, |
| 412 | + timeout: 180, |
413 | 413 | idempotencyKey: id, |
414 | 414 | }); |
415 | 415 | |
| 416 | +if (!sendRes.ok) throw sendRes.error; |
| 417 | +const runId = |
| 418 | + sendRes.value && typeof sendRes.value === "object" && typeof sendRes.value.runId === "string" |
| 419 | + ? sendRes.value.runId |
| 420 | + : id; |
| 421 | + |
| 422 | +const wait = gatewayCall("agent.wait", { runId, timeoutMs: 180000 }); |
| 423 | +if (!wait.ok) throw wait.error; |
416 | 424 | if (mode === "reject") { |
417 | | - if (!sendRes.ok) { |
418 | | - console.error(sendRes.error.message); |
419 | | - } |
| 425 | + console.error(JSON.stringify(wait.value)); |
420 | 426 | process.exit(0); |
421 | 427 | } |
422 | | - |
423 | | -if (!sendRes.ok) throw sendRes.error; |
424 | | - |
425 | | -const deadline = Date.now() + 120000; |
426 | | -while (Date.now() < deadline) { |
427 | | - const history = gatewayCall("chat.history", { sessionKey }); |
428 | | - if (history.ok && JSON.stringify(history.value).includes("OPENCLAW_SCHEMA_E2E_OK")) { |
429 | | - process.exit(0); |
430 | | - } |
431 | | - await new Promise((resolve) => setTimeout(resolve, 250)); |
| 428 | +if (wait.value?.status !== "ok") { |
| 429 | + throw new Error(`agent run did not complete successfully: ${JSON.stringify(wait.value)}`); |
432 | 430 | } |
433 | | -throw new Error("timed out waiting for OPENCLAW_SCHEMA_E2E_OK in chat history"); |
434 | 431 | NODE |
435 | 432 | |
436 | 433 | OPENCLAW_ENTRY="$entry" PORT="$PORT" OPENCLAW_GATEWAY_TOKEN="$TOKEN" node /tmp/openclaw-openai-web-search-minimal-client.mjs success >/tmp/openclaw-openai-web-search-minimal-client-success.log 2>&1 |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。