test: require parallels agent responses

This commit is contained in:
Peter Steinberger
2026-05-01 14:20:49 +01:00
parent d7ea6d9f8c
commit bae211f72a
7 changed files with 209 additions and 12 deletions

View File

@@ -12,10 +12,12 @@ import {
parseBoolEnv,
parseMode,
parseProvider,
providerIdFromModelId,
repoRoot,
resolveHostIp,
resolveHostPort,
resolveLatestVersion,
resolveParallelsModelTimeoutSeconds,
resolveProviderAuth,
resolveSnapshot,
run,
@@ -687,6 +689,15 @@ rm -rf /root/.openclaw/test-bad-plugin`);
private verifyLocalTurn(): void {
this.guestExec(["openclaw", "models", "set", this.auth.modelId]);
const providerId = providerIdFromModelId(this.auth.modelId) || this.options.provider;
this.guestExec([
"openclaw",
"config",
"set",
`models.providers.${providerId}.timeoutSeconds`,
String(resolveParallelsModelTimeoutSeconds("linux")),
"--strict-json",
]);
this.guestExec([
"openclaw",
"config",
@@ -698,9 +709,38 @@ rm -rf /root/.openclaw/test-bad-plugin`);
this.guestExec(["openclaw", "config", "set", "tools.profile", "minimal"]);
this.prepareAgentWorkspace();
this.guestBash(
`exec /usr/bin/env ${shellQuote(`${this.auth.apiKeyEnv}=${this.auth.apiKeyValue}`)} openclaw agent --local --agent main --session-id parallels-linux-smoke --message ${shellQuote(
"Reply with exact ASCII text OK only.",
)} --thinking minimal --json`,
`agent_ok=false
for attempt in 1 2; do
session_id="parallels-linux-smoke"
if [ "$attempt" -gt 1 ]; then session_id="parallels-linux-smoke-retry-$attempt"; fi
rm -f "$HOME/.openclaw/agents/main/sessions/$session_id.jsonl"
output_file="$(mktemp)"
set +e
/usr/bin/env ${shellQuote(`${this.auth.apiKeyEnv}=${this.auth.apiKeyValue}`)} openclaw agent --local --agent main --session-id "$session_id" --message ${shellQuote(
"Reply with exact ASCII text OK only.",
)} --thinking minimal --json >"$output_file" 2>&1
rc=$?
set -e
cat "$output_file"
if [ "$rc" -ne 0 ]; then
rm -f "$output_file"
exit "$rc"
fi
if grep -Eq '"finalAssistant(Raw|Visible)Text"[[:space:]]*:[[:space:]]*"OK"' "$output_file"; then
agent_ok=true
rm -f "$output_file"
break
fi
rm -f "$output_file"
if [ "$attempt" -lt 2 ]; then
echo "agent turn attempt $attempt finished without OK response; retrying"
sleep 3
fi
done
if [ "$agent_ok" != true ]; then
echo "openclaw agent finished without OK response" >&2
exit 1
fi`,
);
}