@@ -16,6 +16,7 @@ import {AgentMode} from "../../AgentMode";
1616import type { Model , ReviewStartResponse , 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
@@ -1291,6 +1292,26 @@ describe('ACP server test', { timeout: 40_000 }, () => {
12911292 await expect ( mockFixture . getAcpConnectionDump ( [ ] ) ) . toMatchFileSnapshot ( "data/command-status.json" ) ;
12921293 } ) ;
12931294
1295+ it ( 'handles rename slash command through Codex app server' , async ( ) => {
1296+ const { mockFixture, turnStartSpy } = setupPromptFixture ( ) ;
1297+ const threadSetNameSpy = vi . spyOn ( mockFixture . getCodexAppServerClient ( ) , "threadSetName" )
1298+ . mockResolvedValue ( { } ) ;
1299+
1300+ await mockFixture . getCodexAcpAgent ( ) . prompt ( {
1301+ sessionId : "session-id" ,
1302+ prompt : [ { type : "text" , text : "/rename Quarterly review" } ] ,
1303+ } ) ;
1304+
1305+ expect ( threadSetNameSpy ) . toHaveBeenCalledWith ( {
1306+ threadId : "session-id" ,
1307+ name : "Quarterly review" ,
1308+ } ) ;
1309+ expect ( turnStartSpy ) . not . toHaveBeenCalled ( ) ;
1310+ const [ event ] = mockFixture . getAcpConnectionEvents ( [ ] ) ;
1311+ expect ( event ) . toBeDefined ( ) ;
1312+ expect ( event ! . args [ 0 ] . update . content . text ) . toBe ( 'Renamed session to "Quarterly review".' ) ;
1313+ } ) ;
1314+
12941315 it ( 'passes skill slash commands through to Codex' , async ( ) => {
12951316 const { mockFixture, turnStartSpy } = setupPromptFixture ( ) ;
12961317
@@ -1519,6 +1540,39 @@ describe('ACP server test', { timeout: 40_000 }, () => {
15191540 expect ( event ! . args [ 0 ] . update . content . text ) . toBe ( 'Command "/review-branch" requires branch name.' ) ;
15201541 } ) ;
15211542
1543+ it ( 'reports missing rename slash command input' , async ( ) => {
1544+ const { mockFixture } = setupPromptFixture ( ) ;
1545+ const threadSetNameSpy = vi . spyOn ( mockFixture . getCodexAppServerClient ( ) , "threadSetName" )
1546+ . mockResolvedValue ( { } ) ;
1547+
1548+ await mockFixture . getCodexAcpAgent ( ) . prompt ( {
1549+ sessionId : "session-id" ,
1550+ prompt : [ { type : "text" , text : "/rename" } ] ,
1551+ } ) ;
1552+
1553+ expect ( threadSetNameSpy ) . not . toHaveBeenCalled ( ) ;
1554+ const [ event ] = mockFixture . getAcpConnectionEvents ( [ ] ) ;
1555+ expect ( event ) . toBeDefined ( ) ;
1556+ expect ( event ! . args [ 0 ] . update . content . text ) . toBe ( 'Command "/rename" requires new session title.' ) ;
1557+ } ) ;
1558+
1559+ it ( 'handles session setTitle extension through Codex app server' , async ( ) => {
1560+ const mockFixture = createCodexMockTestFixture ( ) ;
1561+ vi . spyOn ( mockFixture . getCodexAcpClient ( ) , "authRequired" ) . mockResolvedValue ( false ) ;
1562+ const threadSetNameSpy = vi . spyOn ( mockFixture . getCodexAppServerClient ( ) , "threadSetName" )
1563+ . mockResolvedValue ( { } ) ;
1564+
1565+ await expect ( mockFixture . getCodexAcpAgent ( ) . extMethod ( SET_SESSION_TITLE_METHOD , {
1566+ sessionId : "thread-id" ,
1567+ title : "Renamed from client" ,
1568+ } ) ) . resolves . toEqual ( { } ) ;
1569+
1570+ expect ( threadSetNameSpy ) . toHaveBeenCalledWith ( {
1571+ threadId : "thread-id" ,
1572+ name : "Renamed from client" ,
1573+ } ) ;
1574+ } ) ;
1575+
15221576 it ( 'handles logout command' , async ( ) => {
15231577 const codexAcpAgent = fixture . getCodexAcpAgent ( ) ;
15241578 await codexAcpAgent . initialize ( { protocolVersion : 1 } ) ;
0 commit comments