π OpenHands: AI-Driven Development
feat: update SDK to 1.22.0 and add CI version sync check (#333)
Rohit Malhotra773cc7232414
diff --git a/.github/workflows/sdk-version-sync.yml b/.github/workflows/sdk-version-sync.ymlnew file mode 100644index 0000000000..7441045d91--- /dev/null+++ b/.github/workflows/sdk-version-sync.yml@@ -0,0 +1,77 @@+name: SDK Version Sync++on:+ pull_request:+ paths:+ # Only run on PRs that touch version-related files+ - "scripts/dev-safe.mjs"+ - "scripts/dev-with-automation.mjs"+ - "scripts/check-sdk-version-sync.mjs"+ - ".github/workflows/sdk-version-sync.yml"+ push:+ branches:+ - main+ paths:+ - "scripts/dev-safe.mjs"+ - "scripts/dev-with-automation.mjs"+ - "scripts/check-sdk-version-sync.mjs"+ - ".github/workflows/sdk-version-sync.yml"++ # Triggered by external repos (e.g., OpenHands/automation) when SDK deps change+ # To trigger: POST /repos/{owner}/{repo}/dispatches with event_type: "sdk-version-check"+ repository_dispatch:+ types: [sdk-version-check, sdk-release]++ # Triggered when new SDK packages are released on PyPI+ # The OpenHands/software-agent-sdk repo can trigger this on release+ workflow_dispatch:+ inputs:+ sdk_version:+ description: "New SDK version to check against (optional)"+ required: false+ type: string++ schedule:+ # Run every 6 hours to catch upstream changes reasonably quickly+ - cron: "0 */6 * * *"++concurrency:+ group: sdk-sync-${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: true++permissions:+ contents: read++jobs:+ check-sdk-versions:+ name: Check SDK version consistency+ runs-on: ubuntu-24.04+ timeout-minutes: 5++ steps:+ - name: Check out repository+ uses: actions/checkout@v6++ - name: Set up Node.js+ uses: actions/setup-node@v6+ with:+ node-version: 22.12.0++ - name: Log trigger info+ run: |+ echo "Triggered by: ${{ github.event_name }}"+ if [ "${{ github.event_name }}" = "repository_dispatch" ]; then+ echo "Event type: ${{ github.event.action }}"+ echo "Client payload: ${{ toJson(github.event.client_payload) }}"+ fi+ if [ -n "${{ inputs.sdk_version }}" ]; then+ echo "SDK version input: ${{ inputs.sdk_version }}"+ fi++ - name: Check SDK version sync+ run: node scripts/check-sdk-version-sync.mjs+ env:+ # Pass the SDK version from workflow_dispatch or repository_dispatch if provided+ # workflow_dispatch: uses inputs.sdk_version+ # repository_dispatch: uses client_payload.version+ EXPECTED_SDK_VERSION: ${{ inputs.sdk_version || github.event.client_payload.version || '' }}diff --git a/AGENTS.md b/AGENTS.mdindex 020a92629c..99a3f1e055 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -99,10 +99,10 @@- `scripts/dev-safe.mjs` uses `uvx` for temporary agent-server installation β no permanent `uv tool install` needed. Environment variables (highest precedence first):- `OH_AGENT_SERVER_LOCAL_PATH` β absolute path to a local `software-agent-sdk` checkout. Runs the local checkout via `uvx` with `--with-editable` for `openhands-sdk`/`openhands-tools`/`openhands-workspace` and `--reinstall` for `openhands-agent-server`, so SDK edits are picked up on restart. Highest precedence.- `OH_AGENT_SERVER_GIT_REF` β git commit SHA or branch name (takes precedence over version)- - `OH_AGENT_SERVER_VERSION` β specific PyPI version (e.g., "1.21.1")+ - `OH_AGENT_SERVER_VERSION` β specific PyPI version (e.g., "1.22.0")- `OH_SECRET_KEY` β secret key for settings encryption; uses a static default for local dev since it's needed for reading persisted encrypted values across restarts- `SESSION_API_KEY` / `OH_SESSION_API_KEYS_0` / `VITE_SESSION_API_KEY` β session API key for agent-server authentication; auto-generated using `crypto.randomBytes(32)` if not set, passed to both agent-server (`OH_SESSION_API_KEYS_0`) and frontend (`VITE_SESSION_API_KEY`)- - Default: released PyPI version `1.21.1` for agent-server SDK libraries+ - Default: released PyPI version `1.22.0` for agent-server SDK libraries- Security: Both `scripts/dev-safe.mjs` and `scripts/dev-with-automation.mjs` auto-generate random API keys on each startup for better security isolation:- `SESSION_API_KEY` β 64-character hex (256-bit) for agent-server API authentication; auto-generated per session unless overridden via env var- `AUTOMATION_LOCAL_API_KEY` β 64-character hex for automation backend auth; auto-generated per session unless overridden@@ -113,7 +113,7 @@- `/api/automation/*` β automation backend (:18001)- `/api/*`, `/sockets`, etc. β agent server (:18000)- `/*` (default) β Vite dev server (:3001)- - Environment variables: `PORT` (ingress port, default: 8000), `OH_AUTOMATION_GIT_REF` (git ref, overrides default version), `OH_AUTOMATION_VERSION` (default: `1.0.0a1`), `AUTOMATION_LOCAL_API_KEY` (optional, use a fixed key; default: auto-generated random key per session)+ - Environment variables: `PORT` (ingress port, default: 8000), `OH_AUTOMATION_GIT_REF` (git ref, overrides default version), `OH_AUTOMATION_VERSION` (default: `1.0.0a2`), `AUTOMATION_LOCAL_API_KEY` (optional, use a fixed key; default: auto-generated random key per session)- Access points: `http://localhost:8000/` (main UI), `http://localhost:8000/api/automation/docs` (API docs)- Security: `AUTOMATION_LOCAL_API_KEY` is auto-generated using `crypto.randomBytes(32)` on each startup for better security isolation. Set the env var explicitly to use a consistent key across restarts. The cipher key (`OH_SECRET_KEY`) keeps a static default for local dev since it's used for encrypting/decrypting persisted settings values.- `scripts/ingress.mjs` is a standalone HTTP reverse proxy that can be used independently to route traffic to multiple backends based on URL path prefix.diff --git a/__tests__/scripts/check-sdk-version-sync.test.ts b/__tests__/scripts/check-sdk-version-sync.test.tsnew file mode 100644index 0000000000..31d5b3ed48--- /dev/null+++ b/__tests__/scripts/check-sdk-version-sync.test.ts@@ -0,0 +1,161 @@+import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";++// Type definitions for the module exports+type NormalizeVersion = (version: string | null) => string | null;+type VersionsEqual = (v1: string, v2: string) => boolean;+type ParseSdkVersions = (requiresDist: string[]) => Record<string, string>;++// Import after mocking - need dynamic import since the script has side effects+describe("check-sdk-version-sync helpers", () => {+ let normalizeVersion: NormalizeVersion;+ let versionsEqual: VersionsEqual;+ let parseSdkVersionsFromRequiresDist: ParseSdkVersions;+ let SDK_PACKAGES: string[];++ beforeEach(async () => {+ // Reset modules to get fresh imports+ vi.resetModules();++ // Mock console to suppress output during tests+ vi.spyOn(console, "log").mockImplementation(() => {});+ vi.spyOn(console, "error").mockImplementation(() => {});++ // Dynamic import to get fresh module+ const module = await import("../../scripts/check-sdk-version-sync.mjs");+ normalizeVersion = module.normalizeVersion as NormalizeVersion;+ versionsEqual = module.versionsEqual as VersionsEqual;+ parseSdkVersionsFromRequiresDist =+ module.parseSdkVersionsFromRequiresDist as ParseSdkVersions;+ SDK_PACKAGES = module.SDK_PACKAGES as string[];+ });++ afterEach(() => {+ vi.restoreAllMocks();+ });++ describe("normalizeVersion", () => {+ it("returns null for null input", () => {+ expect(normalizeVersion(null)).toBe(null);+ });++ it("pads two-part versions to three parts", () => {+ expect(normalizeVersion("1.22")).toBe("1.22.0");+ });++ it("keeps three-part versions as-is", () => {+ expect(normalizeVersion("1.22.0")).toBe("1.22.0");+ });++ it("truncates versions with more than three parts", () => {+ expect(normalizeVersion("1.22.0.1")).toBe("1.22.0");+ });++ it("strips pre-release metadata", () => {+ expect(normalizeVersion("1.22.0-beta.1")).toBe("1.22.0");+ expect(normalizeVersion("1.22.0-alpha")).toBe("1.22.0");+ });++ it("strips build metadata", () => {+ expect(normalizeVersion("1.22.0+build.123")).toBe("1.22.0");+ });++ it("handles versions with both pre-release and build metadata", () => {+ expect(normalizeVersion("1.22.0-beta+build")).toBe("1.22.0");+ });+ });++ describe("versionsEqual", () => {+ it("returns true for identical versions", () => {+ expect(versionsEqual("1.22.0", "1.22.0")).toBe(true);+ });++ it("returns true for semantically equivalent versions", () => {+ expect(versionsEqual("1.22", "1.22.0")).toBe(true);+ expect(versionsEqual("1.22.0", "1.22")).toBe(true);+ });++ it("returns false for different versions", () => {+ expect(versionsEqual("1.21.0", "1.22.0")).toBe(false);+ expect(versionsEqual("1.22.0", "1.22.1")).toBe(false);+ });++ it("ignores pre-release metadata for base comparison", () => {+ expect(versionsEqual("1.22.0-beta", "1.22.0")).toBe(true);+ });+ });++ describe("parseSdkVersionsFromRequiresDist", () => {+ it("parses standard PEP 508 format with >=", () => {+ const deps = [+ "openhands-sdk>=1.22.0,<2.0.0",+ "openhands-workspace>=1.22.0",+ ];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ expect(versions["openhands-sdk"]).toBe("1.22.0");+ expect(versions["openhands-workspace"]).toBe("1.22.0");+ });++ it("parses exact version pins with ==", () => {+ const deps = ["openhands-tools==1.21.1"];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ expect(versions["openhands-tools"]).toBe("1.21.1");+ });++ it("parses parenthesized format", () => {+ const deps = ["openhands-sdk (>=1.22.0)"];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ expect(versions["openhands-sdk"]).toBe("1.22.0");+ });++ it("returns empty object for no matching packages", () => {+ const deps = ["requests>=2.0.0", "flask>=1.0.0"];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ expect(Object.keys(versions)).toHaveLength(0);+ });++ it("handles mixed dependencies", () => {+ const deps = [+ "requests>=2.0.0",+ "openhands-sdk>=1.22.0",+ "flask>=1.0.0",+ "openhands-workspace (>=1.21.0)",+ ];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ expect(versions["openhands-sdk"]).toBe("1.22.0");+ expect(versions["openhands-workspace"]).toBe("1.21.0");+ expect(versions["requests"]).toBeUndefined();+ });++ it("handles tilde version specifier", () => {+ const deps = ["openhands-sdk~=1.22.0"];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ expect(versions["openhands-sdk"]).toBe("1.22.0");+ });++ it("handles version with extras", () => {+ // PyPI sometimes includes extras in requires_dist+ const deps = ["openhands-sdk[all]>=1.22.0"];+ const versions = parseSdkVersionsFromRequiresDist(deps);++ // Current implementation may not handle extras perfectly,+ // but should at least not crash+ expect(versions).toBeDefined();+ });+ });++ describe("SDK_PACKAGES", () => {+ it("contains the expected SDK packages", () => {+ expect(SDK_PACKAGES).toContain("openhands-sdk");+ expect(SDK_PACKAGES).toContain("openhands-tools");+ expect(SDK_PACKAGES).toContain("openhands-workspace");+ expect(SDK_PACKAGES).toContain("openhands-agent-server");+ expect(SDK_PACKAGES).toHaveLength(4);+ });+ });+});diff --git a/__tests__/scripts/dev-safe.test.ts b/__tests__/scripts/dev-safe.test.tsindex 076e46ab52..10a92568e1 100644--- a/__tests__/scripts/dev-safe.test.ts+++ b/__tests__/scripts/dev-safe.test.ts@@ -246,14 +246,14 @@ describe("buildAgentServerCommand", () => {// Defaults to the released PyPI version with all SDK packages pinned to same versionexpect(cmd.args).toEqual(["--from",- "openhands-agent-server==1.21.1",+ "openhands-agent-server==1.22.0","--with",- "openhands-tools==1.21.1",+ "openhands-tools==1.22.0","--with",- "openhands-workspace==1.21.1",+ "openhands-workspace==1.22.0","agent-server",]);- expect(cmd.source).toBe("PyPI (1.21.1, default)");+ expect(cmd.source).toBe("PyPI (1.22.0, default)");});it("uses specific PyPI version when OH_AGENT_SERVER_VERSION is set with all packages pinned", () => {diff --git a/__tests__/scripts/dev-with-automation.test.ts b/__tests__/scripts/dev-with-automation.test.tsindex a994ae6a78..cb4c61f0ed 100644--- a/__tests__/scripts/dev-with-automation.test.ts+++ b/__tests__/scripts/dev-with-automation.test.ts@@ -369,7 +369,7 @@ describe("default constants", () => {});it("has expected default automation version", () => {- expect(DEFAULT_AUTOMATION_VERSION).toBe("1.0.0a1");+ expect(DEFAULT_AUTOMATION_VERSION).toBe("1.0.0a2");});it("has expected default backend port", () => {diff --git a/scripts/check-sdk-version-sync.mjs b/scripts/check-sdk-version-sync.mjsnew file mode 100644index 0000000000..a12d995323--- /dev/null+++ b/scripts/check-sdk-version-sync.mjs@@ -0,0 +1,431 @@+#!/usr/bin/env node++/**+ * Check SDK Version Sync+ *+ * Verifies that the released automation package (openhands-automation on PyPI)+ * uses the same SDK version as specified in dev-safe.mjs for all agent SDK libraries:+ * - openhands-sdk+ * - openhands-tools+ * - openhands-workspace+ * - openhands-agent-server+ *+ * This script checks the RELEASED PyPI version of openhands-automation (as specified+ * by DEFAULT_AUTOMATION_VERSION in dev-with-automation.mjs), not the main branch.+ *+ * This script is run in CI to catch version drift between projects.+ *+ * Usage:+ * node scripts/check-sdk-version-sync.mjs+ * EXPECTED_SDK_VERSION=1.22.0 node scripts/check-sdk-version-sync.mjs+ * node scripts/check-sdk-version-sync.mjs --check-pypi+ *+ * Environment variables:+ * EXPECTED_SDK_VERSION - Override the expected version (instead of reading from dev-safe.mjs)+ * AUTOMATION_PACKAGE_NAME - Override the automation package name (default: openhands-automation)+ * AUTOMATION_PACKAGE_VERSION - Override the automation package version (instead of reading from dev-with-automation.mjs)+ *+ * Options:+ * --check-pypi Also check the latest SDK version on PyPI+ * --help Show help+ *+ * Exit codes:+ * 0 - All SDK versions match+ * 1 - Version mismatch detected or error occurred+ */++import { readFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";+import process from "node:process";++const __dirname = dirname(fileURLToPath(import.meta.url));+const projectRoot = join(__dirname, "..");++// Parse command line arguments+const args = process.argv.slice(2);+const checkPyPI = args.includes("--check-pypi");+const showHelp = args.includes("--help") || args.includes("-h");++if (showHelp) {+ console.log(`+SDK Version Sync Check++Verifies that the released openhands-automation package on PyPI uses the same+SDK version as specified in this repo's dev-safe.mjs.++The automation version is read from DEFAULT_AUTOMATION_VERSION in+dev-with-automation.mjs (currently used for local development).++Usage:+ node scripts/check-sdk-version-sync.mjs [options]++Options:+ --check-pypi Also check the latest SDK version on PyPI+ --help, -h Show this help++Environment variables:+ EXPECTED_SDK_VERSION Override the expected SDK version (instead of reading from dev-safe.mjs)+ AUTOMATION_PACKAGE_NAME Override the automation package name (default: openhands-automation)+ AUTOMATION_PACKAGE_VERSION Override the automation package version (instead of reading from dev-with-automation.mjs)++Triggering from other repos:+ The automation repo or SDK repo can trigger this check via GitHub repository_dispatch:++ curl -X POST \\+ -H "Authorization: token \$GITHUB_TOKEN" \\+ -H "Accept: application/vnd.github.v3+json" \\+ https://api.github.com/repos/OpenHands/agent-canvas/dispatches \\+ -d '{"event_type": "sdk-version-check", "client_payload": {"version": "1.22.0"}}'+`);+ process.exit(0);+}++// ANSI color codes for terminal output+const colors = {+ reset: "\x1b[0m",+ red: "\x1b[31m",+ green: "\x1b[32m",+ yellow: "\x1b[33m",+ cyan: "\x1b[36m",+ dim: "\x1b[2m",+};++// SDK packages that must have matching versions+const SDK_PACKAGES = [+ "openhands-sdk",+ "openhands-tools",+ "openhands-workspace",+ "openhands-agent-server",+];++// Configurable automation package (can be overridden via env)+const AUTOMATION_PACKAGE_NAME = process.env.AUTOMATION_PACKAGE_NAME || "openhands-automation";++// Default retry configuration+const RETRY_COUNT = 3;+const RETRY_DELAY_MS = 1000;++/**+ * Normalize a version string for comparison.+ * Handles variations like "1.22" vs "1.22.0" by ensuring consistent format.+ */+function normalizeVersion(version) {+ if (!version) return null;++ // Remove any pre-release or build metadata for base comparison+ const baseVersion = version.split(/[-+]/)[0];++ // Split into parts and pad to 3 parts (major.minor.patch)+ const parts = baseVersion.split(".").map((p) => parseInt(p, 10) || 0);+ while (parts.length < 3) {+ parts.push(0);+ }++ return parts.slice(0, 3).join(".");+}++/**+ * Compare two versions for equality (handles semantic equivalence)+ */+function versionsEqual(v1, v2) {+ return normalizeVersion(v1) === normalizeVersion(v2);+}++/**+ * Sleep for a given number of milliseconds+ */+function sleep(ms) {+ return new Promise((resolve) => setTimeout(resolve, ms));+}++/**+ * Read the expected SDK version from environment variable or dev-safe.mjs+ */+function getExpectedVersion() {+ // Allow override via environment variable (useful for CI triggers)+ const envVersion = process.env.EXPECTED_SDK_VERSION;+ if (envVersion && envVersion.trim()) {+ return { version: envVersion.trim(), source: "EXPECTED_SDK_VERSION env var" };+ }++ // Read from dev-safe.mjs+ const devSafePath = join(projectRoot, "scripts", "dev-safe.mjs");+ const content = readFileSync(devSafePath, "utf8");++ const match = content.match(+ /const DEFAULT_AGENT_SERVER_VERSION = "([^"]+)"/,+ );+ if (!match) {+ throw new Error(+ "Could not find DEFAULT_AGENT_SERVER_VERSION in dev-safe.mjs",+ );+ }+ return { version: match[1], source: "dev-safe.mjs" };+}++/**+ * Fetch the latest version of a package from PyPI+ */+async function fetchPyPIVersion(packageName) {+ const url = `https://pypi.org/pypi/${packageName}/json`;+ try {+ const response = await fetch(url);+ if (!response.ok) {+ return null;+ }+ const data = await response.json();+ return data.info?.version || null;+ } catch {+ return null;+ }+}++/**+ * Read the automation version from env var or dev-with-automation.mjs+ */+function getAutomationVersion() {+ // Allow override via environment variable+ const envVersion = process.env.AUTOMATION_PACKAGE_VERSION;+ if (envVersion && envVersion.trim()) {+ return { version: envVersion.trim(), source: "AUTOMATION_PACKAGE_VERSION env var" };+ }++ const devAutomationPath = join(projectRoot, "scripts", "dev-with-automation.mjs");+ const content = readFileSync(devAutomationPath, "utf8");++ const match = content.match(+ /const DEFAULT_AUTOMATION_VERSION = "([^"]+)"/,+ );+ if (!match) {+ throw new Error(+ "Could not find DEFAULT_AUTOMATION_VERSION in dev-with-automation.mjs",+ );+ }+ return { version: match[1], source: "dev-with-automation.mjs" };+}++/**+ * Fetch package metadata from PyPI and extract dependencies (with retry)+ */+async function fetchPyPIDependencies(packageName, version) {+ const url = `https://pypi.org/pypi/${packageName}/${version}/json`;++ console.log(`${colors.dim}Fetching ${url}${colors.reset}`);++ let lastError;+ for (let attempt = 0; attempt < RETRY_COUNT; attempt++) {+ try {+ const response = await fetch(url);++ // 404 is a config issue, don't retry+ if (response.status === 404) {+ throw new Error(+ `Package ${packageName}==${version} not found on PyPI (404). Check the package name and version.`,+ );+ }++ if (!response.ok) {+ throw new Error(+ `Failed to fetch ${packageName}==${version} from PyPI: ${response.status} ${response.statusText}`,+ );+ }++ const data = await response.json();+ return data.info?.requires_dist || [];+ } catch (err) {+ lastError = err;++ // Don't retry on 404 (config issue)+ if (err.message.includes("not found on PyPI (404)")) {+ throw err;+ }++ // Retry on other errors (network issues, 5xx, etc.)+ if (attempt < RETRY_COUNT - 1) {+ const delay = RETRY_DELAY_MS * (attempt + 1);+ console.log(+ `${colors.yellow}Retry ${attempt + 1}/${RETRY_COUNT - 1} after ${delay}ms...${colors.reset}`,+ );+ await sleep(delay);+ }+ }+ }++ throw lastError;+}++/**+ * Parse PyPI requires_dist array and extract SDK package versions+ *+ * PyPI returns dependencies in PEP 508 format like:+ * "openhands-sdk>=1.22.0,<2.0.0"+ * "openhands-tools==1.22.0"+ * "openhands-workspace (>=1.22.0)"+ */+function parseSdkVersionsFromRequiresDist(requiresDist) {+ const versions = {};++ for (const pkg of SDK_PACKAGES) {+ for (const dep of requiresDist) {+ // Check if the dependency starts with our package name+ // The package name may be followed by whitespace, operators, or parentheses+ if (!dep.toLowerCase().startsWith(pkg.toLowerCase())) {+ continue;+ }++ // Extract the version number - look for patterns like:+ // ">=1.22.0", "==1.22.0", "(>=1.22.0)", "~=1.22.0"+ // After the package name and before any comma or closing paren+ const versionPattern = /[><=~!]+\s*([0-9]+(?:\.[0-9]+)*)/;+ const match = dep.match(versionPattern);+ if (match) {+ versions[pkg] = match[1];+ break;+ }+ }+ }++ return versions;+}++/**+ * Main entry point+ */+async function main() {+ console.log("");+ console.log(+ `${colors.cyan}SDK Version Sync Check${colors.reset}`,+ );+ console.log("β".repeat(50));+ console.log("");++ try {+ // Get expected version from env var or dev-safe.mjs+ const { version: expectedVersion, source: versionSource } = getExpectedVersion();+ console.log(+ `Expected SDK version: ${colors.green}${expectedVersion}${colors.reset} (from ${versionSource})`,+ );++ // Get automation version from env var or dev-with-automation.mjs+ const { version: automationVersion, source: automationSource } = getAutomationVersion();+ console.log(+ `Automation package: ${colors.cyan}${AUTOMATION_PACKAGE_NAME}==${automationVersion}${colors.reset} (from ${automationSource})`,+ );++ // Optionally check PyPI for the latest SDK version+ if (checkPyPI) {+ console.log("");+ console.log("Checking latest SDK versions on PyPI:");+ for (const pkg of SDK_PACKAGES) {+ const pypiVersion = await fetchPyPIVersion(pkg);+ if (pypiVersion) {+ const status = versionsEqual(pypiVersion, expectedVersion)+ ? colors.green+ : colors.yellow;+ console.log(` ${pkg.padEnd(25)} ${status}${pypiVersion}${colors.reset}`);+ } else {+ console.log(` ${pkg.padEnd(25)} ${colors.dim}(not found on PyPI)${colors.reset}`);+ }+ }+ }++ console.log("");++ // Fetch automation package dependencies from PyPI+ const requiresDist = await fetchPyPIDependencies(AUTOMATION_PACKAGE_NAME, automationVersion);+ const automationVersions = parseSdkVersionsFromRequiresDist(requiresDist);++ // Check each SDK package+ let hasErrors = false;+ let foundAny = false;+ const mismatches = [];++ console.log(`Checking ${AUTOMATION_PACKAGE_NAME}==${automationVersion} SDK dependencies:`);+ console.log("");++ for (const pkg of SDK_PACKAGES) {+ const actualVersion = automationVersions[pkg];++ if (actualVersion) {+ foundAny = true;+ if (versionsEqual(actualVersion, expectedVersion)) {+ console.log(+ ` ${pkg.padEnd(25)} ${colors.green}β ${actualVersion}${colors.reset}`,+ );+ } else {+ hasErrors = true;+ console.log(+ ` ${pkg.padEnd(25)} ${colors.red}β ${actualVersion} (expected ${expectedVersion})${colors.reset}`,+ );+ mismatches.push({+ package: pkg,+ expected: expectedVersion,+ actual: actualVersion,+ });+ }+ } else {+ // Package not found - might be a transitive dependency, not an error+ console.log(+ ` ${pkg.padEnd(25)} ${colors.dim}- not a direct dependency${colors.reset}`,+ );+ }+ }++ console.log("");++ if (!foundAny) {+ console.log(+ `${colors.yellow}Warning: No SDK packages found in ${AUTOMATION_PACKAGE_NAME}==${automationVersion} dependencies${colors.reset}`,+ );+ console.log("This might indicate a parsing issue or the package is not yet published.");+ console.log("");+ process.exit(1);+ }++ if (hasErrors) {+ console.log(+ `${colors.red}Version mismatch detected!${colors.reset}`,+ );+ console.log("");+ console.log(`The released ${AUTOMATION_PACKAGE_NAME}==${automationVersion} uses different SDK versions than expected.`);+ console.log("");+ console.log("Mismatched packages:");+ for (const m of mismatches) {+ console.log(` - ${m.package}: ${m.actual} (expected ${m.expected})`);+ }+ console.log("");+ console.log("To fix, update one of the following:");+ console.log(+ ` 1. Update DEFAULT_AGENT_SERVER_VERSION in scripts/dev-safe.mjs to match the automation release`,+ );+ console.log(+ ` 2. Release a new version of ${AUTOMATION_PACKAGE_NAME} with SDK dependencies pinned to ${expectedVersion}`,+ );+ console.log(+ ` 3. Update DEFAULT_AUTOMATION_VERSION in scripts/dev-with-automation.mjs to a newer release`,+ );+ console.log("");+ process.exit(1);+ }++ console.log(+ `${colors.green}All SDK versions are in sync!${colors.reset}`,+ );+ console.log("");+ } catch (error) {+ console.error(`${colors.red}Error: ${error.message}${colors.reset}`);+ process.exit(1);+ }+}++// Export for testing+export {+ normalizeVersion,+ versionsEqual,+ parseSdkVersionsFromRequiresDist,+ SDK_PACKAGES,+ AUTOMATION_PACKAGE_NAME,+};++main();diff --git a/scripts/dev-safe.mjs b/scripts/dev-safe.mjsindex 734db1f579..27b2a4d666 100644--- a/scripts/dev-safe.mjs+++ b/scripts/dev-safe.mjs@@ -32,7 +32,7 @@ const LOCAL_AGENT_SERVER_SUBDIRS = [const DEFAULT_SECRET_KEY = "openhands-dev-secret-key-change-in-prod";// Default agent-server version (released PyPI version)// Set OH_AGENT_SERVER_GIT_REF to use a git branch/SHA instead-const DEFAULT_AGENT_SERVER_VERSION = "1.21.1";+const DEFAULT_AGENT_SERVER_VERSION = "1.22.0";/*** Generate a cryptographically secure random API key.@@ -260,7 +260,7 @@ export function formatMissingUvxGuidance(cwd = process.cwd()) {* edits are picked up without a manual reinstall. The agent-server itself* is rebuilt from local source on each invocation (--reinstall).* - OH_AGENT_SERVER_GIT_REF: Git commit SHA or branch name- * - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.21.1")+ * - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.22.0")** If none are set, defaults to the released version specified by* DEFAULT_AGENT_SERVER_VERSION. Set OH_AGENT_SERVER_GIT_REF to use adiff --git a/scripts/dev-with-automation.mjs b/scripts/dev-with-automation.mjsindex 798e4556c5..4a1cc3b8ba 100644--- a/scripts/dev-with-automation.mjs+++ b/scripts/dev-with-automation.mjs@@ -62,7 +62,7 @@ const DEFAULT_AUTOMATION_REPO = "https://github.com/OpenHands/automation";const DEFAULT_AUTOMATION_PACKAGE = "openhands-automation";// Default automation version (released PyPI version)// Set OH_AUTOMATION_GIT_REF to use a git branch/SHA instead-const DEFAULT_AUTOMATION_VERSION = "1.0.0a1";+const DEFAULT_AUTOMATION_VERSION = "1.0.0a2";const DEFAULT_BACKEND_PORT = 18000;const DEFAULT_AUTOMATION_PORT = 18001;