@@ -504,6 +504,64 @@ describe('ACP server test', { timeout: 40_000 }, () => {
504504 expect ( listSkillsSpy ) . not . toHaveBeenCalled ( ) ;
505505 } ) ;
506506
507+ it ( 'passes AIR custom instructions to thread start' , async ( ) => {
508+ const mockFixture = createCodexMockTestFixture ( ) ;
509+ const codexAcpClient = mockFixture . getCodexAcpClient ( ) ;
510+ const codexAppServerClient = mockFixture . getCodexAppServerClient ( ) ;
511+ vi . spyOn ( codexAppServerClient , "listSkills" ) . mockResolvedValue ( { data : [ ] } ) ;
512+ const threadStartSpy = vi . spyOn ( codexAppServerClient , "threadStart" ) . mockResolvedValue ( {
513+ thread : { id : "thread-id" } as any ,
514+ model : "gpt-5" ,
515+ reasoningEffort : "medium" ,
516+ serviceTier : null ,
517+ } as any ) ;
518+ vi . spyOn ( codexAppServerClient , "listModels" ) . mockResolvedValue ( {
519+ data : [ createTestModel ( { id : "gpt-5" } ) ] ,
520+ nextCursor : null ,
521+ } ) ;
522+
523+ await codexAcpClient . newSession ( {
524+ cwd : "/workspace" ,
525+ mcpServers : [ ] ,
526+ _meta : {
527+ jetbrains : {
528+ air : {
529+ customInstructions : "Follow the project rules." ,
530+ } ,
531+ } ,
532+ } ,
533+ } ) ;
534+
535+ expect ( threadStartSpy ) . toHaveBeenCalledWith ( expect . objectContaining ( {
536+ developerInstructions : "Follow the project rules." ,
537+ } ) ) ;
538+ } ) ;
539+
540+ it ( 'ignores malformed AIR custom instructions' , async ( ) => {
541+ const mockFixture = createCodexMockTestFixture ( ) ;
542+ const codexAcpClient = mockFixture . getCodexAcpClient ( ) ;
543+ const codexAppServerClient = mockFixture . getCodexAppServerClient ( ) ;
544+ vi . spyOn ( codexAppServerClient , "listSkills" ) . mockResolvedValue ( { data : [ ] } ) ;
545+ const threadStartSpy = vi . spyOn ( codexAppServerClient , "threadStart" ) . mockResolvedValue ( {
546+ thread : { id : "thread-id" } as any ,
547+ model : "gpt-5" ,
548+ reasoningEffort : "medium" ,
549+ serviceTier : null ,
550+ } as any ) ;
551+ vi . spyOn ( codexAppServerClient , "listModels" ) . mockResolvedValue ( {
552+ data : [ createTestModel ( { id : "gpt-5" } ) ] ,
553+ nextCursor : null ,
554+ } ) ;
555+
556+ await codexAcpClient . newSession ( {
557+ cwd : "/workspace" ,
558+ mcpServers : [ ] ,
559+ _meta : { jetbrains : { air : { customInstructions : 42 } } } ,
560+ } ) ;
561+
562+ expect ( threadStartSpy . mock . calls [ 0 ] ! [ 0 ] . developerInstructions ) . toBeUndefined ( ) ;
563+ } ) ;
564+
507565 it ( 'prefers ACP additional directories over legacy meta roots for new session skill discovery' , async ( ) => {
508566 const mockFixture = createCodexMockTestFixture ( ) ;
509567 const codexAcpClient = mockFixture . getCodexAcpClient ( ) ;
0 commit comments