mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 06:04:32 +00:00
perf(test): reduce subagent announce fast-mode polling waits
This commit is contained in:
@@ -39,6 +39,8 @@ import { readLatestAssistantReply } from "./tools/agent-step.js";
|
|||||||
import { sanitizeTextContent, extractAssistantText } from "./tools/sessions-helpers.js";
|
import { sanitizeTextContent, extractAssistantText } from "./tools/sessions-helpers.js";
|
||||||
|
|
||||||
const FAST_TEST_MODE = process.env.OPENCLAW_TEST_FAST === "1";
|
const FAST_TEST_MODE = process.env.OPENCLAW_TEST_FAST === "1";
|
||||||
|
const FAST_TEST_RETRY_INTERVAL_MS = 10;
|
||||||
|
const FAST_TEST_REPLY_CHANGE_WAIT_MS = 30;
|
||||||
|
|
||||||
type ToolResultMessage = {
|
type ToolResultMessage = {
|
||||||
role?: unknown;
|
role?: unknown;
|
||||||
@@ -219,7 +221,7 @@ async function readLatestSubagentOutputWithRetry(params: {
|
|||||||
sessionKey: string;
|
sessionKey: string;
|
||||||
maxWaitMs: number;
|
maxWaitMs: number;
|
||||||
}): Promise<string | undefined> {
|
}): Promise<string | undefined> {
|
||||||
const RETRY_INTERVAL_MS = FAST_TEST_MODE ? 25 : 100;
|
const RETRY_INTERVAL_MS = FAST_TEST_MODE ? FAST_TEST_RETRY_INTERVAL_MS : 100;
|
||||||
const deadline = Date.now() + Math.max(0, Math.min(params.maxWaitMs, 15_000));
|
const deadline = Date.now() + Math.max(0, Math.min(params.maxWaitMs, 15_000));
|
||||||
let result: string | undefined;
|
let result: string | undefined;
|
||||||
while (Date.now() < deadline) {
|
while (Date.now() < deadline) {
|
||||||
@@ -241,7 +243,7 @@ async function waitForSubagentOutputChange(params: {
|
|||||||
if (!baseline) {
|
if (!baseline) {
|
||||||
return params.baselineReply;
|
return params.baselineReply;
|
||||||
}
|
}
|
||||||
const RETRY_INTERVAL_MS = FAST_TEST_MODE ? 25 : 100;
|
const RETRY_INTERVAL_MS = FAST_TEST_MODE ? FAST_TEST_RETRY_INTERVAL_MS : 100;
|
||||||
const deadline = Date.now() + Math.max(0, Math.min(params.maxWaitMs, 5_000));
|
const deadline = Date.now() + Math.max(0, Math.min(params.maxWaitMs, 5_000));
|
||||||
let latest = params.baselineReply;
|
let latest = params.baselineReply;
|
||||||
while (Date.now() < deadline) {
|
while (Date.now() < deadline) {
|
||||||
@@ -1042,7 +1044,7 @@ export async function runSubagentAnnounceFlow(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requesterDepth >= 1 && reply?.trim()) {
|
if (requesterDepth >= 1 && reply?.trim()) {
|
||||||
const minReplyChangeWaitMs = FAST_TEST_MODE ? 70 : 250;
|
const minReplyChangeWaitMs = FAST_TEST_MODE ? FAST_TEST_REPLY_CHANGE_WAIT_MS : 250;
|
||||||
reply = await waitForSubagentOutputChange({
|
reply = await waitForSubagentOutputChange({
|
||||||
sessionKey: params.childSessionKey,
|
sessionKey: params.childSessionKey,
|
||||||
baselineReply: reply,
|
baselineReply: reply,
|
||||||
|
|||||||
Reference in New Issue
Block a user