@@ -37,6 +37,10 @@ const PROVIDER_CONFIGS: Array<[string, string]> = [
3737 [ "anthropic" , "claude-sonnet-4-5" ] ,
3838] ;
3939
40+ // Use Anthropic by default for provider-agnostic tests (faster and cheaper)
41+ const DEFAULT_PROVIDER = "anthropic" ;
42+ const DEFAULT_MODEL = "claude-sonnet-4-5" ;
43+
4044// Integration test timeout guidelines:
4145// - Individual tests should complete within 10 seconds when possible
4246// - Use tight timeouts (5-10s) for event waiting to fail fast
@@ -55,8 +59,9 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
5559 const { loadTokenizerModules } = await import ( "../../src/utils/main/tokenizer" ) ;
5660 await loadTokenizerModules ( ) ;
5761 } , 30000 ) ; // 30s timeout for tokenizer loading
58- // Run tests for each provider concurrently
59- describe . each ( PROVIDER_CONFIGS ) ( "%s:%s provider tests" , ( provider , model ) => {
62+
63+ // Smoke test - verify each provider works
64+ describe . each ( PROVIDER_CONFIGS ) ( "%s:%s smoke test" , ( provider , model ) => {
6065 test . concurrent (
6166 "should successfully send message and receive response" ,
6267 async ( ) => {
@@ -91,6 +96,12 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
9196 } ,
9297 15000
9398 ) ;
99+ } ) ;
100+
101+ // Core functionality tests - using single provider (these test IPC/streaming, not provider-specific behavior)
102+ describe ( "core functionality" , ( ) => {
103+ const provider = DEFAULT_PROVIDER ;
104+ const model = DEFAULT_MODEL ;
94105
95106 test . concurrent (
96107 "should interrupt streaming with interruptStream()" ,
@@ -269,11 +280,6 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
269280 test . concurrent (
270281 "should handle reconnection during active stream" ,
271282 async ( ) => {
272- // Only test with Anthropic (faster and more reliable for this test)
273- if ( provider === "openai" ) {
274- return ;
275- }
276-
277283 const { env, workspaceId, cleanup } = await setupWorkspace ( provider ) ;
278284 try {
279285 // Start a stream with tool call that takes a long time
@@ -557,7 +563,7 @@ describeIntegration("IpcMain sendMessage integration tests", () => {
557563 const collector = await waitForStreamSuccess (
558564 env . sentEvents ,
559565 workspaceId ,
560- provider === "openai" ? 30000 : 10000
566+ 10000
561567 ) ;
562568
563569 // Get the final assistant message
@@ -783,50 +789,6 @@ These are general instructions that apply to all modes.
783789 ) ;
784790 } ) ;
785791
786- // Provider parity tests - ensure both providers handle the same scenarios
787- describe ( "provider parity" , ( ) => {
788- test . concurrent (
789- "both providers should handle the same message" ,
790- async ( ) => {
791- const results : Record < string , { success : boolean ; responseLength : number } > = { } ;
792-
793- for ( const [ provider , model ] of PROVIDER_CONFIGS ) {
794- // Create fresh environment with provider setup
795- const { env, workspaceId, cleanup } = await setupWorkspace ( provider ) ;
796-
797- // Send same message to both providers
798- const result = await sendMessageWithModel (
799- env . mockIpcRenderer ,
800- workspaceId ,
801- "Say 'parity test' and nothing else" ,
802- provider ,
803- model
804- ) ;
805-
806- // Collect response
807- const collector = await waitForStreamSuccess ( env . sentEvents , workspaceId , 10000 ) ;
808-
809- results [ provider ] = {
810- success : result . success ,
811- responseLength : collector . getDeltas ( ) . length ,
812- } ;
813-
814- // Cleanup
815- await cleanup ( ) ;
816- }
817-
818- // Verify both providers succeeded
819- expect ( results . openai . success ) . toBe ( true ) ;
820- expect ( results . anthropic . success ) . toBe ( true ) ;
821-
822- // Verify both providers generated responses (non-zero deltas)
823- expect ( results . openai . responseLength ) . toBeGreaterThan ( 0 ) ;
824- expect ( results . anthropic . responseLength ) . toBeGreaterThan ( 0 ) ;
825- } ,
826- 30000
827- ) ;
828- } ) ;
829-
830792 // Error handling tests for API key issues
831793 describe ( "API key error handling" , ( ) => {
832794 test . each ( PROVIDER_CONFIGS ) (
@@ -904,43 +866,31 @@ These are general instructions that apply to all modes.
904866 ) ;
905867 } ) ;
906868
907- // Token limit error handling tests
869+ // Token limit error handling tests - using single provider to reduce test time (expensive test)
908870 describe ( "token limit error handling" , ( ) => {
909- test . each ( PROVIDER_CONFIGS ) (
910- "%s should return error when accumulated history exceeds token limit" ,
911- async ( provider , model ) => {
871+ test . concurrent (
872+ "should return error when accumulated history exceeds token limit" ,
873+ async ( ) => {
874+ const provider = DEFAULT_PROVIDER ;
875+ const model = DEFAULT_MODEL ;
912876 const { env, workspaceId, cleanup } = await setupWorkspace ( provider ) ;
913877 try {
914878 // Build up large conversation history to exceed context limits
915- // Different providers have different limits:
916- // - Anthropic: 200k tokens → need ~40 messages of 50k chars (2M chars total)
917- // - OpenAI: varies by model, use ~80 messages (4M chars total) to ensure we hit the limit
879+ // For Anthropic: 200k tokens → need ~10 messages of 50k chars (500k chars total) to exceed
880+ // Reduced from 40 messages to speed up test while still triggering the error
918881 await buildLargeHistory ( workspaceId , env . config , {
919882 messageSize : 50_000 ,
920- messageCount : provider === "anthropic" ? 40 : 80 ,
883+ messageCount : 10 ,
921884 } ) ;
922885
923886 // Now try to send a new message - should trigger token limit error
924887 // due to accumulated history
925- // Disable auto-truncation to force context error
926- const sendOptions =
927- provider === "openai"
928- ? {
929- providerOptions : {
930- openai : {
931- disableAutoTruncation : true ,
932- forceContextLimitError : true ,
933- } ,
934- } ,
935- }
936- : undefined ;
937888 const result = await sendMessageWithModel (
938889 env . mockIpcRenderer ,
939890 workspaceId ,
940891 "What is the weather?" ,
941892 provider ,
942- model ,
943- sendOptions
893+ model
944894 ) ;
945895
946896 // IPC call itself should succeed (errors come through stream events)
0 commit comments