diff --git a/apps/api/libs/query_engine/src/data_source_connections/get_redshift_connection.rs b/apps/api/libs/query_engine/src/data_source_connections/get_redshift_connection.rs index 9c8931b9c..3ce2d5e8a 100644 --- a/apps/api/libs/query_engine/src/data_source_connections/get_redshift_connection.rs +++ b/apps/api/libs/query_engine/src/data_source_connections/get_redshift_connection.rs @@ -15,11 +15,13 @@ pub async fn get_redshift_connection(credentials: &RedshiftCredentials) -> Resul .username(credentials.username.as_str()) .password(credentials.password.as_str()) .database(&credentials.default_database) - .extra_float_digits(2); + .extra_float_digits(2) + .connect_timeout(Duration::from_secs(60)); // 60 second connection timeout let redshift_pool = match PgPoolOptions::new() .max_connections(1) - .acquire_timeout(Duration::from_secs(5)) + .acquire_timeout(Duration::from_secs(60)) // 60 second acquire timeout + .connect_timeout(Duration::from_secs(60)) // 60 second pool connection timeout .connect_with(options) .await { diff --git a/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.test.ts b/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.test.ts index 56e31305a..afd982670 100644 --- a/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.test.ts +++ b/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.test.ts @@ -42,10 +42,7 @@ describe('delete-files-tool', () => { it('should validate input schema correctly', () => { const validInput = { - files: [ - { path: '/test/file1.txt' }, - { path: '/test/file2.txt' }, - ], + files: [{ path: '/test/file1.txt' }, { path: '/test/file2.txt' }], }; expect(() => deleteFiles.inputSchema.parse(validInput)).not.toThrow(); @@ -53,9 +50,7 @@ describe('delete-files-tool', () => { it('should reject invalid input schema', () => { const invalidInput = { - files: [ - { }, - ], + files: [{}], }; expect(() => deleteFiles.inputSchema.parse(invalidInput)).toThrow(); @@ -142,10 +137,7 @@ describe('delete-files-tool', () => { it('should handle mixed success and error results', async () => { const input = { - files: [ - { path: '/test/file1.txt' }, - { path: '/test/file2.txt' }, - ], + files: [{ path: '/test/file1.txt' }, { path: '/test/file2.txt' }], }; const mockLocalResult = [ @@ -161,10 +153,12 @@ describe('delete-files-tool', () => { }); expect(result.successes).toEqual(['/test/file1.txt']); - expect(result.failures).toEqual([{ - path: '/test/file2.txt', - error: 'Permission denied', - }]); + expect(result.failures).toEqual([ + { + path: '/test/file2.txt', + error: 'Permission denied', + }, + ]); }); it('should handle empty files array', async () => { diff --git a/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.ts b/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.ts index c4de10e4c..a574c0c74 100644 --- a/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.ts +++ b/packages/ai/src/tools/file-tools/delete-files-tool/delete-files-tool.ts @@ -6,11 +6,13 @@ import { z } from 'zod'; import { type SandboxContext, SandboxContextKey } from '../../../context/sandbox-context'; const deleteFilesInputSchema = z.object({ - files: z.array( - z.object({ - path: z.string().describe('File path to delete (absolute or relative)'), - }) - ).describe('Array of file deletion operations to perform'), + files: z + .array( + z.object({ + path: z.string().describe('File path to delete (absolute or relative)'), + }) + ) + .describe('Array of file deletion operations to perform'), }); const deleteFilesOutputSchema = z.object({ diff --git a/packages/data-source/src/adapters/redshift.test.ts b/packages/data-source/src/adapters/redshift.test.ts index 0f6c286a2..004513a82 100644 --- a/packages/data-source/src/adapters/redshift.test.ts +++ b/packages/data-source/src/adapters/redshift.test.ts @@ -47,6 +47,7 @@ describe('RedshiftAdapter', () => { user: 'testuser', password: 'testpass', ssl: true, + connectionTimeoutMillis: 60000, }); expect(mockClient.connect).toHaveBeenCalled(); }); diff --git a/packages/data-source/src/adapters/redshift.ts b/packages/data-source/src/adapters/redshift.ts index 25f46e626..2973bbd4d 100644 --- a/packages/data-source/src/adapters/redshift.ts +++ b/packages/data-source/src/adapters/redshift.ts @@ -40,10 +40,8 @@ export class RedshiftAdapter extends BaseAdapter { ssl: redshiftCredentials.ssl ?? true, // SSL is typically required for Redshift }; - // Handle connection timeout - if (redshiftCredentials.connection_timeout) { - config.connectionTimeoutMillis = redshiftCredentials.connection_timeout; - } + // Handle connection timeout - default to 60 seconds for serverless + config.connectionTimeoutMillis = redshiftCredentials.connection_timeout || 60000; // Set default schema if provided if (redshiftCredentials.schema) {