From 8e42c6cdac1efe11738e4a316d3dbd654a0c29f2 Mon Sep 17 00:00:00 2001 From: Wes Belt Date: Fri, 3 Apr 2026 11:25:58 -0400 Subject: [PATCH 1/2] fix(openclaw-gateway): make claimedApiKeyPath configurable per agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The openclaw_gateway adapter hardcodes the Paperclip API key path to ~/.openclaw/workspace/paperclip-claimed-api-key.json in buildWakeText(). In multi-agent OpenClaw deployments, each agent has its own workspace with its own key file. The hardcoded path forces all agents to share one key, breaking agent identity isolation. Add a claimedApiKeyPath field to the adapter config (with UI input) that allows operators to set a per-agent path. Falls back to the current default when unset — zero behavior change for existing deployments. Fixes #930 --- .../adapters/openclaw-gateway/src/server/execute.ts | 12 +++++++++--- ui/src/adapters/openclaw-gateway/config-fields.tsx | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/adapters/openclaw-gateway/src/server/execute.ts b/packages/adapters/openclaw-gateway/src/server/execute.ts index f1c85c11..16116041 100644 --- a/packages/adapters/openclaw-gateway/src/server/execute.ts +++ b/packages/adapters/openclaw-gateway/src/server/execute.ts @@ -313,6 +313,12 @@ function resolvePaperclipApiUrlOverride(value: unknown): string | null { } } +const DEFAULT_CLAIMED_API_KEY_PATH = "~/.openclaw/workspace/paperclip-claimed-api-key.json"; + +function resolveClaimedApiKeyPath(value: unknown): string { + return nonEmpty(value) ?? DEFAULT_CLAIMED_API_KEY_PATH; +} + function buildPaperclipEnvForWake(ctx: AdapterExecutionContext, wakePayload: WakePayload): Record { const paperclipApiUrlOverride = resolvePaperclipApiUrlOverride(ctx.config.paperclipApiUrl); const paperclipEnv: Record = { @@ -335,8 +341,7 @@ function buildPaperclipEnvForWake(ctx: AdapterExecutionContext, wakePayload: Wak return paperclipEnv; } -function buildWakeText(payload: WakePayload, paperclipEnv: Record): string { - const claimedApiKeyPath = "~/.openclaw/workspace/paperclip-claimed-api-key.json"; +function buildWakeText(payload: WakePayload, paperclipEnv: Record, claimedApiKeyPath: string): string { const orderedKeys = [ "PAPERCLIP_RUN_ID", "PAPERCLIP_AGENT_ID", @@ -1053,7 +1058,8 @@ export async function execute(ctx: AdapterExecutionContext): Promise + + mark("adapterConfig", "claimedApiKeyPath", v || undefined)} + immediate + className={inputClass} + placeholder="~/.openclaw/workspace/paperclip-claimed-api-key.json" + /> + +