The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix: set AGENT_HOME env var for agent processes
Devin Foleyd671a59306b8
diff --git a/packages/adapters/claude-local/src/server/execute.ts b/packages/adapters/claude-local/src/server/execute.tsindex 13d92df80e..dfcd1173c4 100644--- a/packages/adapters/claude-local/src/server/execute.ts+++ b/packages/adapters/claude-local/src/server/execute.ts@@ -122,6 +122,7 @@ async function buildClaudeRuntimeConfig(input: ClaudeExecutionInput): Promise<Clconst workspaceRepoRef = asString(workspaceContext.repoRef, "") || null;const workspaceBranch = asString(workspaceContext.branchName, "") || null;const workspaceWorktreePath = asString(workspaceContext.worktreePath, "") || null;+ const agentHome = asString(workspaceContext.agentHome, "") || null;const workspaceHints = Array.isArray(context.paperclipWorkspaces)? context.paperclipWorkspaces.filter((value): value is Record<string, unknown> => typeof value === "object" && value !== null,@@ -216,6 +217,9 @@ async function buildClaudeRuntimeConfig(input: ClaudeExecutionInput): Promise<Clif (workspaceWorktreePath) {env.PAPERCLIP_WORKSPACE_WORKTREE_PATH = workspaceWorktreePath;}+ if (agentHome) {+ env.AGENT_HOME = agentHome;+ }if (workspaceHints.length > 0) {env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);}diff --git a/packages/adapters/codex-local/src/server/execute.ts b/packages/adapters/codex-local/src/server/execute.tsindex d4b3da464f..e1718cc155 100644--- a/packages/adapters/codex-local/src/server/execute.ts+++ b/packages/adapters/codex-local/src/server/execute.ts@@ -188,6 +188,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecconst workspaceRepoRef = asString(workspaceContext.repoRef, "");const workspaceBranch = asString(workspaceContext.branchName, "");const workspaceWorktreePath = asString(workspaceContext.worktreePath, "");+ const agentHome = asString(workspaceContext.agentHome, "");const workspaceHints = Array.isArray(context.paperclipWorkspaces)? context.paperclipWorkspaces.filter((value): value is Record<string, unknown> => typeof value === "object" && value !== null,@@ -293,6 +294,9 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecif (workspaceWorktreePath) {env.PAPERCLIP_WORKSPACE_WORKTREE_PATH = workspaceWorktreePath;}+ if (agentHome) {+ env.AGENT_HOME = agentHome;+ }if (workspaceHints.length > 0) {env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);}diff --git a/packages/adapters/cursor-local/src/server/execute.ts b/packages/adapters/cursor-local/src/server/execute.tsindex 9caf606b2a..5f369e11e3 100644--- a/packages/adapters/cursor-local/src/server/execute.ts+++ b/packages/adapters/cursor-local/src/server/execute.ts@@ -157,6 +157,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecconst workspaceId = asString(workspaceContext.workspaceId, "");const workspaceRepoUrl = asString(workspaceContext.repoUrl, "");const workspaceRepoRef = asString(workspaceContext.repoRef, "");+ const agentHome = asString(workspaceContext.agentHome, "");const workspaceHints = Array.isArray(context.paperclipWorkspaces)? context.paperclipWorkspaces.filter((value): value is Record<string, unknown> => typeof value === "object" && value !== null,@@ -230,6 +231,9 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecif (workspaceRepoRef) {env.PAPERCLIP_WORKSPACE_REPO_REF = workspaceRepoRef;}+ if (agentHome) {+ env.AGENT_HOME = agentHome;+ }if (workspaceHints.length > 0) {env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);}diff --git a/packages/adapters/gemini-local/src/server/execute.ts b/packages/adapters/gemini-local/src/server/execute.tsindex fc2930668d..e2769c3edb 100644--- a/packages/adapters/gemini-local/src/server/execute.ts+++ b/packages/adapters/gemini-local/src/server/execute.ts@@ -145,6 +145,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecconst workspaceId = asString(workspaceContext.workspaceId, "");const workspaceRepoUrl = asString(workspaceContext.repoUrl, "");const workspaceRepoRef = asString(workspaceContext.repoRef, "");+ const agentHome = asString(workspaceContext.agentHome, "");const workspaceHints = Array.isArray(context.paperclipWorkspaces)? context.paperclipWorkspaces.filter((value): value is Record<string, unknown> => typeof value === "object" && value !== null,@@ -196,6 +197,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecif (workspaceId) env.PAPERCLIP_WORKSPACE_ID = workspaceId;if (workspaceRepoUrl) env.PAPERCLIP_WORKSPACE_REPO_URL = workspaceRepoUrl;if (workspaceRepoRef) env.PAPERCLIP_WORKSPACE_REPO_REF = workspaceRepoRef;+ if (agentHome) env.AGENT_HOME = agentHome;if (workspaceHints.length > 0) env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);for (const [key, value] of Object.entries(envConfig)) {diff --git a/packages/adapters/opencode-local/src/server/execute.ts b/packages/adapters/opencode-local/src/server/execute.tsindex 06b5a99fb0..98285cfc03 100644--- a/packages/adapters/opencode-local/src/server/execute.ts+++ b/packages/adapters/opencode-local/src/server/execute.ts@@ -100,6 +100,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecconst workspaceId = asString(workspaceContext.workspaceId, "");const workspaceRepoUrl = asString(workspaceContext.repoUrl, "");const workspaceRepoRef = asString(workspaceContext.repoRef, "");+ const agentHome = asString(workspaceContext.agentHome, "");const workspaceHints = Array.isArray(context.paperclipWorkspaces)? context.paperclipWorkspaces.filter((value): value is Record<string, unknown> => typeof value === "object" && value !== null,@@ -151,6 +152,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecif (workspaceId) env.PAPERCLIP_WORKSPACE_ID = workspaceId;if (workspaceRepoUrl) env.PAPERCLIP_WORKSPACE_REPO_URL = workspaceRepoUrl;if (workspaceRepoRef) env.PAPERCLIP_WORKSPACE_REPO_REF = workspaceRepoRef;+ if (agentHome) env.AGENT_HOME = agentHome;if (workspaceHints.length > 0) env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);for (const [key, value] of Object.entries(envConfig)) {diff --git a/packages/adapters/pi-local/src/server/execute.ts b/packages/adapters/pi-local/src/server/execute.tsindex 810ec1ce67..85a0d84424 100644--- a/packages/adapters/pi-local/src/server/execute.ts+++ b/packages/adapters/pi-local/src/server/execute.ts@@ -117,6 +117,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecconst workspaceId = asString(workspaceContext.workspaceId, "");const workspaceRepoUrl = asString(workspaceContext.repoUrl, "");const workspaceRepoRef = asString(workspaceContext.repoRef, "");+ const agentHome = asString(workspaceContext.agentHome, "");const workspaceHints = Array.isArray(context.paperclipWorkspaces)? context.paperclipWorkspaces.filter((value): value is Record<string, unknown> => typeof value === "object" && value !== null,@@ -176,6 +177,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExecif (workspaceId) env.PAPERCLIP_WORKSPACE_ID = workspaceId;if (workspaceRepoUrl) env.PAPERCLIP_WORKSPACE_REPO_URL = workspaceRepoUrl;if (workspaceRepoRef) env.PAPERCLIP_WORKSPACE_REPO_REF = workspaceRepoRef;+ if (agentHome) env.AGENT_HOME = agentHome;if (workspaceHints.length > 0) env.PAPERCLIP_WORKSPACES_JSON = JSON.stringify(workspaceHints);for (const [key, value] of Object.entries(envConfig)) {diff --git a/server/src/services/heartbeat.ts b/server/src/services/heartbeat.tsindex eec83d080e..bddf6a83dd 100644--- a/server/src/services/heartbeat.ts+++ b/server/src/services/heartbeat.ts@@ -1523,6 +1523,7 @@ export function heartbeatService(db: Db) {repoRef: executionWorkspace.repoRef,branchName: executionWorkspace.branchName,worktreePath: executionWorkspace.worktreePath,+ agentHome: resolveDefaultAgentWorkspaceDir(agent.id),};context.paperclipWorkspaces = resolvedWorkspace.workspaceHints;const runtimeServiceIntents = (() => {