mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 03:15:46 -06:00
chore(cli): drop dead classifiers and single-use wrappers left by fallback removal (#112191)
Follow-up to c5254f13ee (#112074): delete the legacy string-match timeout
classifier (the CLI path only sees typed GatewayTransportError from
callGateway's wrapper timer), the duplicate JSON/blank-message validation
in the private gateway command, the now-pointless getGatewayDispatchConfig
wrapper, the single-use embedded-loader alias, and the cross-os release
guard for the EMBEDDED FALLBACK marker no build can emit anymore.
This commit is contained in:
committed by
GitHub
parent
ae27ee98f0
commit
e1ff65fb77
@@ -1,6 +1,6 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { appendFileSync } from "node:fs";
|
||||
import type { AgentOutputOptions, AgentTurnResult } from "./config.ts";
|
||||
import type { AgentOutputOptions } from "./config.ts";
|
||||
import { CROSS_OS_AGENT_TURN_OPTIONAL, CROSS_OS_AGENT_TURN_TIMEOUT_SECONDS } from "./config.ts";
|
||||
import { readLogTextTail } from "./logs.ts";
|
||||
|
||||
@@ -73,24 +73,11 @@ export function buildReleaseAgentTurnArgs(sessionId: string) {
|
||||
|
||||
export function shouldRetryCrossOsAgentTurnError(error: unknown) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return /Agent output did not contain the expected OK marker|Agent turn used embedded fallback instead of gateway|model idle timeout|did not produce a response before the model idle timeout|gateway request timeout for agent|Command timed out|timed out and could not be terminated cleanly|rate limit reached|rate_limit_exceeded|HTTP 429|HTTP 503|upstream connect error|disconnect\/reset before headers|connection timeout/u.test(
|
||||
return /Agent output did not contain the expected OK marker|model idle timeout|did not produce a response before the model idle timeout|gateway request timeout for agent|Command timed out|timed out and could not be terminated cleanly|rate limit reached|rate_limit_exceeded|HTTP 429|HTTP 503|upstream connect error|disconnect\/reset before headers|connection timeout/u.test(
|
||||
message,
|
||||
);
|
||||
}
|
||||
|
||||
export function agentTurnUsedEmbeddedFallback(
|
||||
result: Pick<AgentTurnResult, "stdout" | "stderr">,
|
||||
options: AgentOutputOptions = {},
|
||||
) {
|
||||
const logText =
|
||||
typeof options.logText === "string"
|
||||
? options.logText
|
||||
: typeof options.logPath === "string"
|
||||
? readLogTextTail(options.logPath)
|
||||
: "";
|
||||
return /EMBEDDED FALLBACK:/u.test(`${result.stdout ?? ""}\n${result.stderr ?? ""}\n${logText}`);
|
||||
}
|
||||
|
||||
export function agentOutputHasExpectedOkMarker(stdout: string, options: AgentOutputOptions = {}) {
|
||||
const payloadTexts = parseAgentPayloadTexts(stdout);
|
||||
if (payloadTexts.some((text) => text.trim() === "OK")) {
|
||||
|
||||
@@ -3,7 +3,6 @@ import { appendFileSync, createWriteStream, existsSync, mkdirSync } from "node:f
|
||||
import { dirname, join } from "node:path";
|
||||
import {
|
||||
agentOutputHasExpectedOkMarker,
|
||||
agentTurnUsedEmbeddedFallback,
|
||||
buildCrossOsReleaseAgentSessionId,
|
||||
buildReleaseAgentTurnArgs,
|
||||
maybeBuildOptionalAgentTurnSkipResult,
|
||||
@@ -766,9 +765,6 @@ export async function runInstalledAgentTurn(params: {
|
||||
if (!agentOutputHasExpectedOkMarker(result.stdout, { logText })) {
|
||||
throw new Error("Agent output did not contain the expected OK marker.");
|
||||
}
|
||||
if (agentTurnUsedEmbeddedFallback(result, { logText })) {
|
||||
throw new Error("Agent turn used embedded fallback instead of gateway.");
|
||||
}
|
||||
return result;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
|
||||
@@ -2,7 +2,6 @@ import { spawn } from "node:child_process";
|
||||
import { appendFileSync, createWriteStream } from "node:fs";
|
||||
import {
|
||||
agentOutputHasExpectedOkMarker,
|
||||
agentTurnUsedEmbeddedFallback,
|
||||
buildCrossOsReleaseAgentSessionId,
|
||||
buildReleaseAgentTurnArgs,
|
||||
maybeBuildOptionalAgentTurnSkipResult,
|
||||
@@ -308,9 +307,6 @@ export async function runAgentTurn(
|
||||
if (!agentOutputHasExpectedOkMarker(result.stdout, { logText })) {
|
||||
throw new Error("Agent output did not contain the expected OK marker.");
|
||||
}
|
||||
if (agentTurnUsedEmbeddedFallback(result, { logText })) {
|
||||
throw new Error("Agent turn used embedded fallback instead of gateway.");
|
||||
}
|
||||
return result;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
|
||||
Reference in New Issue
Block a user