fix: disable public-skill loading by default in dev (#229)

This commit is contained in:
Hiep Le
2026-05-09 22:26:40 +07:00
committed by GitHub
parent 93f9f195b1
commit 8a3a3a3c3d
3 changed files with 22 additions and 3 deletions
+1 -1
View File
@@ -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 server
VITE_FRONTEND_PORT="3001" # Port to run the frontend application
+19
View File
@@ -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);
});
});
+2 -2
View File
@@ -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";
}