

















@@ -44,6 +44,7 @@ import path from "node:path";
4444import { describe, expect, it } from "vitest";
4545import { resolveCliBackendConfig } from "../agents/cli-backends.js";
4646import { isLiveTestEnabled } from "../agents/live-test-helpers.js";
47+import { resolveShellFromPath } from "../agents/shell-utils.js";
4748import { clearRuntimeConfigSnapshot, type OpenClawConfig } from "../config/config.js";
4849import { isTruthyEnvValue } from "../infra/env.js";
4950import {
@@ -78,6 +79,18 @@ const DEFAULT_MODEL = "claude-cli/claude-haiku-4-5";
7879const REQUEST_TIMEOUT_MS = 5 * 60_000;
7980const AGENT_TIMEOUT_SECONDS = Math.max(1, Math.ceil(REQUEST_TIMEOUT_MS / 1000) - 10);
808182+async function isExecutableCommandAvailable(command: string): Promise<boolean> {
83+if (command.includes("/") || command.includes(path.sep)) {
84+try {
85+await fs.access(command, fs.constants.X_OK);
86+return true;
87+} catch {
88+return false;
89+}
90+}
91+return Boolean(resolveShellFromPath(command));
92+}
93+8194describeLive("system-prompt-override on resumed cli sessions (issue #80374)", () => {
8295it(
8396"resumed session honors NEW systemPromptOverride (changing-marker proof, server restart between turns)",
@@ -88,14 +101,6 @@ describeLive("system-prompt-override on resumed cli sessions (issue #80374)", ()
88101process.env.OPENCLAW_LIVE_CLI_BACKEND_PRESERVE_ENV,
89102) ?? [],
90103);
91-const previousEnv = snapshotCliBackendLiveEnv();
92-clearRuntimeConfigSnapshot();
93-applyCliBackendLiveEnv(preservedEnv);
94-95-const token = `test-${randomUUID()}`;
96-process.env.OPENCLAW_GATEWAY_TOKEN = token;
97-const port = await getFreeGatewayPort();
98-99104const rawModel = process.env.OPENCLAW_LIVE_CLI_BACKEND_MODEL ?? DEFAULT_MODEL;
100105const modelSelection = resolveCliBackendLiveModelSelection({
101106 rawModel,
@@ -107,12 +112,32 @@ describeLive("system-prompt-override on resumed cli sessions (issue #80374)", ()
107112const backendResolved = resolveCliBackendConfig(providerId);
108113const providerDefaults = backendResolved?.config;
109114110-const cliCommand = process.env.OPENCLAW_LIVE_CLI_BACKEND_COMMAND ?? providerDefaults?.command;
115+const explicitCliCommand = process.env.OPENCLAW_LIVE_CLI_BACKEND_COMMAND;
116+const cliCommand = explicitCliCommand ?? providerDefaults?.command;
111117if (!cliCommand) {
112118throw new Error(
113119`OPENCLAW_LIVE_CLI_BACKEND_COMMAND is required for provider "${providerId}".`,
114120);
115121}
122+if (!(await isExecutableCommandAvailable(cliCommand))) {
123+if (explicitCliCommand) {
124+throw new Error(
125+`OPENCLAW_LIVE_CLI_BACKEND_COMMAND is not executable or not on PATH: ${cliCommand}`,
126+);
127+}
128+console.warn(
129+`[sp-resume-proof] skip: CLI backend command "${cliCommand}" is not executable or not on PATH; set OPENCLAW_LIVE_CLI_BACKEND_COMMAND to run this live proof.`,
130+);
131+return;
132+}
133+134+const previousEnv = snapshotCliBackendLiveEnv();
135+clearRuntimeConfigSnapshot();
136+applyCliBackendLiveEnv(preservedEnv);
137+138+const token = `test-${randomUUID()}`;
139+process.env.OPENCLAW_GATEWAY_TOKEN = token;
140+const port = await getFreeGatewayPort();
116141117142const { args: cliArgs, resumeArgs: cliResumeArgs } = resolveCliBackendLiveArgs({
118143 providerId,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。