mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:50:42 +00:00
test: use agent wait for OpenAI web search smoke
This commit is contained in:
@@ -404,33 +404,30 @@ function gatewayCall(method, params) {
|
||||
}
|
||||
}
|
||||
|
||||
const sendRes = gatewayCall("chat.send", {
|
||||
const sendRes = gatewayCall("agent", {
|
||||
sessionKey,
|
||||
message,
|
||||
thinking: "minimal",
|
||||
deliver: false,
|
||||
timeoutMs: 120000,
|
||||
timeout: 180,
|
||||
idempotencyKey: id,
|
||||
});
|
||||
|
||||
if (!sendRes.ok) throw sendRes.error;
|
||||
const runId =
|
||||
sendRes.value && typeof sendRes.value === "object" && typeof sendRes.value.runId === "string"
|
||||
? sendRes.value.runId
|
||||
: id;
|
||||
|
||||
const wait = gatewayCall("agent.wait", { runId, timeoutMs: 180000 });
|
||||
if (!wait.ok) throw wait.error;
|
||||
if (mode === "reject") {
|
||||
if (!sendRes.ok) {
|
||||
console.error(sendRes.error.message);
|
||||
}
|
||||
console.error(JSON.stringify(wait.value));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (!sendRes.ok) throw sendRes.error;
|
||||
|
||||
const deadline = Date.now() + 120000;
|
||||
while (Date.now() < deadline) {
|
||||
const history = gatewayCall("chat.history", { sessionKey });
|
||||
if (history.ok && JSON.stringify(history.value).includes("OPENCLAW_SCHEMA_E2E_OK")) {
|
||||
process.exit(0);
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 250));
|
||||
if (wait.value?.status !== "ok") {
|
||||
throw new Error(`agent run did not complete successfully: ${JSON.stringify(wait.value)}`);
|
||||
}
|
||||
throw new Error("timed out waiting for OPENCLAW_SCHEMA_E2E_OK in chat history");
|
||||
NODE
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user