π OpenHands: AI-Driven Development
fix: disable public-skill loading by default in dev (#229)
Hiep Le8a3a3a3c3db4
diff --git a/.env.sample b/.env.sampleindex 8bcea86c04..258699c8a0 100644--- a/.env.sample+++ b/.env.sample@@ -9,7 +9,7 @@ VITE_BACKEND_BASE_URL="http://127.0.0.1:8000" # Base URL used by browser-side di# VITE_WORKING_DIR="/workspace/project/agent-canvas" # Base dir for per-conversation working_dirs. Each conversation's working_dir is <VITE_WORKING_DIR>/<id_hex>. Defaults to <OH_CANVAS_SAFE_STATE_DIR>/workspaces, which is the sibling of the agent server's <state_dir>/conversations/ persistence dir β both share the same <id_hex> per conversation.# VITE_WORKER_URLS="" # Optional comma-separated worker URLs for the Browser tab# VITE_ENABLE_BROWSER_TOOLS="true" # Set to false to omit BrowserToolSet from new conversations-# VITE_LOAD_PUBLIC_SKILLS="true" # Set to false to disable loading public skills from https://github.com/OpenHands/extensions+# VITE_LOAD_PUBLIC_SKILLS="true" # Set to true to enable loading public skills from https://github.com/OpenHands/extensions (off by default)# Frontend dev serverVITE_FRONTEND_PORT="3001" # Port to run the frontend applicationdiff --git a/__tests__/api/agent-server-config.test.ts b/__tests__/api/agent-server-config.test.tsindex a976a2966b..d2fdd6b28c 100644--- a/__tests__/api/agent-server-config.test.ts+++ b/__tests__/api/agent-server-config.test.ts@@ -8,6 +8,7 @@ import {getAgentServerSessionApiKey,getAgentServerWorkingDir,saveAgentServerConfig,+ shouldLoadPublicSkills,} from "#/api/agent-server-config";const ORIGINAL_LOCATION = window.location;@@ -88,4 +89,22 @@ describe("agent server config", () => {expect(getAgentServerBaseUrl()).toBe("https://saved-agent.example.com");expect(getAgentServerSessionApiKey()).toBe("saved-session-key");});++ it("does not load public skills by default when VITE_LOAD_PUBLIC_SKILLS is unset", () => {+ vi.stubEnv("VITE_LOAD_PUBLIC_SKILLS", "");++ expect(shouldLoadPublicSkills()).toBe(false);+ });++ it("loads public skills only when VITE_LOAD_PUBLIC_SKILLS is explicitly 'true'", () => {+ vi.stubEnv("VITE_LOAD_PUBLIC_SKILLS", "true");++ expect(shouldLoadPublicSkills()).toBe(true);+ });++ it("does not load public skills for any non-'true' value of VITE_LOAD_PUBLIC_SKILLS", () => {+ vi.stubEnv("VITE_LOAD_PUBLIC_SKILLS", "false");++ expect(shouldLoadPublicSkills()).toBe(false);+ });});diff --git a/src/api/agent-server-config.ts b/src/api/agent-server-config.tsindex c31e4e2780..9a7ab02d9f 100644--- a/src/api/agent-server-config.ts+++ b/src/api/agent-server-config.ts@@ -182,8 +182,8 @@ export function getAgentServerHeaders(): Record<string, string> {* Returns whether public skills from the OpenHands extensions marketplace* (https://github.com/OpenHands/extensions) should be loaded.*- * Defaults to true. Set VITE_LOAD_PUBLIC_SKILLS=false to disable.+ * Defaults to false. Set VITE_LOAD_PUBLIC_SKILLS=true to enable.*/export function shouldLoadPublicSkills(): boolean {- return import.meta.env.VITE_LOAD_PUBLIC_SKILLS !== "false";+ return import.meta.env.VITE_LOAD_PUBLIC_SKILLS === "true";}