mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(onboarding): OpenAI setup installs mismatched Codex plugin (#129195)
* fix(onboarding): align Codex plugin with core release Amp-Thread-ID: https://ampcode.com/threads/T-01a037b4-f621-7144-bfdf-a68df795dd57 * test(onboarding): reject unpinned Codex candidates Amp-Thread-ID: https://ampcode.com/threads/T-01a037b4-f621-7144-bfdf-a68df795dd57 * fix(onboarding): match stable correction release plugin cohorts Co-authored-by: 許元豪 <146086744+edenfunf@users.noreply.github.com> * test: isolate plugin metadata and register startup retry coverage * test: adopt upstream startup retry ownership pattern * test: keep plugin metadata readers process-stable * test: isolate terminal session recovery cases * test: drop speculative gateway isolation change * test(gateway): mock terminal transcript lifecycle decision * fix(plugins): align correction cohorts across stable tracks --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: 許元豪 <146086744+edenfunf@users.noreply.github.com> Co-authored-by: Dallin Romney <dallinromney@gmail.com>
This commit is contained in:
committed by
GitHub
parent
827433c6fe
commit
85d5df1d87
@@ -11,6 +11,8 @@ IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-codex-on-demand-e2e" OPENCLAW_C
|
||||
DOCKER_TARGET="${OPENCLAW_CODEX_ON_DEMAND_DOCKER_TARGET:-bare}"
|
||||
HOST_BUILD="${OPENCLAW_CODEX_ON_DEMAND_HOST_BUILD:-1}"
|
||||
PACKAGE_TGZ="${OPENCLAW_CURRENT_PACKAGE_TGZ:-}"
|
||||
PREPUBLISH_PLUGIN_REGISTRY_ARGS=()
|
||||
AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT=""
|
||||
run_log=""
|
||||
|
||||
# This lane installs the package and then exercises a managed npm install of Codex.
|
||||
@@ -18,10 +20,30 @@ run_log=""
|
||||
# the Codex assertions instead of failing as a silent package-install timeout.
|
||||
export OPENCLAW_E2E_NPM_INSTALL_TIMEOUT="${OPENCLAW_E2E_NPM_INSTALL_TIMEOUT:-1200s}"
|
||||
|
||||
configure_prepublish_plugin_registry() {
|
||||
local registry_dir="$1"
|
||||
local resolved_registry_dir
|
||||
resolved_registry_dir="$(cd "$registry_dir" && pwd)"
|
||||
if [ ! -f "$resolved_registry_dir/prepublish-plugin-registry.json" ]; then
|
||||
echo "Prepublish plugin registry manifest is missing." >&2
|
||||
exit 1
|
||||
fi
|
||||
PREPUBLISH_PLUGIN_REGISTRY_ARGS=(
|
||||
-e OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR=/tmp/openclaw-prepublish-plugin-registry
|
||||
-v "$resolved_registry_dir:/tmp/openclaw-prepublish-plugin-registry:ro"
|
||||
)
|
||||
}
|
||||
if [ -n "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR:-}" ]; then
|
||||
configure_prepublish_plugin_registry "$OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR"
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
if [ -n "${PACKAGE_TGZ:-}" ]; then
|
||||
docker_e2e_cleanup_package_tgz "$PACKAGE_TGZ"
|
||||
fi
|
||||
if [ -n "$AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT" ]; then
|
||||
rm -rf "$AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT"
|
||||
fi
|
||||
if [ -n "${run_log:-}" ]; then
|
||||
rm -f "$run_log"
|
||||
fi
|
||||
@@ -44,6 +66,20 @@ prepare_package_tgz() {
|
||||
|
||||
prepare_package_tgz
|
||||
|
||||
if [ -z "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR:-}" ] &&
|
||||
[ -z "${OPENCLAW_CURRENT_PACKAGE_TGZ:-}" ] &&
|
||||
[ "$HOST_BUILD" != "0" ]; then
|
||||
AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT="$(
|
||||
mktemp -d "${TMPDIR:-/tmp}/openclaw-codex-on-demand-plugin-registry.XXXXXX"
|
||||
)"
|
||||
OPENCLAW_DOCKER_ALL_LANES=codex-on-demand \
|
||||
OPENCLAW_DOCKER_ALL_LOG_DIR="$AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT" \
|
||||
OPENCLAW_DOCKER_ALL_TIMINGS=0 \
|
||||
node "$ROOT_DIR/scripts/test-docker-all.mjs" --prepare-plugin-registry >/dev/null
|
||||
configure_prepublish_plugin_registry \
|
||||
"$AUTO_PREPUBLISH_PLUGIN_REGISTRY_ROOT/prepublish-plugin-registry"
|
||||
fi
|
||||
|
||||
docker_e2e_package_mount_args "$PACKAGE_TGZ"
|
||||
run_log="$(docker_e2e_run_log codex-on-demand)"
|
||||
OPENCLAW_TEST_STATE_SCRIPT_B64="$(docker_e2e_test_state_shell_b64 codex-on-demand empty)"
|
||||
@@ -52,6 +88,7 @@ echo "Running Codex on-demand Docker E2E..."
|
||||
if ! docker_e2e_run_with_harness \
|
||||
-e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
|
||||
-e "OPENCLAW_TEST_STATE_SCRIPT_B64=$OPENCLAW_TEST_STATE_SCRIPT_B64" \
|
||||
${PREPUBLISH_PLUGIN_REGISTRY_ARGS[@]+"${PREPUBLISH_PLUGIN_REGISTRY_ARGS[@]}"} \
|
||||
"${DOCKER_E2E_PACKAGE_ARGS[@]}" \
|
||||
-i "$IMAGE_NAME" bash -s >"$run_log" 2>&1 <<'EOF'; then
|
||||
set -euo pipefail
|
||||
@@ -71,12 +108,71 @@ dump_debug_logs() {
|
||||
echo "Codex on-demand scenario failed with exit code $status" >&2
|
||||
openclaw_e2e_dump_logs \
|
||||
/tmp/openclaw-install.log \
|
||||
/tmp/openclaw-codex-registry/server.log \
|
||||
/tmp/openclaw-onboard.json \
|
||||
/tmp/openclaw-plugins-list.json \
|
||||
/tmp/openclaw-codex-inspect.json
|
||||
}
|
||||
trap 'status=$?; dump_debug_logs "$status"; exit "$status"' ERR
|
||||
|
||||
plugin_registry_pid=""
|
||||
cleanup_inner() {
|
||||
openclaw_e2e_stop_process "${plugin_registry_pid:-}"
|
||||
}
|
||||
trap cleanup_inner EXIT
|
||||
|
||||
configure_plugin_registry() {
|
||||
[ -n "${OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR:-}" ] || return 0
|
||||
local registry_root="/tmp/openclaw-codex-registry"
|
||||
local manifest="$OPENCLAW_PREPUBLISH_PLUGIN_REGISTRY_DIR/prepublish-plugin-registry.json"
|
||||
local package_name package_version package_tarball
|
||||
IFS=$'\t' read -r package_name package_version package_tarball < <(
|
||||
PREPUBLISH_PLUGIN_REGISTRY_MANIFEST="$manifest" node <<'NODE'
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const manifestPath = process.env.PREPUBLISH_PLUGIN_REGISTRY_MANIFEST;
|
||||
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
||||
const matches = Array.isArray(manifest.packages)
|
||||
? manifest.packages.filter((entry) => entry?.name === "@openclaw/codex")
|
||||
: [];
|
||||
if (matches.length !== 1) {
|
||||
throw new Error("prepublish plugin registry must contain exactly one @openclaw/codex package");
|
||||
}
|
||||
const entry = matches[0];
|
||||
if (
|
||||
typeof entry.version !== "string" ||
|
||||
typeof entry.tarball !== "string" ||
|
||||
path.basename(entry.tarball) !== entry.tarball
|
||||
) {
|
||||
throw new Error("invalid @openclaw/codex prepublish plugin registry entry");
|
||||
}
|
||||
process.stdout.write(
|
||||
`${entry.name}\t${entry.version}\t${path.join(path.dirname(manifestPath), entry.tarball)}\n`,
|
||||
);
|
||||
NODE
|
||||
)
|
||||
mkdir -p "$registry_root"
|
||||
OPENCLAW_NPM_REGISTRY_DIST_TAGS="latest=0.0.0,beta=$package_version" \
|
||||
OPENCLAW_NPM_REGISTRY_UPSTREAM=https://registry.npmjs.org \
|
||||
node scripts/e2e/lib/plugins/npm-registry-server.mjs \
|
||||
"$registry_root/port" \
|
||||
"$package_name" "$package_version" "$package_tarball" \
|
||||
>"$registry_root/server.log" 2>&1 &
|
||||
plugin_registry_pid="$!"
|
||||
for _ in $(seq 1 100); do
|
||||
[ -s "$registry_root/port" ] && break
|
||||
openclaw_e2e_process_alive "$plugin_registry_pid" || break
|
||||
sleep 0.1
|
||||
done
|
||||
if [ ! -s "$registry_root/port" ]; then
|
||||
openclaw_e2e_print_log "$registry_root/server.log" >&2
|
||||
echo "Timed out waiting for Codex npm registry." >&2
|
||||
return 1
|
||||
fi
|
||||
export NPM_CONFIG_REGISTRY="http://127.0.0.1:$(cat "$registry_root/port")"
|
||||
export npm_config_registry="$NPM_CONFIG_REGISTRY"
|
||||
}
|
||||
|
||||
mkdir -p "$NPM_CONFIG_PREFIX" "$XDG_CACHE_HOME" "$NPM_CONFIG_CACHE"
|
||||
chmod 700 "$XDG_CACHE_HOME" "$NPM_CONFIG_CACHE" || true
|
||||
|
||||
@@ -87,6 +183,8 @@ openclaw_e2e_enable_openclaw_cli_timeout
|
||||
openclaw_e2e_assert_dep_absent "@openclaw/codex" "$HOME/.openclaw" "$NPM_CONFIG_PREFIX"
|
||||
openclaw_e2e_assert_dep_absent "@openai/codex" "$HOME/.openclaw" "$NPM_CONFIG_PREFIX"
|
||||
|
||||
configure_plugin_registry
|
||||
|
||||
echo "Running non-interactive OpenAI onboarding; Codex should install on demand..."
|
||||
openclaw onboard --non-interactive --accept-risk \
|
||||
--mode local \
|
||||
|
||||
@@ -746,6 +746,9 @@ export function requiredPrepublishPluginPackagesForLanes(poolLanes: DockerE2eLan
|
||||
const configuredChannelIds = new Set<string>();
|
||||
const requiredPackages = new Set<string>();
|
||||
for (const poolLane of poolLanes) {
|
||||
for (const packageName of poolLane.prepublishPluginPackages ?? []) {
|
||||
requiredPackages.add(packageName);
|
||||
}
|
||||
const scenario = upgradeSurvivorScenarioForLane(poolLane);
|
||||
if (!scenario) {
|
||||
continue;
|
||||
|
||||
@@ -16,6 +16,7 @@ export type DockerE2eLane = {
|
||||
name: string;
|
||||
needsLiveImage?: boolean;
|
||||
noOutputTimeoutMs?: number;
|
||||
prepublishPluginPackages?: string[];
|
||||
resources: string[];
|
||||
retries: number;
|
||||
retryPatterns: RegExp[];
|
||||
@@ -106,6 +107,7 @@ function lane(name: string, command: string, options: LaneOptions = {}): DockerE
|
||||
noOutputTimeoutMs: options.noOutputTimeoutMs,
|
||||
name,
|
||||
needsLiveImage: options.needsLiveImage,
|
||||
prepublishPluginPackages: options.prepublishPluginPackages,
|
||||
retryPatterns: options.retryPatterns ?? [],
|
||||
retries: options.retries ?? 0,
|
||||
resources: options.resources ?? [],
|
||||
@@ -442,6 +444,7 @@ export const mainLanes: DockerE2eLane[] = [
|
||||
weight: 2,
|
||||
}),
|
||||
npmLane("codex-on-demand", "OPENCLAW_SKIP_DOCKER_BUILD=1 pnpm test:docker:codex-on-demand", {
|
||||
prepublishPluginPackages: ["@openclaw/codex"],
|
||||
resources: ["service"],
|
||||
stateScenario: "empty",
|
||||
weight: 3,
|
||||
|
||||
Reference in New Issue
Block a user