gentle-pi 2.6.2 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/gentle-shell.md +1 -1
- package/docs/readme-reference.md +5 -5
- package/extensions/gentle-agents.ts +118 -8
- package/lib/agents-history.ts +82 -1
- package/lib/agents-runner.ts +44 -11
- package/lib/native-review-cli.ts +13 -0
- package/package.json +1 -1
- package/runtime/native-review-cli.mjs +13 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/verify-package-files.mjs +2 -2
- package/tests/agents-history.test.ts +23 -1
- package/tests/agents-runner.test.ts +154 -2
- package/tests/gentle-agents.test.ts +80 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-installer.test.ts +47 -47
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/package-manifest.test.ts +6 -6
- package/tests/sdd-managed-runtime-settlement.test.ts +75 -0
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
trustedSystemExtractor,
|
|
21
21
|
} from "../scripts/gentle-ai-installer.mjs";
|
|
22
22
|
|
|
23
|
-
// v2.
|
|
23
|
+
// v2.9.0 digests pinned from the published release: archive digests verified
|
|
24
24
|
// against the minisign-signed checksums.txt and freshly computed hashes; binary
|
|
25
25
|
// digests computed from the extracted executables.
|
|
26
26
|
const EXPECTED_ASSETS = {
|
|
27
|
-
"darwin/amd64": { name: "gentle-ai_2.
|
|
28
|
-
"darwin/arm64": { name: "gentle-ai_2.
|
|
29
|
-
"linux/amd64": { name: "gentle-ai_2.
|
|
30
|
-
"linux/arm64": { name: "gentle-ai_2.
|
|
27
|
+
"darwin/amd64": { name: "gentle-ai_2.9.0_darwin_amd64.tar.gz", sha256: "0e1ce0b117e6f15b56e05defecb33a33825c2e25eb8306df09401d41e0a176fb", binarySha256: "0dc22de552e0403f318770067adccd82783b1f654ed4d0410d7d969e28e39602" },
|
|
28
|
+
"darwin/arm64": { name: "gentle-ai_2.9.0_darwin_arm64.tar.gz", sha256: "0a58d81cd7d76315e1d11ecf6b38abb27ee8e7e709a04c9a786e89636fb559bb", binarySha256: "5e72f1f34667a858fc179504e794847a1407142240361f99effd252d6ad49ee9" },
|
|
29
|
+
"linux/amd64": { name: "gentle-ai_2.9.0_linux_amd64.tar.gz", sha256: "7d414cd8cba8ddc0ab9fa4bc309932638c533217b2f999b2a52e7a4fc0bf6f14", binarySha256: "5c47029fb6520f99b7df1b6841766b09d7184efed2e18694d83795bf4d4a5ad4" },
|
|
30
|
+
"linux/arm64": { name: "gentle-ai_2.9.0_linux_arm64.tar.gz", sha256: "2bdab4684b5d415df9c9423c2022b017c7c1c1d9056f56acc08633fa0d821cfc", binarySha256: "56501a4d91f4e3255726b63c59b96a6d42c6952af2d265f54c8e99b361cda0c9" },
|
|
31
31
|
} as const;
|
|
32
32
|
|
|
33
33
|
test("default installer package root is the package containing scripts, not its parent", () => {
|
|
@@ -38,15 +38,15 @@ test("default installer package root is the package containing scripts, not its
|
|
|
38
38
|
assert.notEqual(resolveGentleAiInstallerPackageRoot(), dirname(expectedPackageRoot));
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
test("release mapping selects only the supported official v2.
|
|
41
|
+
test("release mapping selects only the supported official v2.9.0 assets and pinned digests", () => {
|
|
42
42
|
assert.deepEqual(
|
|
43
43
|
Object.fromEntries(Object.entries(GENTLE_AI_RELEASE_ASSETS).map(([key, asset]) => [key, { name: asset.name, sha256: asset.sha256, binarySha256: asset.binarySha256 }])),
|
|
44
44
|
EXPECTED_ASSETS,
|
|
45
45
|
);
|
|
46
|
-
assert.equal(resolveGentleAiReleaseAsset("linux", "x64").name, "gentle-ai_2.
|
|
47
|
-
assert.equal(resolveGentleAiReleaseAsset("darwin", "arm64").name, "gentle-ai_2.
|
|
46
|
+
assert.equal(resolveGentleAiReleaseAsset("linux", "x64").name, "gentle-ai_2.9.0_linux_amd64.tar.gz");
|
|
47
|
+
assert.equal(resolveGentleAiReleaseAsset("darwin", "arm64").name, "gentle-ai_2.9.0_darwin_arm64.tar.gz");
|
|
48
48
|
for (const asset of Object.values(GENTLE_AI_RELEASE_ASSETS)) {
|
|
49
|
-
assert.match(asset.url, /^https:\/\/github\.com\/Gentleman-Programming\/gentle-ai\/releases\/download\/v2\.
|
|
49
|
+
assert.match(asset.url, /^https:\/\/github\.com\/Gentleman-Programming\/gentle-ai\/releases\/download\/v2\.9\.0\//);
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -56,7 +56,7 @@ test("raw release assets are admitted only under a prerelease pin", () => {
|
|
|
56
56
|
assert.equal(gentleAiAssetForm("gentle-ai_2.5.0-rc.3_windows_amd64.exe", "2.5.0-rc.3"), "raw-binary");
|
|
57
57
|
// A raw binary under a stable pin means the pin itself is wrong: stable
|
|
58
58
|
// releases publish signed archives only, so this fails closed pre-download.
|
|
59
|
-
assert.throws(() => gentleAiAssetForm("gentle-ai_2.
|
|
59
|
+
assert.throws(() => gentleAiAssetForm("gentle-ai_2.9.0_linux_amd64", "2.9.0"), /only admitted for a prerelease pin/);
|
|
60
60
|
assert.throws(() => gentleAiAssetForm("gentle-ai.dmg", "2.5.0-rc.3"), /unsupported Gentle AI release asset form/);
|
|
61
61
|
// The current stable pin admits every pinned asset row through the same
|
|
62
62
|
// gate the installer uses at download time (default installerVersion
|
|
@@ -83,7 +83,7 @@ test("release digests are all-or-none and install fails closed while any digest
|
|
|
83
83
|
}),
|
|
84
84
|
/checksum mismatch/,
|
|
85
85
|
);
|
|
86
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
86
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai")), false);
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
|
|
@@ -112,7 +112,7 @@ function windowsGoFixture(fixtureOptions: WindowsGoFixtureOptions = {}) {
|
|
|
112
112
|
const metadata = [
|
|
113
113
|
"gentle-ai.exe: go1.25.10",
|
|
114
114
|
"\tpath\tgithub.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai",
|
|
115
|
-
`\tmod\tgithub.com/gentleman-programming/gentle-ai/v2\tv2.
|
|
115
|
+
`\tmod\tgithub.com/gentleman-programming/gentle-ai/v2\tv2.9.0\t${GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM}`,
|
|
116
116
|
"\tbuild\t-buildmode=exe", "\tbuild\t-compiler=gc", "\tbuild\tCGO_ENABLED=0", `\tbuild\tGOARCH=${fixtureOptions.goArchitecture ?? "amd64"}`, "\tbuild\tGOOS=windows",
|
|
117
117
|
].join("\n");
|
|
118
118
|
const run = async (file: string, arguments_: string[], options: WindowsGoCall["options"]) => {
|
|
@@ -130,7 +130,7 @@ function windowsGoFixture(fixtureOptions: WindowsGoFixtureOptions = {}) {
|
|
|
130
130
|
return { stdout: "", stderr: "" };
|
|
131
131
|
}
|
|
132
132
|
if (file === goExecutable && arguments_[0] === "version" && arguments_[1] === "-m") return { stdout: metadata, stderr: "" };
|
|
133
|
-
if (arguments_.length === 1 && arguments_[0] === "version") return { stdout: fixtureOptions.reportedVersion ?? "gentle-ai 2.
|
|
133
|
+
if (arguments_.length === 1 && arguments_[0] === "version") return { stdout: fixtureOptions.reportedVersion ?? "gentle-ai 2.9.0\n", stderr: "" };
|
|
134
134
|
throw new Error(`unexpected command: ${file} ${arguments_.join(" ")}`);
|
|
135
135
|
};
|
|
136
136
|
return { calls, run, setGoExecutable: (path: string) => { goExecutable = path; } };
|
|
@@ -146,7 +146,7 @@ test("win32 x64 and arm64 install the exact Go SumDB source tag without archive
|
|
|
146
146
|
const result = await installGentleAi({ packageRoot, platform: "win32", arch, execFile: fixture.run, resolveGoExecutable: async () => goPath });
|
|
147
147
|
assert.equal(result.installed, true);
|
|
148
148
|
assert.deepEqual(fixture.calls.filter((call) => call.file === goPath).map((call) => call.arguments_.slice(0, 2)), [
|
|
149
|
-
["version"], ["install", "github.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai@v2.
|
|
149
|
+
["version"], ["install", "github.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai@v2.9.0"], ["version", "-m"],
|
|
150
150
|
]);
|
|
151
151
|
}
|
|
152
152
|
});
|
|
@@ -165,7 +165,7 @@ test("Windows source install reports missing or too-old Go without publishing a
|
|
|
165
165
|
() => installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: async () => goPath }),
|
|
166
166
|
(error: unknown) => error instanceof Error && "code" in error && error.code === fixtureOptions.expectedCode,
|
|
167
167
|
);
|
|
168
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
168
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai.exe")), false);
|
|
169
169
|
assert.deepEqual((await readdir(packageRoot)).filter((entry) => entry.includes("install-")), []);
|
|
170
170
|
}
|
|
171
171
|
});
|
|
@@ -184,7 +184,7 @@ test("Windows source install cleans staging after Go failure or wrong built vers
|
|
|
184
184
|
() => installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: async () => goPath }),
|
|
185
185
|
(error: unknown) => error instanceof Error && "code" in error && error.code === fixtureOptions.expectedCode,
|
|
186
186
|
);
|
|
187
|
-
const runtimeDirectory = join(packageRoot, ".gentle-ai", "v2.
|
|
187
|
+
const runtimeDirectory = join(packageRoot, ".gentle-ai", "v2.9.0");
|
|
188
188
|
assert.ok(fixture.calls.some((call) => call.arguments_[0] === "install"));
|
|
189
189
|
assert.equal(existsSync(join(runtimeDirectory, "gentle-ai.exe")), false);
|
|
190
190
|
assert.equal(existsSync(runtimeDirectory) && (await readdir(runtimeDirectory)).some((entry) => entry.startsWith(".go-install-") || entry.endsWith(".tmp")), false);
|
|
@@ -205,7 +205,7 @@ test("Windows source installs reuse only a fully verified package-local binary",
|
|
|
205
205
|
assert.equal(reused.installed, false);
|
|
206
206
|
assert.ok(reuse.calls.every((call) => call.file !== "gentle-ai"), "the installer must never fall back to ambient gentle-ai on PATH");
|
|
207
207
|
|
|
208
|
-
await writeFile(join(packageRoot, ".gentle-ai", "v2.
|
|
208
|
+
await writeFile(join(packageRoot, ".gentle-ai", "v2.9.0", "integrity.json"), "{}\n");
|
|
209
209
|
const repaired = windowsGoFixture();
|
|
210
210
|
repaired.setGoExecutable(goPath);
|
|
211
211
|
assert.equal((await installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: repaired.run, resolveGoExecutable: async () => goPath })).installed, true);
|
|
@@ -247,7 +247,7 @@ async function hardenedWindowsGoFixture(packageRoot: string, fixtureOptions: Har
|
|
|
247
247
|
const metadata = fixtureOptions.metadataOverride ?? [
|
|
248
248
|
"gentle-ai.exe: go1.25.10",
|
|
249
249
|
"\tpath\tgithub.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai",
|
|
250
|
-
`\tmod\tgithub.com/gentleman-programming/gentle-ai/v2\tv2.
|
|
250
|
+
`\tmod\tgithub.com/gentleman-programming/gentle-ai/v2\tv2.9.0\t${GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM}`,
|
|
251
251
|
"\tbuild\t-buildmode=exe",
|
|
252
252
|
"\tbuild\t-compiler=gc",
|
|
253
253
|
"\tbuild\tCGO_ENABLED=0",
|
|
@@ -267,7 +267,7 @@ async function hardenedWindowsGoFixture(packageRoot: string, fixtureOptions: Har
|
|
|
267
267
|
return { stdout: "", stderr: "" };
|
|
268
268
|
}
|
|
269
269
|
if (file === goPath && arguments_[0] === "version" && arguments_[1] === "-m") return { stdout: metadata, stderr: "" };
|
|
270
|
-
if (arguments_.length === 1 && arguments_[0] === "version") return { stdout: "gentle-ai 2.
|
|
270
|
+
if (arguments_.length === 1 && arguments_[0] === "version") return { stdout: "gentle-ai 2.9.0\n", stderr: "" };
|
|
271
271
|
throw new Error(`unexpected command: ${file} ${arguments_.join(" ")}`);
|
|
272
272
|
};
|
|
273
273
|
return {
|
|
@@ -309,7 +309,7 @@ test("Windows source installation resolves one validated Go executable and seals
|
|
|
309
309
|
const goCalls = fixture.calls.filter((call) => call.file === fixture.goPath);
|
|
310
310
|
assert.deepEqual(goCalls.map((call) => call.arguments_.slice(0, 2)), [
|
|
311
311
|
["version"],
|
|
312
|
-
["install", "github.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai@v2.
|
|
312
|
+
["install", "github.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai@v2.9.0"],
|
|
313
313
|
["version", "-m"],
|
|
314
314
|
]);
|
|
315
315
|
for (const call of goCalls) {
|
|
@@ -335,14 +335,14 @@ test("Windows source manifest binds verified Go metadata and architecture", asyn
|
|
|
335
335
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-provenance-"));
|
|
336
336
|
const fixture = await hardenedWindowsGoFixture(packageRoot, { architecture: "arm64" });
|
|
337
337
|
const result = await installGentleAi({ packageRoot, platform: "win32", arch: "arm64", execFile: fixture.run, resolveGoExecutable: fixture.resolveGoExecutable });
|
|
338
|
-
const manifest = JSON.parse(await readFile(join(packageRoot, ".gentle-ai", "v2.
|
|
338
|
+
const manifest = JSON.parse(await readFile(join(packageRoot, ".gentle-ai", "v2.9.0", "integrity.json"), "utf8")) as Record<string, string>;
|
|
339
339
|
assert.equal(result.installed, true);
|
|
340
340
|
assert.deepEqual(manifest, {
|
|
341
|
-
version: "2.
|
|
341
|
+
version: "2.9.0",
|
|
342
342
|
method: "go-sumdb-source-build",
|
|
343
343
|
package: "github.com/gentleman-programming/gentle-ai/v2/cmd/gentle-ai",
|
|
344
344
|
module: "github.com/gentleman-programming/gentle-ai/v2",
|
|
345
|
-
tag: "v2.
|
|
345
|
+
tag: "v2.9.0",
|
|
346
346
|
architecture: "arm64",
|
|
347
347
|
binarySha256: createHash("sha256").update("trusted Windows source build").digest("hex"),
|
|
348
348
|
moduleChecksum: GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM,
|
|
@@ -362,12 +362,12 @@ test("Windows source installation rejects Go metadata for a different architectu
|
|
|
362
362
|
() => installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: fixture.resolveGoExecutable }),
|
|
363
363
|
(error: unknown) => error instanceof Error && "code" in error && error.code === "GENTLE_AI_GO_INSTALL_FAILED",
|
|
364
364
|
);
|
|
365
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
365
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai.exe")), false);
|
|
366
366
|
});
|
|
367
367
|
|
|
368
368
|
test("Windows source installation treats a fresh ownerless lock as active", async () => {
|
|
369
369
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-ownerless-lock-"));
|
|
370
|
-
const lockPath = join(packageRoot, ".gentle-ai", ".v2.
|
|
370
|
+
const lockPath = join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock");
|
|
371
371
|
await mkdir(lockPath, { recursive: true });
|
|
372
372
|
const fixture = await hardenedWindowsGoFixture(packageRoot);
|
|
373
373
|
await assertManualLockRecoveryRequired(packageRoot, fixture);
|
|
@@ -375,7 +375,7 @@ test("Windows source installation treats a fresh ownerless lock as active", asyn
|
|
|
375
375
|
|
|
376
376
|
test("Windows source installation preserves a lock whose owner nonce changed before release", async () => {
|
|
377
377
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-owner-lock-"));
|
|
378
|
-
const lockOwnerPath = join(packageRoot, ".gentle-ai", ".v2.
|
|
378
|
+
const lockOwnerPath = join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock", "owner.json");
|
|
379
379
|
const fixture = await hardenedWindowsGoFixture(packageRoot);
|
|
380
380
|
let replacedOwner = false;
|
|
381
381
|
const run = async (...arguments_: Parameters<typeof fixture.run>) => {
|
|
@@ -392,7 +392,7 @@ test("Windows source installation preserves a lock whose owner nonce changed bef
|
|
|
392
392
|
});
|
|
393
393
|
|
|
394
394
|
async function assertManualLockRecoveryRequired(packageRoot: string, fixture: Awaited<ReturnType<typeof hardenedWindowsGoFixture>>, options: Record<string, unknown> = {}) {
|
|
395
|
-
const lockPath = join(packageRoot, ".gentle-ai", ".v2.
|
|
395
|
+
const lockPath = join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock");
|
|
396
396
|
await assert.rejects(
|
|
397
397
|
() => installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: fixture.resolveGoExecutable, ...options }),
|
|
398
398
|
(error: unknown) => error instanceof Error && error.message.includes(lockPath) && /confirm no installer is active.*remove.*manually/i.test(error.message),
|
|
@@ -402,18 +402,18 @@ async function assertManualLockRecoveryRequired(packageRoot: string, fixture: Aw
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
function tombstonePath(packageRoot: string, nonce: string): string {
|
|
405
|
-
return join(packageRoot, ".gentle-ai", `.v2.
|
|
405
|
+
return join(packageRoot, ".gentle-ai", `.v2.9.0.install.tombstone-${nonce}`);
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
async function tombstones(packageRoot: string): Promise<string[]> {
|
|
409
409
|
const runtimeRoot = join(packageRoot, ".gentle-ai");
|
|
410
410
|
return existsSync(runtimeRoot)
|
|
411
|
-
? (await readdir(runtimeRoot)).filter((entry) => entry.startsWith(".v2.
|
|
411
|
+
? (await readdir(runtimeRoot)).filter((entry) => entry.startsWith(".v2.9.0.install.tombstone-"))
|
|
412
412
|
: [];
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
function backupBundlePath(packageRoot: string, nonce: string): string {
|
|
416
|
-
return join(packageRoot, ".gentle-ai", `.v2.
|
|
416
|
+
return join(packageRoot, ".gentle-ai", `.v2.9.0.backup-${nonce}`);
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
async function copyWindowsBundle(source: string, destination: string): Promise<void> {
|
|
@@ -424,7 +424,7 @@ async function copyWindowsBundle(source: string, destination: string): Promise<v
|
|
|
424
424
|
|
|
425
425
|
test("Windows source installation fails closed for an ownerless lock even after the stale threshold", async () => {
|
|
426
426
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-ownerless-stale-lock-"));
|
|
427
|
-
const lockPath = join(packageRoot, ".gentle-ai", ".v2.
|
|
427
|
+
const lockPath = join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock");
|
|
428
428
|
await mkdir(lockPath, { recursive: true });
|
|
429
429
|
const fixture = await hardenedWindowsGoFixture(packageRoot);
|
|
430
430
|
await assertManualLockRecoveryRequired(packageRoot, fixture, { now: () => Date.now() + 10 * 60_000 });
|
|
@@ -432,7 +432,7 @@ test("Windows source installation fails closed for an ownerless lock even after
|
|
|
432
432
|
|
|
433
433
|
test("Windows source installation fails closed for a stale owner lock", async () => {
|
|
434
434
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-stale-lock-"));
|
|
435
|
-
const lockPath = join(packageRoot, ".gentle-ai", ".v2.
|
|
435
|
+
const lockPath = join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock");
|
|
436
436
|
await mkdir(lockPath, { recursive: true });
|
|
437
437
|
await writeFile(join(lockPath, "owner.json"), `${JSON.stringify({ createdAt: 0, nonce: "0".repeat(64) })}\n`);
|
|
438
438
|
const fixture = await hardenedWindowsGoFixture(packageRoot);
|
|
@@ -484,7 +484,7 @@ test("Windows source acquisition fails closed when a tombstone appears after its
|
|
|
484
484
|
(error: unknown) => error instanceof Error && error.message.includes(foreignTombstone),
|
|
485
485
|
);
|
|
486
486
|
assert.equal(existsSync(foreignTombstone), true);
|
|
487
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", ".v2.
|
|
487
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock")), false);
|
|
488
488
|
assert.equal(fixture.calls.some((call) => call.arguments_[0] === "install"), false);
|
|
489
489
|
});
|
|
490
490
|
|
|
@@ -492,7 +492,7 @@ test("Windows source release deletes its matching tombstone and allows reuse", a
|
|
|
492
492
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-owned-lock-release-"));
|
|
493
493
|
const fixture = await hardenedWindowsGoFixture(packageRoot);
|
|
494
494
|
await installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: fixture.resolveGoExecutable });
|
|
495
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", ".v2.
|
|
495
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock")), false);
|
|
496
496
|
assert.deepEqual(await tombstones(packageRoot), []);
|
|
497
497
|
const reuse = await hardenedWindowsGoFixture(packageRoot);
|
|
498
498
|
assert.equal((await installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: reuse.run, resolveGoExecutable: reuse.resolveGoExecutable })).installed, false);
|
|
@@ -502,7 +502,7 @@ test("Windows source recovers a valid backup after a crash between publication r
|
|
|
502
502
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-backup-crash-"));
|
|
503
503
|
const initial = await hardenedWindowsGoFixture(packageRoot);
|
|
504
504
|
await installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: initial.run, resolveGoExecutable: initial.resolveGoExecutable });
|
|
505
|
-
const live = join(packageRoot, ".gentle-ai", "v2.
|
|
505
|
+
const live = join(packageRoot, ".gentle-ai", "v2.9.0");
|
|
506
506
|
const backup = backupBundlePath(packageRoot, "crash");
|
|
507
507
|
await rename(live, backup);
|
|
508
508
|
const recovery = await hardenedWindowsGoFixture(packageRoot);
|
|
@@ -538,7 +538,7 @@ test("Windows source cleans one validated backup only when the live bundle is va
|
|
|
538
538
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-backup-valid-live-"));
|
|
539
539
|
const initial = await hardenedWindowsGoFixture(packageRoot);
|
|
540
540
|
await installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: initial.run, resolveGoExecutable: initial.resolveGoExecutable });
|
|
541
|
-
const live = join(packageRoot, ".gentle-ai", "v2.
|
|
541
|
+
const live = join(packageRoot, ".gentle-ai", "v2.9.0");
|
|
542
542
|
const backup = backupBundlePath(packageRoot, "valid");
|
|
543
543
|
await copyWindowsBundle(live, backup);
|
|
544
544
|
const reuse = await hardenedWindowsGoFixture(packageRoot);
|
|
@@ -551,7 +551,7 @@ test("Windows source preserves a valid backup when the live bundle is invalid",
|
|
|
551
551
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-backup-invalid-live-"));
|
|
552
552
|
const initial = await hardenedWindowsGoFixture(packageRoot);
|
|
553
553
|
await installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: initial.run, resolveGoExecutable: initial.resolveGoExecutable });
|
|
554
|
-
const live = join(packageRoot, ".gentle-ai", "v2.
|
|
554
|
+
const live = join(packageRoot, ".gentle-ai", "v2.9.0");
|
|
555
555
|
const backup = backupBundlePath(packageRoot, "valid");
|
|
556
556
|
await copyWindowsBundle(live, backup);
|
|
557
557
|
await writeFile(join(live, "integrity.json"), "{}\n");
|
|
@@ -569,7 +569,7 @@ test("Windows concurrent installs fail closed until normal release, then reuse t
|
|
|
569
569
|
const fixture = await hardenedWindowsGoFixture(packageRoot, { blockInstall: true });
|
|
570
570
|
const first = installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: fixture.resolveGoExecutable });
|
|
571
571
|
await fixture.waitForInstall();
|
|
572
|
-
const lockPath = join(packageRoot, ".gentle-ai", ".v2.
|
|
572
|
+
const lockPath = join(packageRoot, ".gentle-ai", ".v2.9.0.install.lock");
|
|
573
573
|
await assert.rejects(
|
|
574
574
|
() => installGentleAi({ packageRoot, platform: "win32", arch: "x64", execFile: fixture.run, resolveGoExecutable: fixture.resolveGoExecutable }),
|
|
575
575
|
(error: unknown) => error instanceof Error && error.message.includes(lockPath),
|
|
@@ -583,7 +583,7 @@ test("Windows concurrent installs fail closed until normal release, then reuse t
|
|
|
583
583
|
|
|
584
584
|
test("Windows source publication rolls back a prior bundle when final directory swap fails", async () => {
|
|
585
585
|
const packageRoot = await mkdtemp(join(tmpdir(), "gentle-pi-installer-rollback-"));
|
|
586
|
-
const versionDirectory = join(packageRoot, ".gentle-ai", "v2.
|
|
586
|
+
const versionDirectory = join(packageRoot, ".gentle-ai", "v2.9.0");
|
|
587
587
|
await mkdir(versionDirectory, { recursive: true });
|
|
588
588
|
await writeFile(join(versionDirectory, "old.txt"), "previous bundle");
|
|
589
589
|
const fixture = await hardenedWindowsGoFixture(packageRoot);
|
|
@@ -620,7 +620,7 @@ test("Darwin/Linux signed bundles retain their four-field manifest and reusable
|
|
|
620
620
|
},
|
|
621
621
|
};
|
|
622
622
|
await installGentleAi(options);
|
|
623
|
-
const manifestPath = join(packageRoot, ".gentle-ai", "v2.
|
|
623
|
+
const manifestPath = join(packageRoot, ".gentle-ai", "v2.9.0", "integrity.json");
|
|
624
624
|
const manifest = JSON.parse(await readFile(manifestPath, "utf8")) as Record<string, string>;
|
|
625
625
|
assert.deepEqual(Object.keys(manifest), ["version", "asset", "assetSha256", "binarySha256"]);
|
|
626
626
|
assert.equal((await installGentleAi({ ...options, download: async () => { throw new Error("signed bundle must be reused"); } })).installed, false);
|
|
@@ -633,7 +633,7 @@ test("a pinned asset falls back to its gentle-pi mirror only on download failure
|
|
|
633
633
|
// under the current stable pin, whose form gate refuses raw binaries.
|
|
634
634
|
const payload = Buffer.from("signed archive fixture");
|
|
635
635
|
const binary = "mirrored binary";
|
|
636
|
-
const baseAsset = { name: "gentle-ai_2.
|
|
636
|
+
const baseAsset = { name: "gentle-ai_2.9.0_linux_amd64.tar.gz", sha256: createHash("sha256").update(payload).digest("hex"), binarySha256: createHash("sha256").update(binary).digest("hex"), url: "https://example.invalid/upstream", mirrorUrl: "https://example.invalid/mirror", executable: "gentle-ai" };
|
|
637
637
|
const extractArchive = async (_archive: string, destination: string) => {
|
|
638
638
|
await mkdir(destination, { recursive: true });
|
|
639
639
|
await writeFile(join(destination, "gentle-ai"), binary);
|
|
@@ -751,7 +751,7 @@ test("checksum mismatch cleans temporary state without promoting a binary", asyn
|
|
|
751
751
|
}),
|
|
752
752
|
/checksum mismatch/,
|
|
753
753
|
);
|
|
754
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
754
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai")), false);
|
|
755
755
|
assert.deepEqual((await readdir(packageRoot)).filter((entry) => entry.startsWith(".gentle-ai-install-")), []);
|
|
756
756
|
});
|
|
757
757
|
|
|
@@ -773,7 +773,7 @@ test("installer promotes only the expected regular executable with executable PO
|
|
|
773
773
|
await chmod(extracted, 0o700);
|
|
774
774
|
},
|
|
775
775
|
});
|
|
776
|
-
const binary = join(packageRoot, ".gentle-ai", "v2.
|
|
776
|
+
const binary = join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai");
|
|
777
777
|
assert.equal(existsSync(binary), true);
|
|
778
778
|
assert.equal(await readFile(binary, "utf8"), "native executable");
|
|
779
779
|
assert.ok(((await stat(binary)).mode & 0o111) !== 0);
|
|
@@ -804,7 +804,7 @@ test("installer rejects an extracted binary that differs from its pinned digest"
|
|
|
804
804
|
}),
|
|
805
805
|
/binary checksum mismatch/,
|
|
806
806
|
);
|
|
807
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
807
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai")), false);
|
|
808
808
|
});
|
|
809
809
|
|
|
810
810
|
test("installer repairs a valid non-executable POSIX binary instead of reusing it", async (t) => {
|
|
@@ -827,7 +827,7 @@ test("installer repairs a valid non-executable POSIX binary instead of reusing i
|
|
|
827
827
|
},
|
|
828
828
|
};
|
|
829
829
|
await installGentleAi(options);
|
|
830
|
-
const binary = join(packageRoot, ".gentle-ai", "v2.
|
|
830
|
+
const binary = join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai");
|
|
831
831
|
await chmod(binary, 0o600);
|
|
832
832
|
const repaired = await installGentleAi(options);
|
|
833
833
|
assert.equal(repaired.installed, true);
|
|
@@ -864,7 +864,7 @@ test("installer rejects archives with multiple expected executable entries", asy
|
|
|
864
864
|
}),
|
|
865
865
|
/exactly one regular gentle-ai/,
|
|
866
866
|
);
|
|
867
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
867
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai")), false);
|
|
868
868
|
});
|
|
869
869
|
|
|
870
870
|
test("installer rejects an archive without the expected regular executable", async () => {
|
|
@@ -882,7 +882,7 @@ test("installer rejects an archive without the expected regular executable", asy
|
|
|
882
882
|
}),
|
|
883
883
|
/non-regular gentle-ai/,
|
|
884
884
|
);
|
|
885
|
-
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.
|
|
885
|
+
assert.equal(existsSync(join(packageRoot, ".gentle-ai", "v2.9.0", "gentle-ai")), false);
|
|
886
886
|
});
|
|
887
887
|
|
|
888
888
|
// #400: a clean Windows source build measured 232 s on a cold module cache,
|
|
@@ -216,11 +216,27 @@ test("2.8.2 repeats 2.8.1 because the negotiated lane Pi consumes is unchanged",
|
|
|
216
216
|
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["2.8.1"] as Record<string, boolean>);
|
|
217
217
|
});
|
|
218
218
|
|
|
219
|
+
test("2.9.0 repeats 2.8.2 because the negotiated lane Pi consumes is unchanged", () => {
|
|
220
|
+
// v2.9.0 shipped RTK opt-in Community Tool integration (#4560,
|
|
221
|
+
// installer/sync/TUI only), SDD attempt-ledger fixes (#4564, #4567,
|
|
222
|
+
// #4569), sync telemetry-runtime symlinked root (#4565), OpenCode
|
|
223
|
+
// reviewer Task wrapper decoding (#4545), and Engram protocol asset
|
|
224
|
+
// wording (#4179). Diffing contracts/review-integration/v2 and
|
|
225
|
+
// contracts/review-provider-contract between the v2.8.2 and v2.9.0 tags
|
|
226
|
+
// in the gentle-ai source tree showed zero byte changes, so this row
|
|
227
|
+
// repeats 2.8.2. riskEvidence and hint remain dark because neither is
|
|
228
|
+
// proven to reach Pi's negotiated START path.
|
|
229
|
+
const contract = NATIVE_CLI_CONTRACTS["2.9.0"] as Record<string, boolean>;
|
|
230
|
+
assert.equal(contract.riskEvidence, false);
|
|
231
|
+
assert.equal(contract.hint, false);
|
|
232
|
+
assert.deepEqual(contract, NATIVE_CLI_CONTRACTS["2.8.2"] as Record<string, boolean>);
|
|
233
|
+
});
|
|
234
|
+
|
|
219
235
|
test("no shipped version key was added beyond the pin bump", () => {
|
|
220
236
|
// Rows are promises to consumers, so a new key only ever appears in a
|
|
221
237
|
// dedicated commit alongside a pin bump, never as a side effect. v2.2.4 and
|
|
222
238
|
// v2.3.0 shipped upstream while Pi stayed on 2.2.3 and were never pinned,
|
|
223
239
|
// so they get no row: a row asserts ground truth measured against a binary
|
|
224
240
|
// Pi actually ran, and the table only has to be ascending, not gapless.
|
|
225
|
-
assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2"]);
|
|
241
|
+
assert.deepEqual(Object.keys(NATIVE_CLI_CONTRACTS), [...DARK_VERSIONS, "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.4.0", "2.5.0-rc.3", "2.5.0", "2.6.0", "2.7.0", "2.8.0", "2.8.1", "2.8.2", "2.9.0"]);
|
|
226
242
|
});
|
|
@@ -278,20 +278,20 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
|
|
|
278
278
|
);
|
|
279
279
|
});
|
|
280
280
|
|
|
281
|
-
test("package verification binds the published Gentle AI v2.
|
|
281
|
+
test("package verification binds the published Gentle AI v2.9.0 runtime pin", () => {
|
|
282
282
|
const installer = readFileSync(join(PACKAGE_ROOT, "scripts", "gentle-ai-installer.mjs"), "utf8");
|
|
283
283
|
const binary = readFileSync(join(PACKAGE_ROOT, "lib", "gentle-ai-binary.ts"), "utf8");
|
|
284
284
|
const verifier = readFileSync(join(PACKAGE_ROOT, "scripts", "verify-package-files.mjs"), "utf8");
|
|
285
285
|
|
|
286
|
-
assert.match(installer, /INSTALLER_VERSION = "2\.
|
|
286
|
+
assert.match(installer, /INSTALLER_VERSION = "2\.9\.0"/);
|
|
287
287
|
assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_PACKAGE.*GENTLE_AI_WINDOWS_SOURCE_MODULE/);
|
|
288
|
-
assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:
|
|
288
|
+
assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:WqmYw1UfVYCbtOxU1uTuiYq9\+ROCUIDrmKIOjyYggQI="/);
|
|
289
289
|
assert.match(installer, /GOTOOLCHAIN: "local"/);
|
|
290
290
|
assert.match(installer, /GOSUMDB: "sum\.golang\.org"/);
|
|
291
291
|
assert.match(binary, /GENTLE_AI_VERSION = INSTALLER_VERSION/);
|
|
292
292
|
assert.match(binary, /GO_SUMDB_SOURCE_BUILD/);
|
|
293
293
|
assert.match(binary, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM/);
|
|
294
|
-
assert.match(verifier, /v2\.
|
|
294
|
+
assert.match(verifier, /v2\.9\.0/);
|
|
295
295
|
});
|
|
296
296
|
|
|
297
297
|
|
|
@@ -1509,9 +1509,9 @@ test("pi-pretty wrapper uses real package path resolution for pnpm symlink insta
|
|
|
1509
1509
|
assert.match(wrapper, /quietToolsEnabled/);
|
|
1510
1510
|
});
|
|
1511
1511
|
|
|
1512
|
-
test("v2.6.
|
|
1512
|
+
test("v2.6.3 release package and runtime stop before publication", () => {
|
|
1513
1513
|
const packageJson = readPackageJson();
|
|
1514
|
-
assert.equal(packageJson.version, "2.6.
|
|
1514
|
+
assert.equal(packageJson.version, "2.6.3", "the release manifest must remain explicitly pinned to v2.6.3");
|
|
1515
1515
|
assert.equal(
|
|
1516
1516
|
packageJson.scripts?.test,
|
|
1517
1517
|
"node --experimental-strip-types --test tests/*.test.ts && pnpm run check:provider-contract && pnpm run test:harness",
|
|
@@ -359,6 +359,81 @@ test("R3/R4 known non-mutating acquire failures retain retryable blocked history
|
|
|
359
359
|
assert.equal(calls, 1);
|
|
360
360
|
});
|
|
361
361
|
|
|
362
|
+
test("uncertain acquire reconciliation terminalizes blocked/complete exact replays", async () => {
|
|
363
|
+
const { reconcileManagedRemediation } = await import("../extensions/gentle-agents.ts");
|
|
364
|
+
for (const nativeState of ["blocked", "complete"] as const) {
|
|
365
|
+
const acquire = { workspaceRoot: testCwd, changeName: "fix", requestId: `reconcile-${nativeState}`, workUnit: "fix", evidenceGoal: "Observed correction", remediatesEvidenceRevision: revision };
|
|
366
|
+
const task = { id: nativeState, agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireUncertain: true } } as unknown as TaskRecord;
|
|
367
|
+
const calls = [], saved = [];
|
|
368
|
+
const result = await reconcileManagedRemediation(task, { sddAttemptAcquire: async input => { calls.push(structuredClone(input)); return { state: nativeState }; } } as unknown as NativeReviewCli, async current => { saved.push(structuredClone(current)); });
|
|
369
|
+
assert.deepEqual(calls, [acquire]);
|
|
370
|
+
assert.equal(result.acquireState, nativeState);
|
|
371
|
+
assert.equal(task.sddRemediation.acquireUncertain, undefined);
|
|
372
|
+
assert.deepEqual(task.sddRemediation.acquireResult, { state: nativeState });
|
|
373
|
+
assert.equal(remediationUnresolved(task), false);
|
|
374
|
+
assert.ok(saved.length >= 1);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
test("recovered proceed is durably settled as interrupted without actor replay", async () => {
|
|
379
|
+
const { reconcileManagedRemediation } = await import("../extensions/gentle-agents.ts");
|
|
380
|
+
const acquire = { workspaceRoot: testCwd, changeName: "fix", requestId: "reconcile-proceed", workUnit: "fix", evidenceGoal: "Observed correction", remediatesEvidenceRevision: revision, untrackedScope: "exclude" as const };
|
|
381
|
+
const task = { id: "proceed", agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireUncertain: true } } as unknown as TaskRecord;
|
|
382
|
+
const saved = [], calls = [];
|
|
383
|
+
const result = await reconcileManagedRemediation(task, {
|
|
384
|
+
sddAttemptAcquire: async input => { calls.push(["acquire", structuredClone(input)]); return { state: "proceed", token: "secret-token" }; },
|
|
385
|
+
sddAttemptSettle: async input => {
|
|
386
|
+
calls.push(["settle", structuredClone(input)]);
|
|
387
|
+
assert.deepEqual(saved.at(-1).sddRemediation.settle, input, "settle intent is durable before mutation");
|
|
388
|
+
return { state: "complete" };
|
|
389
|
+
},
|
|
390
|
+
} as unknown as NativeReviewCli, async current => { saved.push(structuredClone(current)); });
|
|
391
|
+
assert.equal(result.acquireState, "proceed"); assert.equal(result.settlementState, "complete");
|
|
392
|
+
assert.deepEqual(calls[0], ["acquire", acquire]);
|
|
393
|
+
assert.equal(calls[1][1].outcome, "interrupted");
|
|
394
|
+
assert.equal(calls[1][1].token, "secret-token");
|
|
395
|
+
assert.match(calls[1][1].requestId, /^reconcile-[a-f0-9]{32}$/);
|
|
396
|
+
assert.equal(calls[1][1].remediatesEvidenceRevision, revision);
|
|
397
|
+
assert.equal(calls[1][1].untrackedScope, "exclude");
|
|
398
|
+
assert.ok(saved.filter(snapshot => snapshot.sddRemediation.token).every(snapshot => snapshot.sddRemediation.settle), "no durable checkpoint may retain recovered authority without its compensating settle request");
|
|
399
|
+
assert.equal(task.sddRemediation.actorClaimed, undefined);
|
|
400
|
+
assert.equal(task.sddRemediation.acquireUncertain, undefined);
|
|
401
|
+
assert.equal(task.sddRemediation.settlementUncertain, undefined);
|
|
402
|
+
assert.equal(remediationUnresolved(task), false);
|
|
403
|
+
assert.equal(JSON.stringify(result).includes("secret-token"), false);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
test("reconciliation retries only exact pending mutations and preserves uncertainty", async () => {
|
|
407
|
+
const { reconcileManagedRemediation } = await import("../extensions/gentle-agents.ts");
|
|
408
|
+
const acquire = { workspaceRoot: testCwd, changeName: "fix", requestId: "reconcile-lost", workUnit: "fix", evidenceGoal: "Observed correction", remediatesEvidenceRevision: revision };
|
|
409
|
+
const acquireTask = { id: "lost-acquire", agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireUncertain: true } } as unknown as TaskRecord;
|
|
410
|
+
let acquireCalls = 0;
|
|
411
|
+
await assert.rejects(reconcileManagedRemediation(acquireTask, { sddAttemptAcquire: async input => { acquireCalls++; assert.deepEqual(input, acquire); throw new Error("lost reply"); } } as unknown as NativeReviewCli, async () => {}), /acquire.*unresolved/i);
|
|
412
|
+
assert.equal(acquireCalls, 2); assert.equal(acquireTask.sddRemediation.acquireUncertain, true);
|
|
413
|
+
|
|
414
|
+
const settle = { workspaceRoot: testCwd, changeName: "fix", token: "retained", requestId: "settle-exact", outcome: "interrupted" as const, diagnosis: "Interrupted", harnessDisposition: "invalidated" as const, cleanupEvidence: "None", processEvidence: "None", remediatesEvidenceRevision: revision };
|
|
415
|
+
const settleTask = { id: "lost-settle", agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireResult: { state: "proceed", token: "retained" }, token: "retained", settle, settlementUncertain: true } } as unknown as TaskRecord;
|
|
416
|
+
const settleCalls = [];
|
|
417
|
+
const result = await reconcileManagedRemediation(settleTask, { sddAttemptSettle: async input => { settleCalls.push(structuredClone(input)); return { state: "blocked", reason: "already_closed" }; } } as unknown as NativeReviewCli, async () => {});
|
|
418
|
+
assert.deepEqual(settleCalls, [settle]); assert.equal(result.settlementState, "blocked");
|
|
419
|
+
assert.equal(settleTask.sddRemediation.settlementUncertain, undefined);
|
|
420
|
+
assert.equal(remediationUnresolved(settleTask), false);
|
|
421
|
+
|
|
422
|
+
const ambiguousSettle = { id: "ambiguous-settle", agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireResult: { state: "proceed", token: "retained" }, token: "retained", settle, settlementUncertain: true } } as unknown as TaskRecord;
|
|
423
|
+
let ambiguousCalls = 0; const ambiguousSaved = [];
|
|
424
|
+
await assert.rejects(reconcileManagedRemediation(ambiguousSettle, { sddAttemptSettle: async input => { ambiguousCalls++; assert.deepEqual(input, settle); throw new Error("lost settle reply"); } } as unknown as NativeReviewCli, async current => { ambiguousSaved.push(structuredClone(current)); }), /settlement.*unresolved/i);
|
|
425
|
+
assert.equal(ambiguousCalls, 2);
|
|
426
|
+
assert.equal(ambiguousSettle.sddRemediation.settlementUncertain, true);
|
|
427
|
+
assert.deepEqual(ambiguousSaved.at(-1).sddRemediation.settle, settle);
|
|
428
|
+
assert.equal(remediationUnresolved(ambiguousSettle), true);
|
|
429
|
+
|
|
430
|
+
const actorTask = { id: "actor", agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireUncertain: true, actorClaimed: true } } as unknown as TaskRecord;
|
|
431
|
+
await assert.rejects(reconcileManagedRemediation(actorTask, {} as NativeReviewCli, async () => {}), /actor.*uncertain/i);
|
|
432
|
+
const mismatchedSettle = structuredClone(settle); mismatchedSettle.changeName = "other";
|
|
433
|
+
const corruptTask = { id: "corrupt", agent: "sdd-remediate", cwd: testCwd, status: "failed", createdAt: 1, sddRemediation: { acquire, acquireResult: { state: "proceed", token: "retained" }, token: "retained", settle: mismatchedSettle, settlementUncertain: true } } as unknown as TaskRecord;
|
|
434
|
+
await assert.rejects(reconcileManagedRemediation(corruptTask, { sddAttemptSettle: async () => { throw new Error("must not call"); } } as unknown as NativeReviewCli, async () => {}), /does not match/);
|
|
435
|
+
});
|
|
436
|
+
|
|
362
437
|
|
|
363
438
|
test("remediation actor explains one-launch human authority and indexed command evidence", async () => {
|
|
364
439
|
const { readFileSync } = await import("node:fs");
|