🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix: pass workspaceId to cloud-sandbox MarketService (#19023)
LiJian35a654d8e6bd
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/cloudSandbox.test.ts b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/cloudSandbox.test.tsindex 7a1b805610e..33c5fc1a15b 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/cloudSandbox.test.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/cloudSandbox.test.ts@@ -11,6 +11,7 @@ const mocks = vi.hoisted(() => {return {createSandboxService: vi.fn(),FakeSandboxService,+ MarketService: vi.fn(() => ({})),preprocessLhCommand: vi.fn(),sandboxService: new FakeSandboxService(),};@@ -21,7 +22,7 @@ vi.mock('@/server/services/file', () => ({}));vi.mock('@/server/services/market', () => ({- MarketService: vi.fn(() => ({})),+ MarketService: mocks.MarketService,}));vi.mock('@/server/services/sandbox', () => ({@@ -88,6 +89,22 @@ describe('cloudSandboxRuntime', () => {);});+ // `injectCredsToSandbox` (the `creds` runtime) threads `workspaceId` into its+ // MarketService, which routes workspace requests to an `org-<id>` sandbox+ // session on the market backend. If this runtime's MarketService omits+ // `workspaceId`, its shell calls resolve to the personal session instead —+ // a different sandbox than the one credentials were just injected into.+ it('scopes its MarketService to the request workspace', async () => {+ const { cloudSandboxRuntime } = await import('../cloudSandbox');+ await cloudSandboxRuntime.factory(buildContext({ workspaceId: 'ws-42' }));++ expect(mocks.MarketService).toHaveBeenCalledWith(+ expect.objectContaining({+ userInfo: { userId: 'user-1', workspaceId: 'ws-42' },+ }),+ );+ });+it('leaves non-shell tools untouched', async () => {const { cloudSandboxRuntime } = await import('../cloudSandbox');const runtime = await cloudSandboxRuntime.factory(buildContext());diff --git a/apps/server/src/services/toolExecution/serverRuntimes/cloudSandbox.ts b/apps/server/src/services/toolExecution/serverRuntimes/cloudSandbox.tsindex f608dfd88e5..a98d6dca81c 100644--- a/apps/server/src/services/toolExecution/serverRuntimes/cloudSandbox.ts+++ b/apps/server/src/services/toolExecution/serverRuntimes/cloudSandbox.ts@@ -83,7 +83,7 @@ export const cloudSandboxRuntime: ServerRuntimeRegistration = {const marketService = new MarketService({accessToken,- userInfo: { userId: context.userId },+ userInfo: { userId: context.userId, workspaceId: context.workspaceId },});const fileService = new FileService(context.serverDB, context.userId, context.workspaceId);const sandboxService = createSandboxService({