agent: pass workspace override via OPENCLAW_WORKSPACE env through gateway RPC

This commit is contained in:
kumarabhirup 2026-02-19 21:51:35 -08:00
parent 049cedc5fd
commit d65a7ab944
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -132,6 +132,8 @@ export async function agentViaGatewayCommand(opts: AgentCliOpts, runtime: Runtim
const channel = normalizeMessageChannel(opts.channel) ?? DEFAULT_CHAT_CHANNEL;
const idempotencyKey = opts.runId?.trim() || randomIdempotencyKey();
const workspaceOverride = process.env.OPENCLAW_WORKSPACE?.trim() || undefined;
const response = await withProgress(
{
label: "Waiting for agent reply…",
@ -157,6 +159,7 @@ export async function agentViaGatewayCommand(opts: AgentCliOpts, runtime: Runtim
lane: opts.lane,
extraSystemPrompt: opts.extraSystemPrompt,
idempotencyKey,
workspace: workspaceOverride,
},
expectFinal: true,
timeoutMs: gatewayTimeoutMs,
@ -240,6 +243,8 @@ async function agentViaGatewayStreamJson(opts: AgentCliOpts, _runtime: RuntimeEn
process.on("SIGTERM", onSignal);
process.on("SIGINT", onSignal);
const streamWorkspaceOverride = process.env.OPENCLAW_WORKSPACE?.trim() || undefined;
try {
const response = await callGateway<GatewayAgentResponse>({
method: "agent",
@ -259,6 +264,7 @@ async function agentViaGatewayStreamJson(opts: AgentCliOpts, _runtime: RuntimeEn
lane: opts.lane,
extraSystemPrompt: opts.extraSystemPrompt,
idempotencyKey,
workspace: streamWorkspaceOverride,
},
expectFinal: true,
timeoutMs: gatewayTimeoutMs,