Skip to content

Commit f12dab5

Browse files
authored
fix(release): unblock historical upgrade transcript and plugin checks (#132816)
* test(upgrade): defer transcript export until survival checks finish * test(upgrade): admit reviewed scenario consent recovery * test(release): stage ACP companion for historical upgrades
1 parent 10da9ac commit f12dab5

8 files changed

Lines changed: 171 additions & 43 deletions

File tree

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,10 @@ function assertMeetingTranscriptsMigrated(stateDir, stage) {
873873
} finally {
874874
db.close();
875875
}
876+
}
876877

878+
function assertMeetingTranscriptExport(stateDir) {
879+
const legacySessionDir = path.join(stateDir, "transcripts", "2026-07-01", "design-review");
877880
const exportedDir = execFileSync(
878881
"openclaw",
879882
["transcripts", "path", "2026-07-01/design-review", "--dir"],
@@ -1263,9 +1266,9 @@ function assertRecoverableUpdateJson([file, expectedVersion, observationRoot, ba
12631266
result.status === "error" ? "post-plugin-doctor-invalid-config" : undefined,
12641267
);
12651268
assertStrict.deepEqual(plugins.integrityDrifts, []);
1266-
// These are the reviewed packages in the base and configured-plugin recipes.
1269+
// These are the reviewed packages in the base and scenario recipes.
12671270
// Any other plugin or failure needs investigation before accepting it.
1268-
const reviewed = new Set(["codex", "discord", "whatsapp", "matrix", "brave"]);
1271+
const reviewed = new Set(["acpx", "brave", "codex", "discord", "feishu", "matrix", "whatsapp"]);
12691272
const denied = new Set();
12701273
assertStrict.ok(Array.isArray(plugins.npm?.outcomes));
12711274
for (const outcome of plugins.npm.outcomes) {
@@ -1515,6 +1518,12 @@ if (command === "list-scenarios") {
15151518
} else if (command === "assert-state") {
15161519
assertStateSurvived();
15171520
assertConfiguredPluginInstalls();
1521+
} else if (command === "assert-meeting-transcript-export") {
1522+
assert(
1523+
getScenario() === "meeting-transcripts-sqlite",
1524+
"transcript export requires the meeting scenario",
1525+
);
1526+
assertMeetingTranscriptExport(requireEnv("OPENCLAW_STATE_DIR"));
15181527
} else if (command === "assert-companion-installs") {
15191528
assertCompanionPluginInstalls(process.argv.slice(3));
15201529
} else if (command === "assert-recovered-plugin-installs") {

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type ConfigStep = {
1616
id: string;
1717
intent: string;
1818
argv: string[];
19+
prepublishPluginPackages?: string[];
1920
};
2021

2122
type BaselineAdaptationSummary = { skippedIntents: string[] };
@@ -178,12 +179,16 @@ const scenarioConfigSteps = new Map<string, ConfigStep[]>([
178179
[
179180
"acpx-openclaw-tools-bridge",
180181
[
181-
configSetJsonFile(
182-
"plugins-acpx-openclaw-tools-bridge",
183-
"acpx-openclaw-tools-bridge",
184-
"plugins",
185-
"plugins-acpx-openclaw-tools-bridge.json",
186-
),
182+
{
183+
...configSetJsonFile(
184+
"plugins-acpx-openclaw-tools-bridge",
185+
"acpx-openclaw-tools-bridge",
186+
"plugins",
187+
"plugins-acpx-openclaw-tools-bridge.json",
188+
),
189+
// The candidate externalizes this runtime even when the baseline bundles it.
190+
prepublishPluginPackages: ["@openclaw/acpx"],
191+
},
187192
],
188193
],
189194
[

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,11 @@ if [ "$SCENARIO" = "sqlite-volume" ]; then
14281428
phase assert-volume-idempotence assert_volume_idempotence
14291429
fi
14301430
phase fixture-plugin-consent repair_fixture_plugin_consent
1431+
if [ "$SCENARIO" = "meeting-transcripts-sqlite" ]; then
1432+
# Export recreates the archived source path. Finish every repeated survival
1433+
# check before exercising the explicit artifact materialization command.
1434+
phase transcript-export node scripts/e2e/lib/upgrade-survivor/assertions.mjs assert-meeting-transcript-export
1435+
fi
14311436
phase gateway-start ensure_gateway_started
14321437
phase gateway-probes check_gateway_probes
14331438
phase gateway-status check_gateway_status

‎scripts/lib/docker-e2e-plan.mts‎

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -528,26 +528,6 @@ function upgradeSurvivorBaselineVersionForLane(poolLane: DockerE2eLane): string
528528
return /(?:^|\/|@)(\d{4}\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/u.exec(spec ?? "")?.[1] ?? null;
529529
}
530530

531-
function configuredChannelIdsForLane(poolLane: DockerE2eLane, scenario: string): Set<string> {
532-
const channelIds = new Set<string>();
533-
const baselineVersion = upgradeSurvivorBaselineVersionForLane(poolLane);
534-
const resolveConfigSteps = resolveUpgradeSurvivorConfigStepsForBaseline as (
535-
scenario: string,
536-
baselineVersion: string | null,
537-
) => ReturnType<typeof resolveUpgradeSurvivorConfigStepsForBaseline>;
538-
for (const step of resolveConfigSteps(scenario, baselineVersion)) {
539-
if (step.argv?.[0] !== "config" || step.argv?.[1] !== "set") {
540-
continue;
541-
}
542-
const match = /^channels\.([a-z0-9][a-z0-9-]*)$/u.exec(step.argv[2] ?? "");
543-
const channelId = match?.[1];
544-
if (channelId) {
545-
channelIds.add(channelId);
546-
}
547-
}
548-
return channelIds;
549-
}
550-
551531
export function requiredPrepublishPluginPackagesForLanes(poolLanes: DockerE2eLane[]): string[] {
552532
const configuredChannelIds = new Set<string>();
553533
const requiredPackages = new Set<string>();
@@ -562,8 +542,21 @@ export function requiredPrepublishPluginPackagesForLanes(poolLanes: DockerE2eLan
562542
for (const packageName of UPGRADE_SURVIVOR_RUNTIME_COMPANION_PACKAGES) {
563543
requiredPackages.add(packageName);
564544
}
565-
for (const channelId of configuredChannelIdsForLane(poolLane, scenario)) {
566-
configuredChannelIds.add(channelId);
545+
const steps = resolveUpgradeSurvivorConfigStepsForBaseline(
546+
scenario,
547+
upgradeSurvivorBaselineVersionForLane(poolLane),
548+
);
549+
for (const step of steps) {
550+
for (const packageName of step.prepublishPluginPackages ?? []) {
551+
requiredPackages.add(packageName);
552+
}
553+
if (step.argv[0] !== "config" || step.argv[1] !== "set") {
554+
continue;
555+
}
556+
const channelId = /^channels\.([a-z0-9][a-z0-9-]*)$/u.exec(step.argv[2] ?? "")?.[1];
557+
if (channelId) {
558+
configuredChannelIds.add(channelId);
559+
}
567560
}
568561
}
569562
for (const packageName of (officialExternalChannelCatalog.entries ?? [])

‎test/scripts/docker-build-helper.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5029,6 +5029,7 @@ if (starts === 1) {
50295029
"phase doctor run_doctor",
50305030
"phase assert-survival assert_survival",
50315031
"phase fixture-plugin-consent repair_fixture_plugin_consent",
5032+
"phase transcript-export node scripts/e2e/lib/upgrade-survivor/assertions.mjs assert-meeting-transcript-export",
50325033
"phase gateway-start ensure_gateway_started",
50335034
]);
50345035
expect(publishedRunner).not.toContain("systemctl --user restart openclaw-gateway.service");

‎test/scripts/docker-e2e-plan.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,24 @@ describe("scripts/lib/docker-e2e-plan", () => {
17351735
expect(requiredPrepublishPluginPackagesForLanes([selfUpgradeLane!])).toEqual([]);
17361736
});
17371737

1738+
it.each([
1739+
{
1740+
baseline: "2026.4.23",
1741+
packages: ["@openclaw/acpx", "@openclaw/codex", "@openclaw/discord", "@openclaw/whatsapp"],
1742+
},
1743+
{ baseline: "2026.4.15", packages: [] },
1744+
])(
1745+
"stages the ACP recipe companion only for supported baseline $baseline",
1746+
({ baseline, packages }) => {
1747+
const plan = planFor({
1748+
selectedLaneNames: ["published-upgrade-survivor"],
1749+
upgradeSurvivorBaselines: baseline,
1750+
upgradeSurvivorScenarios: "acpx-openclaw-tools-bridge",
1751+
});
1752+
expect(plan.requiredPrepublishPluginPackages).toEqual(packages);
1753+
},
1754+
);
1755+
17381756
it("does not request a prerelease plugin registry for unrelated lanes", () => {
17391757
const plan = planFor({ selectedLaneNames: ["doctor-switch"] });
17401758
expect(plan.requiredPrepublishPluginPackages).toEqual([]);

‎test/scripts/upgrade-survivor-assertions.test.ts‎

Lines changed: 79 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { execFileSync, spawnSync } from "node:child_process";
33
import { createHash } from "node:crypto";
44
import { mkdtempSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
55
import { tmpdir } from "node:os";
6-
import { join } from "node:path";
6+
import { delimiter, join } from "node:path";
77
import { DatabaseSync } from "node:sqlite";
88
import { describe, expect, it } from "vitest";
99

@@ -470,7 +470,10 @@ function writeLegacySessionEntriesState(stateDir: string): void {
470470
}
471471
}
472472

473-
function runSessionStateAssertion(setup: (stateDir: string) => void): void {
473+
function runSessionStateAssertion(
474+
setup: (stateDir: string) => void | NodeJS.ProcessEnv,
475+
options: { scenario?: string; commands?: string[] } = {},
476+
): void {
474477
const root = mkdtempSync(join(tmpdir(), "openclaw-upgrade-survivor-session-state-"));
475478
try {
476479
const stateDir = join(root, "state");
@@ -481,17 +484,19 @@ function runSessionStateAssertion(setup: (stateDir: string) => void): void {
481484
writeJson(join(stateDir, "agents", "main", "sessions", "legacy-session.json"), {
482485
id: "legacy-session",
483486
});
484-
setup(stateDir);
485-
486-
execFileSync(process.execPath, [ASSERTIONS_PATH, "assert-state"], {
487-
env: {
488-
...process.env,
489-
OPENCLAW_STATE_DIR: stateDir,
490-
OPENCLAW_TEST_WORKSPACE_DIR: workspace,
491-
OPENCLAW_UPGRADE_SURVIVOR_SCENARIO: "base",
492-
},
493-
stdio: "pipe",
494-
});
487+
const fixtureEnv = setup(stateDir);
488+
for (const command of options.commands ?? ["assert-state"]) {
489+
execFileSync(process.execPath, [ASSERTIONS_PATH, command], {
490+
env: {
491+
...process.env,
492+
...(fixtureEnv ?? {}),
493+
OPENCLAW_STATE_DIR: stateDir,
494+
OPENCLAW_TEST_WORKSPACE_DIR: workspace,
495+
OPENCLAW_UPGRADE_SURVIVOR_SCENARIO: options.scenario ?? "base",
496+
},
497+
stdio: "pipe",
498+
});
499+
}
495500
} finally {
496501
rmSync(root, { force: true, recursive: true });
497502
}
@@ -814,6 +819,67 @@ function assertUpdateRunSelfUpgrade(summary: ReturnType<typeof createUpdateRunSe
814819
}
815820

816821
describe("upgrade survivor assertions", () => {
822+
it.runIf(process.platform !== "win32")(
823+
"rechecks migrated meeting state before materializing transcript exports",
824+
() => {
825+
expect(() =>
826+
runSessionStateAssertion(
827+
(stateDir) => {
828+
writeMigratedSessionState(stateDir);
829+
const archive = join(
830+
stateDir,
831+
"transcripts.migrated-fixture",
832+
"2026-07-01",
833+
"design-review",
834+
);
835+
mkdirSync(archive, { recursive: true });
836+
writeFileSync(
837+
join(archive, "transcript.jsonl"),
838+
["legacy-u-1", "legacy-u-2"].map((id) => JSON.stringify({ id })).join("\n") + "\n",
839+
);
840+
writeFileSync(join(archive, "summary.md"), "Shipped transcript summary\n");
841+
mkdirSync(join(stateDir, "state"), { recursive: true });
842+
const db = new DatabaseSync(join(stateDir, "state", "openclaw.sqlite"));
843+
try {
844+
db.exec(`
845+
CREATE TABLE meeting_transcript_sessions (session_id, started_at, next_utterance_seq);
846+
INSERT INTO meeting_transcript_sessions VALUES ('design-review', '2026-07-01T10:00:00.000Z', 2);
847+
CREATE TABLE meeting_transcript_utterances (session_id, sequence, utterance_id, text);
848+
INSERT INTO meeting_transcript_utterances VALUES ('design-review', 0, 'legacy-u-1', 'First shipped transcript line');
849+
INSERT INTO meeting_transcript_utterances VALUES ('design-review', 1, 'legacy-u-2', 'Second shipped transcript line');
850+
CREATE TABLE migration_sources (migration_kind, status, removed_source, source_record_count);
851+
INSERT INTO migration_sources VALUES ('meeting-transcripts-files-v1', 'archived', 1, 2);
852+
`);
853+
} finally {
854+
db.close();
855+
}
856+
const binDir = join(stateDir, "bin");
857+
mkdirSync(binDir);
858+
writeFileSync(
859+
join(binDir, "openclaw"),
860+
`#!/usr/bin/env node
861+
const assert = require("node:assert/strict");
862+
const fs = require("node:fs");
863+
const path = require("node:path");
864+
assert.deepEqual(process.argv.slice(2), ["transcripts", "path", "2026-07-01/design-review", "--dir"]);
865+
const root = process.env.OPENCLAW_STATE_DIR;
866+
const sessionDir = path.join(root, "transcripts", "2026-07-01", "design-review");
867+
fs.cpSync(path.join(root, "transcripts.migrated-fixture", "2026-07-01", "design-review"), sessionDir, { recursive: true });
868+
process.stdout.write(sessionDir + "\\n");
869+
`,
870+
{ mode: 0o755 },
871+
);
872+
return { PATH: `${binDir}${delimiter}${process.env.PATH}` };
873+
},
874+
{
875+
scenario: "meeting-transcripts-sqlite",
876+
commands: ["assert-state", "assert-state", "assert-meeting-transcript-export"],
877+
},
878+
),
879+
).not.toThrow();
880+
},
881+
);
882+
817883
it("lists the dependency-free scenario contract", () => {
818884
const scenarios = JSON.parse(
819885
execFileSync(process.execPath, [ASSERTIONS_PATH, "list-scenarios"], {

‎test/scripts/upgrade-survivor-update-result.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,37 @@ function check(result: unknown, prefix = "") {
8888
}
8989

9090
describe("published upgrade survivor consent recovery", () => {
91+
it.each(
92+
["acpx", "feishu"].flatMap((pluginId) =>
93+
["error", "ok"].map((status) => ({ pluginId, status })),
94+
),
95+
)("admits $pluginId fixture consent after a $status update", ({ pluginId, status }) => {
96+
const update = deniedUpdate();
97+
const reason = `Plugin "${pluginId}" requires capability consent. Use openclaw plugins install or openclaw plugins enable with --accept-capabilities, then retry.`;
98+
update.postUpdate.plugins.warnings.push({ reason, message: reason });
99+
const result = check({
100+
...update,
101+
status,
102+
reason: status === "error" ? update.reason : undefined,
103+
postUpdate: {
104+
plugins: {
105+
...update.postUpdate.plugins,
106+
status: status === "error" ? "error" : "warning",
107+
reason: status === "error" ? update.postUpdate.plugins.reason : undefined,
108+
},
109+
},
110+
});
111+
expect(result.status, result.stderr).toBe(0);
112+
});
113+
114+
it.each(["acpx", "feishu"])("rejects non-consent failures from reviewed %s", (pluginId) => {
115+
const update = deferredUpdate();
116+
const outcome = expectDefined(update.postUpdate.plugins.npm.outcomes[0], "plugin outcome");
117+
outcome.pluginId = pluginId;
118+
outcome.code = "INSTALL_FAILED";
119+
expect(check(update).status).not.toBe(0);
120+
});
121+
91122
it("repairs capability deferrals even when retaining the old plugin makes core update successful", () => {
92123
const result = check(deferredUpdate());
93124
expect(result.status, result.stderr).toBe(0);

0 commit comments

Comments
 (0)