Skip to content

Commit 9de11f0

Browse files
steipetevincentkoc
andauthored
fix(release): forward-port July guards and restore main validation (#107462)
* fix(installer): validate upgraded Windows SQLite runtime * fix(release): lock packed AI runtime dependency * test(mattermost): tolerate additional fallback diagnostics * test(live): make Claude resume proof explicit * test(plugins): repair exact-main prerelease coverage * test(release): restore root test type coverage --------- Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
1 parent 1d1c121 commit 9de11f0

13 files changed

Lines changed: 663 additions & 47 deletions

‎.github/workflows/openclaw-npm-release.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,13 @@ jobs:
343343
AI_RUNTIME_TARBALL_DIR: ${{ steps.ai_runtime_tarballs.outputs.dir }}
344344
run: |
345345
set -euo pipefail
346+
mapfile -t AI_TARBALLS < <(find "$AI_RUNTIME_TARBALL_DIR" -maxdepth 1 -type f -name 'openclaw-ai-*.tgz' -print | sort)
347+
if [[ "${#AI_TARBALLS[@]}" -ne 1 ]]; then
348+
echo "Expected exactly one prepared @openclaw/ai tarball, found ${#AI_TARBALLS[@]}." >&2
349+
exit 1
350+
fi
351+
AI_TARBALL_PATH="${AI_TARBALLS[0]}"
352+
node --import tsx scripts/prepare-openclaw-npm-shrinkwrap.ts "$AI_TARBALL_PATH"
346353
PACK_OUTPUT="$RUNNER_TEMP/npm-pack-output.txt"
347354
pnpm pack --json 2>&1 | tee "$PACK_OUTPUT"
348355
PACK_NAME="$(node - "$PACK_OUTPUT" <<'NODE'

‎extensions/acpx/index.test.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ describe("acpx plugin", () => {
4747
createAcpxRuntimeServiceMock.mockReturnValue(service);
4848
const openKeyedStore = vi.fn();
4949

50-
const api = {
50+
const api = createTestPluginApi({
5151
pluginConfig: { stateDir: "/tmp/acpx" },
52-
runtime: { state: { openKeyedStore } },
52+
runtime: { state: { openKeyedStore } } as never,
5353
registerService: vi.fn(),
5454
on: vi.fn(),
55-
};
55+
});
5656

57-
plugin.register(api as never);
57+
plugin.register(api);
5858

5959
expect(createAcpxRuntimeServiceMock).toHaveBeenCalledWith({
6060
pluginConfig: api.pluginConfig,
@@ -75,14 +75,14 @@ describe("acpx plugin", () => {
7575
const service = { id: "acpx-service", start: vi.fn() };
7676
createAcpxRuntimeServiceMock.mockReturnValue(service);
7777

78-
const api = {
78+
const api = createTestPluginApi({
7979
pluginConfig: { timeoutSeconds: 180 },
80-
runtime: { state: { openKeyedStore: vi.fn() } },
80+
runtime: { state: { openKeyedStore: vi.fn() } } as never,
8181
registerService: vi.fn(),
8282
on: vi.fn(),
83-
};
83+
});
8484

85-
plugin.register(api as never);
85+
plugin.register(api);
8686

8787
expect(api.on).toHaveBeenCalledWith("reply_dispatch", expect.any(Function), {
8888
timeoutMs: 180_000,
@@ -93,14 +93,14 @@ describe("acpx plugin", () => {
9393
const service = { id: "acpx-service", start: vi.fn() };
9494
createAcpxRuntimeServiceMock.mockReturnValue(service);
9595

96-
const api = {
96+
const api = createTestPluginApi({
9797
pluginConfig: {},
98-
runtime: {},
98+
runtime: {} as never,
9999
registerService: vi.fn(),
100100
on: vi.fn(),
101-
};
101+
});
102102

103-
expect(() => plugin.register(api as never)).not.toThrow();
103+
expect(() => plugin.register(api)).not.toThrow();
104104
expect(api.registerService).toHaveBeenCalledWith(service);
105105
});
106106

‎extensions/acpx/src/config.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ describe("embedded acpx plugin config", () => {
226226
type: "number",
227227
minimum: 0,
228228
},
229+
piSessionCatalog: {
230+
type: "object",
231+
additionalProperties: false,
232+
properties: {
233+
enabled: {
234+
type: "boolean",
235+
default: true,
236+
},
237+
},
238+
},
229239
probeAgent: {
230240
type: "string",
231241
minLength: 1,

‎extensions/mattermost/src/mattermost/slash-http.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,13 @@ describe("slash-http", () => {
928928
}),
929929
).resolves.toBe(true);
930930

931-
expect(log).toHaveBeenCalledTimes(1);
932-
const message = firstLogMessage(log);
931+
const message = log.mock.calls
932+
.map(([entry]) => (typeof entry === "string" ? entry : ""))
933+
.find((entry) => entry.includes("command lookup by id failed"));
934+
expect(message).toBeTruthy();
935+
if (!message) {
936+
throw new Error("expected sanitized Mattermost command lookup failure log");
937+
}
933938
expect(message).not.toMatch(/[\r\n\t]/u);
934939
expect(message).toContain("/oc_status");
935940
expect(message).toContain("primary token=[redacted]");

‎extensions/qa-channel/src/inbound.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe("handleQaInbound", () => {
246246
expect(output).not.toContain(paragraphSeparator);
247247
expect(output).toContain("dispatch\\u000d\\u000aforged\\u2029next");
248248
expect(output).toContain("cleanup\\u000aforged\\u001b[31m\\u009b32m\\u2028next");
249-
expect(output).toContain("[object Undefined]");
249+
expect(output).toContain("reply dispatch failed: undefined");
250250
} finally {
251251
warn.mockRestore();
252252
}

‎extensions/telegram/src/bot-message-dispatch.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4080,8 +4080,8 @@ describe("dispatchTelegramMessage draft streaming", () => {
40804080

40814081
expect(answerDraftStream.updatePreview).toHaveBeenCalledWith(
40824082
telegramProgressPreview(
4083-
"Working\n\n🛠️ Exec\n🛠️ git rev-parse --abbrev-ref HEAD",
4084-
"<b>Working</b>\n<b>🛠️ Exec</b>\n<b>🛠️ Exec</b> <code>git rev-parse --abbrev-ref HEAD</code>",
4083+
"Cracking\n\n🛠️ Exec\n🛠️ git rev-parse --abbrev-ref HEAD",
4084+
"<b>Cracking</b>\n<b>🛠️ Exec</b>\n<b>🛠️ Exec</b> <code>git rev-parse --abbrev-ref HEAD</code>",
40854085
),
40864086
);
40874087
expect(answerDraftStream.update).not.toHaveBeenCalledWith("Branch is up to date");
@@ -4806,7 +4806,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
48064806
});
48074807

48084808
expect(answerDraftStream.updatePreview).toHaveBeenCalledWith(
4809-
telegramProgressPreview("Working\n\n🛠️ Exec", "<b>Working</b>\n<b>🛠️ Exec</b>"),
4809+
telegramProgressPreview("Cracking\n\n🛠️ Exec", "<b>Cracking</b>\n<b>🛠️ Exec</b>"),
48104810
);
48114811
expect(answerDraftStream.update).toHaveBeenCalledTimes(1);
48124812
expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, trailingFinalStatusText);

‎scripts/install.ps1‎

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,24 +172,56 @@ function Test-NodeVersionSupported {
172172
}
173173

174174
function Test-NodeSqliteSupported {
175-
try {
176-
$probe = 'const { DatabaseSync } = require("node:sqlite"); const db = new DatabaseSync(":memory:"); try { const value = db.prepare("SELECT sqlite_version() AS version").get()?.version; const match = typeof value === "string" ? /^(\d+)\.(\d+)\.(\d+)$/.exec(value) : null; const major = Number(match?.[1]); const minor = Number(match?.[2]); const patch = Number(match?.[3]); const safe = major > 3 || (major === 3 && (minor > 51 || (minor === 51 && patch >= 3) || (minor === 50 && patch >= 7) || (minor === 44 && patch >= 6))); if (!safe) process.exitCode = 1; } finally { db.close(); }'
177-
$probe | & node - 2>$null
178-
return ($LASTEXITCODE -eq 0)
179-
} catch {
175+
param([string]$Version)
176+
177+
if ([string]::IsNullOrWhiteSpace($Version)) {
180178
return $false
181179
}
180+
$versionMatch = [regex]::Match($Version, '^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)$')
181+
if (-not $versionMatch.Success) {
182+
return $false
183+
}
184+
$major = [int]$versionMatch.Groups["major"].Value
185+
$minor = [int]$versionMatch.Groups["minor"].Value
186+
$patch = [int]$versionMatch.Groups["patch"].Value
187+
return (
188+
$major -gt 3 -or
189+
(
190+
$major -eq 3 -and
191+
(
192+
$minor -gt 51 -or
193+
($minor -eq 51 -and $patch -ge 3) -or
194+
($minor -eq 50 -and $patch -ge 7) -or
195+
($minor -eq 44 -and $patch -ge 6)
196+
)
197+
)
198+
)
182199
}
183200

184201
function Check-Node {
185202
try {
186-
$nodeVersion = (node -v 2>$null)
203+
$nodeCommand = Get-Command node -CommandType Application -ErrorAction Stop | Select-Object -First 1
204+
$nodePath = $nodeCommand.Source
205+
$nodeVersion = (& $nodePath -v 2>$null)
206+
$sqliteProbe = 'const { DatabaseSync } = require("node:sqlite"); const db = new DatabaseSync(":memory:"); try { process.stdout.write(String(db.prepare("SELECT sqlite_version() AS version").get().version)); } finally { db.close(); }'
207+
$sqliteVersion = ($sqliteProbe | & $nodePath - 2>$null)
208+
if ($LASTEXITCODE -ne 0) {
209+
$sqliteVersion = $null
210+
}
187211
if ($nodeVersion) {
188-
if ((Test-NodeVersionSupported -Version $nodeVersion) -and (Test-NodeSqliteSupported)) {
212+
if (
213+
(Test-NodeVersionSupported -Version $nodeVersion) -and
214+
(Test-NodeSqliteSupported -Version $sqliteVersion)
215+
) {
189216
Write-Host "[OK] Node.js $nodeVersion found" -ForegroundColor Green
190217
return $true
191218
} elseif (Test-NodeVersionSupported -Version $nodeVersion) {
192-
Write-Host "[!] Node.js $nodeVersion uses an unsafe SQLite build; SQLite 3.51.3+ (or patched 3.50.7+/3.44.6+) is required" -ForegroundColor Yellow
219+
$sqliteVersionLabel = if ([string]::IsNullOrWhiteSpace($sqliteVersion)) {
220+
"unavailable"
221+
} else {
222+
$sqliteVersion
223+
}
224+
Write-Host "[!] Node.js $nodeVersion uses SQLite $sqliteVersionLabel; SQLite 3.51.3+ (or patched 3.50.7+/3.44.6+) is required" -ForegroundColor Yellow
193225
return $false
194226
} else {
195227
Write-Host "[!] Node.js $nodeVersion found, but Node 22.22.3+, Node 24.15.0+, or Node 25.9.0+ is required" -ForegroundColor Yellow

‎scripts/openclaw-npm-prepublish-verify.ts‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import {
1515
resolveInstalledBinaryCommandInvocation,
1616
} from "./openclaw-npm-postpublish-verify.ts";
1717
import { resolveNpmCommandInvocation } from "./openclaw-npm-release-check.ts";
18+
import {
19+
assertPreparedOpenClawNpmShrinkwrap,
20+
npmTarballIntegrity,
21+
readTarballJson,
22+
} from "./prepare-openclaw-npm-shrinkwrap.ts";
1823
import { buildCmdExeCommandLine, resolveWindowsCmdExePath } from "./windows-cmd-helpers.mjs";
1924

2025
type InstalledPackageJson = {
@@ -99,18 +104,23 @@ function main(argv = process.argv.slice(2)): void {
99104
let binaryInvocation: NpmVerifyCommandInvocation;
100105
let packageRoot: string;
101106
if (usesPreparedLocalDependencyInstall(args.dependencyTarballPaths.length)) {
107+
const aiTarballPath = realpathSync(
108+
expectDefined(args.dependencyTarballPaths[0], "prepared dependency tarball"),
109+
);
110+
assertPreparedOpenClawNpmShrinkwrap({
111+
aiIntegrity: npmTarballIntegrity(aiTarballPath),
112+
aiManifest: readTarballJson(aiTarballPath, "package/package.json"),
113+
rootManifest: readTarballJson(args.tarballPath, "package/package.json"),
114+
shrinkwrap: readTarballJson(args.tarballPath, "package/npm-shrinkwrap.json"),
115+
});
102116
mkdirSync(prefixDir, { recursive: true });
103117
writeFileSync(
104118
join(prefixDir, "package.json"),
105119
`${JSON.stringify(
106120
{
107121
private: true,
108122
dependencies: {
109-
"@openclaw/ai": pathToFileURL(
110-
realpathSync(
111-
expectDefined(args.dependencyTarballPaths[0], "prepared dependency tarball"),
112-
),
113-
).href,
123+
"@openclaw/ai": pathToFileURL(aiTarballPath).href,
114124
openclaw: pathToFileURL(realpathSync(args.tarballPath)).href,
115125
},
116126
},

0 commit comments

Comments
 (0)