Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: seed AUTOMATION_KV_SECRET for local dev stack (#1414)

Tim O'Farrellc7a00b14ab60
diff --git a/config/defaults.json b/config/defaults.json
index 92c46e1185..94c41e1757 100644
--- a/config/defaults.json
+++ b/config/defaults.json
@@ -4,7 +4,7 @@
"versions": {
"agentServer": "1.28.1",
"agentCanvas": "1.0.0-rc.11",
- "automation": "1.0.0a9"
+ "automation": "1.0.0a10"
},
"compatibility": {
diff --git a/scripts/dev-with-automation.mjs b/scripts/dev-with-automation.mjs
index 0037bc374c..a70db18085 100644
--- a/scripts/dev-with-automation.mjs
+++ b/scripts/dev-with-automation.mjs
@@ -40,6 +40,8 @@
* as OPENHANDS_AUTOMATION_API_KEY, making it available to agents in conversations.
* Both the agent-server and automation backend use the same key value
* and the same `X-Session-API-Key` header for authentication.
+ * AUTOMATION_KV_SECRET is derived from the session key if not set explicitly,
+ * enabling the KV store out of the box for local development.
*/
import { spawn, spawnSync } from "node:child_process";
@@ -257,6 +259,8 @@ SECRETS:
The session API key is automatically seeded into agent-server secrets
as OPENHANDS_AUTOMATION_API_KEY, making it available to agents in conversations.
Both backends (agent-server and automation) share the same key value.
+ AUTOMATION_KV_SECRET defaults to the session key so the KV store works
+ out of the box; override with an explicit value for stronger isolation.
ACCESS POINTS:
Main UI: http://localhost:PORT/
@@ -850,6 +854,14 @@ function startAutomationBackend(config) {
join(config.stateDir, "workspaces"),
// Session API key for self-hosted auth β€” shared with agent-server via X-Session-API-Key header
AUTOMATION_LOCAL_API_KEY: config.sessionApiKey,
+ // KV store secret β€” required for automations to use the built-in
+ // key-value store for state persistence between runs. Used for JWT
+ // signing and value encryption.
+ // Priority:
+ // 1. AUTOMATION_KV_SECRET explicitly set in the user's env
+ // 2. sessionApiKey β€” convenient zero-config default for local dev
+ AUTOMATION_KV_SECRET:
+ process.env.AUTOMATION_KV_SECRET || config.sessionApiKey,
// CORS: allow localhost origins for dev, unless explicitly overridden.
AUTOMATION_CORS_ORIGINS:
process.env.AUTOMATION_CORS_ORIGINS ||