From 1c91f3f09f6b4b043a5ed861edb96ec9ad368faa Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 23 Apr 2026 03:52:59 +0100 Subject: [PATCH] fix: route btw provider streams by workspace (#70413) (thanks @suboss87) --- CHANGELOG.md | 1 + src/agents/btw.test.ts | 1 + src/agents/btw.ts | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29898c57b24..ca1de726e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Docs: https://docs.openclaw.ai ### Fixes +- Agents/BTW: route `/btw` side questions through provider stream registration with the session workspace, so Ollama provider URL construction and workspace-scoped hooks apply correctly. Fixes #68336. (#70413) Thanks @suboss87. - Codex harness: route Codex-tagged MCP tool approval elicitations through OpenClaw plugin approvals, including current empty-schema app-server requests, while leaving generic user-input prompts fail-closed. (#68807) Thanks @kesslerio. - WhatsApp/outbound: hold an in-memory active-delivery claim while a live outbound send is in flight, so a concurrent reconnect drain no longer re-drives the same pending queue entry and duplicates cron sends 7-12x after the 30-minute inbound-silence watchdog fires mid-delivery. Crash-replay of fresh queue entries left behind by a dead process is preserved because the claim is intentionally process-local. Fixes #70386. (#70428) Thanks @neeravmakwana. - Providers/SDK retry: cap long `Retry-After` sleeps in Stainless-based Anthropic/OpenAI model SDKs so 60s+ retry windows surface immediately for OpenClaw failover instead of blocking the run. (#68474) Thanks @jetd1. diff --git a/src/agents/btw.test.ts b/src/agents/btw.test.ts index 9f64d956c13..2bcc19260e3 100644 --- a/src/agents/btw.test.ts +++ b/src/agents/btw.test.ts @@ -466,6 +466,7 @@ describe("runBtwSideQuestion", () => { api: "openai-completions", baseUrl: "https://ollama.com/", }), + workspaceDir: "/tmp/workspace", }), ); expect(providerStreamFn).toHaveBeenCalledTimes(1); diff --git a/src/agents/btw.ts b/src/agents/btw.ts index 0530a2d748a..40199e560da 100644 --- a/src/agents/btw.ts +++ b/src/agents/btw.ts @@ -398,12 +398,12 @@ export async function runBtwSideQuestion( apiKeyInfo.mode === "aws-sdk" && !apiKeyInfo.apiKey ? undefined : requireApiKey(apiKeyInfo, model.provider); + const sessionAgentId = resolveSessionAgentId({ + sessionKey: params.sessionKey, + config: params.cfg, + }); + const workspaceDir = resolveAgentWorkspaceDir(params.cfg, sessionAgentId); if (apiKey) { - const sessionAgentId = resolveSessionAgentId({ - sessionKey: params.sessionKey, - config: params.cfg, - }); - const workspaceDir = resolveAgentWorkspaceDir(params.cfg, sessionAgentId); const preparedAuth = await prepareProviderRuntimeAuth({ provider: model.provider, config: params.cfg, @@ -441,6 +441,7 @@ export async function runBtwSideQuestion( model: runtimeModel, cfg: params.cfg, agentDir: params.agentDir, + workspaceDir, env: process.env, });