@@ -16,6 +16,7 @@ import {AgentMode} from "../../AgentMode";
1616import type { Model , ReviewStartResponse , ThreadGoal , TurnCompletedNotification , TurnStartParams } from "../../app-server/v2" ;
1717import type { RateLimitsMap } from "../../RateLimitsMap" ;
1818import { ModelId } from "../../ModelId" ;
19+ import { SET_SESSION_TITLE_METHOD } from "../../AcpExtensions" ;
1920
2021describe ( 'ACP server test' , { timeout : 40_000 } , ( ) => {
2122
@@ -1306,6 +1307,26 @@ describe('ACP server test', { timeout: 40_000 }, () => {
13061307 await expect ( mockFixture . getAcpConnectionDump ( [ ] ) ) . toMatchFileSnapshot ( "data/command-status.json" ) ;
13071308 } ) ;
13081309
1310+ it ( 'handles rename slash command through Codex app server' , async ( ) => {
1311+ const { mockFixture, turnStartSpy } = setupPromptFixture ( ) ;
1312+ const threadSetNameSpy = vi . spyOn ( mockFixture . getCodexAppServerClient ( ) , "threadSetName" )
1313+ . mockResolvedValue ( { } ) ;
1314+
1315+ await mockFixture . getCodexAcpAgent ( ) . prompt ( {
1316+ sessionId : "session-id" ,
1317+ prompt : [ { type : "text" , text : "/rename Quarterly review" } ] ,
1318+ } ) ;
1319+
1320+ expect ( threadSetNameSpy ) . toHaveBeenCalledWith ( {
1321+ threadId : "session-id" ,
1322+ name : "Quarterly review" ,
1323+ } ) ;
1324+ expect ( turnStartSpy ) . not . toHaveBeenCalled ( ) ;
1325+ const [ event ] = mockFixture . getAcpConnectionEvents ( [ ] ) ;
1326+ expect ( event ) . toBeDefined ( ) ;
1327+ expect ( event ! . args [ 0 ] . update . content . text ) . toBe ( 'Renamed session to "Quarterly review".' ) ;
1328+ } ) ;
1329+
13091330 it ( 'passes skill slash commands through to Codex' , async ( ) => {
13101331 const { mockFixture, turnStartSpy } = setupPromptFixture ( ) ;
13111332
@@ -2618,6 +2639,39 @@ describe('ACP server test', { timeout: 40_000 }, () => {
26182639 expect ( event ! . args [ 0 ] . update . content . text ) . toBe ( 'Command "/review-branch" requires branch name.' ) ;
26192640 } ) ;
26202641
2642+ it ( 'reports missing rename slash command input' , async ( ) => {
2643+ const { mockFixture } = setupPromptFixture ( ) ;
2644+ const threadSetNameSpy = vi . spyOn ( mockFixture . getCodexAppServerClient ( ) , "threadSetName" )
2645+ . mockResolvedValue ( { } ) ;
2646+
2647+ await mockFixture . getCodexAcpAgent ( ) . prompt ( {
2648+ sessionId : "session-id" ,
2649+ prompt : [ { type : "text" , text : "/rename" } ] ,
2650+ } ) ;
2651+
2652+ expect ( threadSetNameSpy ) . not . toHaveBeenCalled ( ) ;
2653+ const [ event ] = mockFixture . getAcpConnectionEvents ( [ ] ) ;
2654+ expect ( event ) . toBeDefined ( ) ;
2655+ expect ( event ! . args [ 0 ] . update . content . text ) . toBe ( 'Command "/rename" requires new session title.' ) ;
2656+ } ) ;
2657+
2658+ it ( 'handles session setTitle extension through Codex app server' , async ( ) => {
2659+ const mockFixture = createCodexMockTestFixture ( ) ;
2660+ vi . spyOn ( mockFixture . getCodexAcpClient ( ) , "authRequired" ) . mockResolvedValue ( false ) ;
2661+ const threadSetNameSpy = vi . spyOn ( mockFixture . getCodexAppServerClient ( ) , "threadSetName" )
2662+ . mockResolvedValue ( { } ) ;
2663+
2664+ await expect ( mockFixture . getCodexAcpAgent ( ) . extMethod ( SET_SESSION_TITLE_METHOD , {
2665+ sessionId : "thread-id" ,
2666+ title : "Renamed from client" ,
2667+ } ) ) . resolves . toEqual ( { } ) ;
2668+
2669+ expect ( threadSetNameSpy ) . toHaveBeenCalledWith ( {
2670+ threadId : "thread-id" ,
2671+ name : "Renamed from client" ,
2672+ } ) ;
2673+ } ) ;
2674+
26212675 it ( 'handles logout command' , async ( ) => {
26222676 const codexAcpAgent = fixture . getCodexAcpAgent ( ) ;
26232677 await codexAcpAgent . initialize ( { protocolVersion : 1 } ) ;
0 commit comments