Skip to content

Commit 9de3ca5

Browse files
steipeteampagent
andauthored
1 parent 01eec28 commit 9de3ca5

11 files changed

Lines changed: 831 additions & 39 deletions

‎docs/help/testing-updates-plugins.md‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,31 @@ pnpm test:docker:published-upgrade-survivor
136136
OPENCLAW_UPGRADE_SURVIVOR_BASELINE_SPEC=openclaw@latest \
137137
OPENCLAW_UPGRADE_SURVIVOR_SCENARIO=bootstrap-persona \
138138
pnpm test:docker:published-upgrade-survivor
139+
140+
141+
OPENCLAW_UPGRADE_SURVIVOR_SCENARIO=sqlite-volume \
142+
pnpm test:docker:published-upgrade-survivor
139143
```
140144

141145
Available scenarios: `base`, `acpx-openclaw-tools-bridge`, `feishu-channel`,
142146
`bootstrap-persona`, `channel-post-core-restore`, `plugin-deps-cleanup`,
143147
`configured-plugin-installs`, `stale-source-plugin-shadow`, `tilde-log-path`,
144-
and `versioned-runtime-deps`. In aggregate runs, `OPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=reported-issues`
145-
(alias `far-reaching`) expands to all scenarios, including the
146-
configured-plugin install migration.
148+
`meeting-transcripts-sqlite`, `versioned-runtime-deps`, `cron-scheduled-authority`,
149+
and `sqlite-volume`. In aggregate runs,
150+
`OPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=reported-issues` expands the release-soak
151+
fixtures but excludes the expensive `sqlite-volume` scenario. Use
152+
`OPENCLAW_UPGRADE_SURVIVOR_SCENARIOS=far-reaching` to include it.
153+
154+
The `sqlite-volume` scenario combines configured Matrix, Discord, and Telegram
155+
plugin/channel state with 4,800 sessions, 23,890 transcript events, and 2,200
156+
cron crawl jobs by default. It verifies exact JSONL-to-SQLite and cron migration,
157+
legacy archival, database integrity, a second idempotent Doctor run, and Gateway
158+
startup. Scale it with `OPENCLAW_UPGRADE_SURVIVOR_VOLUME_SESSIONS`,
159+
`OPENCLAW_UPGRADE_SURVIVOR_VOLUME_EVENTS_PER_SESSION`, and
160+
`OPENCLAW_UPGRADE_SURVIVOR_VOLUME_CRON_JOBS`. The default Doctor budgets are 120
161+
seconds for migration and 60 seconds for the idempotent pass; override them with
162+
`OPENCLAW_UPGRADE_SURVIVOR_VOLUME_MIGRATION_BUDGET_SECONDS` and
163+
`OPENCLAW_UPGRADE_SURVIVOR_VOLUME_IDEMPOTENCE_BUDGET_SECONDS` on slower hosts.
147164

148165
Full update migration is intentionally separate from Full Release CI. Use the
149166
manual `Update Migration` workflow when the release question is "can every

‎scripts/e2e/lib/upgrade-survivor/assertions.mjs‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import fs from "node:fs";
44
import path from "node:path";
55
import { DatabaseSync } from "node:sqlite";
66
import { readPluginInstallIndex } from "../plugin-index-sqlite.mjs";
7+
import { assertUpgradeVolumeMigrated, seedUpgradeVolume } from "./sqlite-volume.mjs";
78

89
const command = process.argv[2];
910
const SCENARIOS = new Set([
@@ -20,6 +21,7 @@ const SCENARIOS = new Set([
2021
"meeting-transcripts-sqlite",
2122
"versioned-runtime-deps",
2223
"cron-scheduled-authority",
24+
"sqlite-volume",
2325
"auth-profile-v2026-7-2-beta-5",
2426
]);
2527

@@ -427,7 +429,7 @@ function assertConfigSurvived() {
427429
const pluginAllow = config.plugins?.allow ?? [];
428430
assert(pluginAllow.includes("discord"), "discord plugin allow entry missing");
429431
assert(pluginAllow.includes("telegram"), "telegram plugin allow entry missing");
430-
if (getScenario() === "configured-plugin-installs") {
432+
if (acceptsIntent(coverage, "configured-plugin-installs")) {
431433
assert(pluginAllow.includes("matrix"), "matrix plugin allow entry missing");
432434
} else {
433435
assert(pluginAllow.includes("whatsapp"), "whatsapp plugin allow entry missing");
@@ -490,7 +492,7 @@ function assertConfigSurvived() {
490492

491493
if (
492494
acceptsIntent(coverage, "whatsapp-channel") &&
493-
getScenario() !== "configured-plugin-installs"
495+
!acceptsIntent(coverage, "configured-plugin-installs")
494496
) {
495497
const whatsapp = config.channels?.whatsapp;
496498
assert(whatsapp?.enabled === true, "whatsapp enabled flag changed");
@@ -564,6 +566,9 @@ function assertStateSurvived() {
564566
if (scenario === "cron-scheduled-authority") {
565567
assertCronScheduledAuthorityMigrated(stateDir, stage);
566568
}
569+
if (scenario === "sqlite-volume") {
570+
assertUpgradeVolumeMigrated(stateDir, stage);
571+
}
567572
if (scenario === "auth-profile-v2026-7-2-beta-5") {
568573
assertAuthProfileMigrationSurvived(stateDir, stage);
569574
}
@@ -1212,6 +1217,10 @@ if (command === "list-scenarios") {
12121217
process.stdout.write(`${JSON.stringify([...SCENARIOS])}\n`);
12131218
} else if (command === "seed") {
12141219
seedState();
1220+
} else if (command === "seed-volume") {
1221+
assert(getScenario() === "sqlite-volume", "seed-volume requires the sqlite-volume scenario");
1222+
const stateDir = requireEnv("OPENCLAW_STATE_DIR");
1223+
seedUpgradeVolume(stateDir);
12151224
} else if (command === "assert-config") {
12161225
assertConfigSurvived();
12171226
} else if (command === "assert-state") {

‎scripts/e2e/lib/upgrade-survivor/config-recipe.mts‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,26 @@ const representativeConfigSteps: ConfigStep[] = [
154154
),
155155
];
156156

157+
const configuredPluginInstallSteps = [
158+
configSetJsonFile(
159+
"plugins-configured-installs",
160+
"configured-plugin-installs",
161+
"plugins",
162+
"plugins-configured-installs.json",
163+
),
164+
{
165+
id: "channels-whatsapp-unset",
166+
intent: "configured-plugin-installs",
167+
argv: ["config", "unset", "channels.whatsapp"],
168+
},
169+
configSetJsonFile(
170+
"channels-matrix",
171+
"configured-plugin-installs",
172+
"channels.matrix",
173+
"channels-matrix.json",
174+
),
175+
];
176+
157177
const scenarioConfigSteps = new Map<string, ConfigStep[]>([
158178
[
159179
"acpx-openclaw-tools-bridge",
@@ -188,28 +208,8 @@ const scenarioConfigSteps = new Map<string, ConfigStep[]>([
188208
},
189209
],
190210
],
191-
[
192-
"configured-plugin-installs",
193-
[
194-
configSetJsonFile(
195-
"plugins-configured-installs",
196-
"configured-plugin-installs",
197-
"plugins",
198-
"plugins-configured-installs.json",
199-
),
200-
{
201-
id: "channels-whatsapp-unset",
202-
intent: "configured-plugin-installs",
203-
argv: ["config", "unset", "channels.whatsapp"],
204-
},
205-
configSetJsonFile(
206-
"channels-matrix",
207-
"configured-plugin-installs",
208-
"channels.matrix",
209-
"channels-matrix.json",
210-
),
211-
],
212-
],
211+
["configured-plugin-installs", configuredPluginInstallSteps],
212+
["sqlite-volume", configuredPluginInstallSteps],
213213
[
214214
"codex-allowlist-survival",
215215
[

‎scripts/e2e/lib/upgrade-survivor/run.sh‎

Lines changed: 69 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env bash
22
set -Eeuo pipefail
3+
# Signal traps inherit the foreground command's redirections. Keep harness stdout separate so the
4+
# final summary location cannot corrupt a command artifact when the run is interrupted.
5+
exec 3>&1
36

47
source scripts/lib/openclaw-e2e-instance.sh
58

@@ -38,7 +41,7 @@ export TELEGRAM_BOT_TOKEN="123456:upgrade-survivor-telegram-token"
3841
if [ "$SCENARIO" = "feishu-channel" ]; then
3942
export FEISHU_APP_SECRET="upgrade-survivor-feishu-secret"
4043
fi
41-
if [ "$SCENARIO" = "configured-plugin-installs" ]; then
44+
if [ "$SCENARIO" = "configured-plugin-installs" ] || [ "$SCENARIO" = "sqlite-volume" ]; then
4245
export MATRIX_ACCESS_TOKEN="upgrade-survivor-matrix-token"
4346
export BRAVE_API_KEY="BSA_upgrade_survivor_brave_key"
4447
fi
@@ -85,6 +88,9 @@ status_seconds=""
8588
healthz_seconds=""
8689
readyz_seconds=""
8790
update_restart_seconds=""
91+
migration_seconds=""
92+
idempotence_seconds=""
93+
run_completed="0"
8894

8995
BASELINE_INSTALL_LOG="$ARTIFACT_ROOT/baseline-install.log"
9096
UPDATE_JSON="$ARTIFACT_ROOT/update.json"
@@ -197,6 +203,8 @@ write_summary() {
197203
SUMMARY_UPDATE_RESTART_MODE="$UPDATE_RESTART_MODE" \
198204
SUMMARY_START_SECONDS="$start_seconds" \
199205
SUMMARY_UPDATE_RESTART_SECONDS="$update_restart_seconds" \
206+
SUMMARY_MIGRATION_SECONDS="$migration_seconds" \
207+
SUMMARY_IDEMPOTENCE_SECONDS="$idempotence_seconds" \
200208
SUMMARY_HEALTHZ_SECONDS="$healthz_seconds" \
201209
SUMMARY_READYZ_SECONDS="$readyz_seconds" \
202210
SUMMARY_STATUS_SECONDS="$status_seconds" \
@@ -234,6 +242,8 @@ const summary = {
234242
timings: {
235243
startupSeconds: numberOrNull(process.env.SUMMARY_START_SECONDS),
236244
updateRestartSeconds: numberOrNull(process.env.SUMMARY_UPDATE_RESTART_SECONDS),
245+
migrationSeconds: numberOrNull(process.env.SUMMARY_MIGRATION_SECONDS),
246+
idempotenceSeconds: numberOrNull(process.env.SUMMARY_IDEMPOTENCE_SECONDS),
237247
healthzSeconds: numberOrNull(process.env.SUMMARY_HEALTHZ_SECONDS),
238248
readyzSeconds: numberOrNull(process.env.SUMMARY_READYZ_SECONDS),
239249
statusSeconds: numberOrNull(process.env.SUMMARY_STATUS_SECONDS),
@@ -281,24 +291,40 @@ on_error() {
281291
return "$status"
282292
}
283293

294+
on_signal() {
295+
local signal="$1"
296+
local status="$2"
297+
trap - HUP INT TERM
298+
FAILURE_PHASE="${CURRENT_PHASE:-unknown}"
299+
FAILURE_MESSAGE="phase ${FAILURE_PHASE} interrupted by ${signal}"
300+
exit "$status"
301+
}
302+
284303
on_exit() {
285304
local status="$1"
305+
trap - ERR EXIT HUP INT TERM
286306
set +e
287307
cleanup
288-
if [ "$status" -eq 0 ]; then
308+
if [ "$status" -eq 0 ] && [ "$run_completed" = "1" ]; then
289309
write_summary passed ""
290310
else
311+
if [ "$status" -eq 0 ]; then
312+
status=1
313+
FAILURE_MESSAGE="upgrade survivor exited before all phases completed"
314+
fi
291315
[ -n "$FAILURE_PHASE" ] || FAILURE_PHASE="${CURRENT_PHASE:-unknown}"
292316
[ -n "$FAILURE_MESSAGE" ] || FAILURE_MESSAGE="upgrade survivor failed with status $status"
293317
write_summary failed "$FAILURE_MESSAGE"
294318
fi
295-
echo "Upgrade survivor summary: $SUMMARY_JSON"
296-
cat "$SUMMARY_JSON" 2>/dev/null || true
319+
echo "Upgrade survivor summary: $SUMMARY_JSON" >&3
297320
exit "$status"
298321
}
299322

300323
trap 'on_error $?' ERR
301324
trap 'on_exit $?' EXIT
325+
trap 'on_signal SIGHUP 129' HUP
326+
trap 'on_signal SIGINT 130' INT
327+
trap 'on_signal SIGTERM 143' TERM
302328

303329
phase() {
304330
local name="$1"
@@ -357,7 +383,7 @@ plugin_deps_cleanup_plugin_dirs() {
357383
}
358384

359385
configured_plugin_installs_enabled() {
360-
[ "$SCENARIO" = "configured-plugin-installs" ]
386+
[ "$SCENARIO" = "configured-plugin-installs" ] || [ "$SCENARIO" = "sqlite-volume" ]
361387
}
362388

363389
source_only_plugin_shadow_enabled() {
@@ -1449,11 +1475,40 @@ assert_root_managed_vps_cli_usable() {
14491475
}
14501476

14511477
run_doctor() {
1478+
local started_at budget
1479+
started_at="$(date +%s)"
14521480
if ! openclaw_e2e_maybe_timeout "$COMMAND_TIMEOUT" openclaw doctor --fix --non-interactive >"$DOCTOR_LOG" 2>&1; then
14531481
echo "openclaw doctor failed" >&2
14541482
openclaw_e2e_print_log "$DOCTOR_LOG" >&2
14551483
return 1
14561484
fi
1485+
if [ "$SCENARIO" = "sqlite-volume" ]; then
1486+
migration_seconds=$(($(date +%s) - started_at))
1487+
budget="$(openclaw_e2e_read_positive_int_env OPENCLAW_UPGRADE_SURVIVOR_VOLUME_MIGRATION_BUDGET_SECONDS 120)"
1488+
echo "SQLite volume migration doctor completed in ${migration_seconds}s (budget ${budget}s)."
1489+
if [ "$migration_seconds" -gt "$budget" ]; then
1490+
echo "SQLite volume migration exceeded budget: ${migration_seconds}s > ${budget}s" >&2
1491+
return 1
1492+
fi
1493+
fi
1494+
}
1495+
1496+
assert_volume_idempotence() {
1497+
local started_at budget
1498+
started_at="$(date +%s)"
1499+
if ! openclaw_e2e_maybe_timeout "$COMMAND_TIMEOUT" openclaw doctor --fix --non-interactive >>"$DOCTOR_LOG" 2>&1; then
1500+
echo "openclaw idempotence doctor failed" >&2
1501+
openclaw_e2e_print_log "$DOCTOR_LOG" >&2
1502+
return 1
1503+
fi
1504+
idempotence_seconds=$(($(date +%s) - started_at))
1505+
budget="$(openclaw_e2e_read_positive_int_env OPENCLAW_UPGRADE_SURVIVOR_VOLUME_IDEMPOTENCE_BUDGET_SECONDS 60)"
1506+
echo "SQLite volume idempotence doctor completed in ${idempotence_seconds}s (budget ${budget}s)."
1507+
if [ "$idempotence_seconds" -gt "$budget" ]; then
1508+
echo "SQLite volume idempotence exceeded budget: ${idempotence_seconds}s > ${budget}s" >&2
1509+
return 1
1510+
fi
1511+
node scripts/e2e/lib/upgrade-survivor/assertions.mjs assert-state
14571512
}
14581513

14591514
validate_post_doctor_config() {
@@ -1601,6 +1656,9 @@ phase install-baseline-plugin-dependencies install_baseline_plugin_dependencies
16011656
phase seed-legacy-plugin-dependency-debris seed_legacy_plugin_dependency_debris
16021657
phase assert-legacy-plugin-dependency-debris assert_legacy_plugin_dependency_debris_present
16031658
phase seed-source-only-plugin-shadow seed_source_only_plugin_shadow
1659+
if [ "$SCENARIO" = "sqlite-volume" ]; then
1660+
phase seed-volume-state node scripts/e2e/lib/upgrade-survivor/assertions.mjs seed-volume
1661+
fi
16041662
phase assert-baseline assert_baseline_state
16051663
phase seed-legacy-runtime-deps-symlink seed_legacy_runtime_deps_symlink
16061664
phase resolve-candidate resolve_candidate_version
@@ -1611,7 +1669,7 @@ phase update-candidate update_candidate
16111669
if [ -n "${OPENCLAW_CLAWHUB_URL:-}" ]; then
16121670
clawhub_security_mode="required"
16131671
prepublish_package="@openclaw/whatsapp"
1614-
if [ "$SCENARIO" = "configured-plugin-installs" ]; then
1672+
if configured_plugin_installs_enabled; then
16151673
prepublish_package="@openclaw/matrix"
16161674
fi
16171675
# 2026.6.35 predates the release-security endpoint. The trusted fixture still
@@ -1630,11 +1688,15 @@ phase assert-legacy-plugin-dependency-debris-cleaned assert_legacy_plugin_depend
16301688
phase assert-legacy-runtime-deps-symlink-repaired assert_legacy_runtime_deps_symlink_repaired
16311689
phase validate-post-doctor-config validate_post_doctor_config
16321690
phase assert-survival assert_survival
1691+
if [ "$SCENARIO" = "sqlite-volume" ]; then
1692+
phase assert-volume-idempotence assert_volume_idempotence
1693+
fi
16331694
phase gateway-start ensure_gateway_started
16341695
phase gateway-probes check_gateway_probes
16351696
phase gateway-status check_gateway_status
16361697
if [ "$LIVE_OPENAI" = "1" ]; then
16371698
phase live-openai run_live_openai
16381699
fi
16391700

1640-
echo "Upgrade survivor Docker E2E passed baseline=${baseline_spec} scenario=${SCENARIO} candidate=${candidate_version} updateRestartMode=${UPDATE_RESTART_MODE} startup=${start_seconds}s updateRestart=${update_restart_seconds:-manual}s healthz=${healthz_seconds}s readyz=${readyz_seconds}s status=${status_seconds}s."
1701+
run_completed="1"
1702+
echo "Upgrade survivor Docker E2E passed baseline=${baseline_spec} scenario=${SCENARIO} candidate=${candidate_version} updateRestartMode=${UPDATE_RESTART_MODE} migration=${migration_seconds:-n/a}s idempotence=${idempotence_seconds:-n/a}s startup=${start_seconds}s updateRestart=${update_restart_seconds:-manual}s healthz=${healthz_seconds}s readyz=${readyz_seconds}s status=${status_seconds}s."

0 commit comments

Comments
 (0)