diff --git a/apps/cli/tests/profiles/sdk/plugin-manager.expected.e2e.ts b/apps/cli/tests/profiles/sdk/plugin-manager.expected.e2e.ts index 494702c930..e27881ded0 100644 --- a/apps/cli/tests/profiles/sdk/plugin-manager.expected.e2e.ts +++ b/apps/cli/tests/profiles/sdk/plugin-manager.expected.e2e.ts @@ -155,8 +155,17 @@ it.for(['unavailable', 'approved', 'missing-pnpm'] as const)('reports the %s plu const result = JSON.stringify(requests.at(-1)?.messages) if (scenario === 'unavailable') expect(result).toContain('unavailable') else if (scenario === 'missing-pnpm') { - expect(result).toContain('ENOENT') - expect(result).toContain('operation-error') + const messages = requests.at(-1)!.messages as { content: { type: string; content?: { text: string }[] }[] }[] + const toolResult = messages.flatMap(message => message.content).findLast(block => block.type === 'tool_result') + const failure = z.object({ + changed: z.literal(false), application: z.literal('failed'), + packageResult: z.object({ exitCode: z.number(), output: z.string().min(1) }), + error: z.object({ code: z.literal('operation-error'), diagnostic: z.string().min(1) }), + }).parse(JSON.parse(toolResult!.content![0]!.text)) + // cmd.exe reports 1 for a missing command; POSIX spawn reports 127. + expect(failure.packageResult.exitCode).toBe(process.platform === 'win32' ? 1 : 127) + expect(failure.error.diagnostic).toContain('pnpm') + expect(failure.packageResult.output).toContain(failure.error.diagnostic) } else { expect(approvals).toBe(1); expect(result).toContain('entries') } const manifest = JSON.parse(await readFile(join(root, 'home/profiles/sdk/package.json'), 'utf8')) as { dependencies: object } expect(Object.keys(manifest.dependencies ?? {})).toEqual([]) diff --git a/scripts/smoke-python-runtime.py b/scripts/smoke-python-runtime.py index 6819d780b3..baf65a9760 100644 --- a/scripts/smoke-python-runtime.py +++ b/scripts/smoke-python-runtime.py @@ -383,7 +383,13 @@ def completion_chunks(body: dict[str, object]) -> list[dict[str, object]]: outcome = json.loads(tool_text) if outcome.get("changed") or outcome.get("application") != "failed": raise AssertionError(f"package operation unexpectedly succeeded without pnpm: {outcome}") - if outcome.get("packageResult", {}).get("exitCode") != 127 or "ENOENT" not in tool_text: + package = outcome.get("packageResult", {}) + error = outcome.get("error", {}) + diagnostic = error.get("diagnostic", "") + # cmd.exe reports 1 for a missing command; POSIX spawn reports 127. + if (package.get("exitCode") != (1 if IS_WINDOWS else 127) + or error.get("code") != "operation-error" or "pnpm" not in diagnostic + or diagnostic not in package.get("output", "")): raise AssertionError(f"missing pnpm diagnostic was not preserved: {outcome}") return text_chunks(EXPECTED_TEXT) if tool_name == "load_workspace_dependencies":