@@ -1738,7 +1738,7 @@ describe("gateway server sessions", () => {
17381738 } ) ;
17391739
17401740 test ( "sessions.reset closes ACP runtime handles for ACP sessions" , async ( ) => {
1741- const { dir } = await createSessionStoreDir ( ) ;
1741+ const { dir, storePath } = await createSessionStoreDir ( ) ;
17421742 await writeSingleLineSession ( dir , "sess-main" , "hello" ) ;
17431743
17441744 await writeSessionStore ( {
@@ -1751,24 +1751,87 @@ describe("gateway server sessions", () => {
17511751 agent : "codex" ,
17521752 runtimeSessionName : "runtime:reset" ,
17531753 mode : "persistent" ,
1754+ runtimeOptions : {
1755+ runtimeMode : "auto" ,
1756+ timeoutSeconds : 30 ,
1757+ } ,
1758+ cwd : "/tmp/acp-session" ,
17541759 state : "idle" ,
17551760 lastActivityAt : Date . now ( ) ,
17561761 } ,
17571762 } ,
17581763 } ,
17591764 } ) ;
17601765 const { ws } = await openClient ( ) ;
1761- const reset = await rpcReq < { ok : true ; key : string } > ( ws , "sessions.reset" , {
1766+ const reset = await rpcReq < {
1767+ ok : true ;
1768+ key : string ;
1769+ entry : {
1770+ acp ?: {
1771+ backend ?: string ;
1772+ agent ?: string ;
1773+ runtimeSessionName ?: string ;
1774+ mode ?: string ;
1775+ runtimeOptions ?: {
1776+ runtimeMode ?: string ;
1777+ timeoutSeconds ?: number ;
1778+ } ;
1779+ cwd ?: string ;
1780+ state ?: string ;
1781+ } ;
1782+ } ;
1783+ } > ( ws , "sessions.reset" , {
17621784 key : "main" ,
17631785 } ) ;
17641786 expect ( reset . ok ) . toBe ( true ) ;
1787+ expect ( reset . payload ?. entry . acp ) . toMatchObject ( {
1788+ backend : "acpx" ,
1789+ agent : "codex" ,
1790+ runtimeSessionName : "runtime:reset" ,
1791+ mode : "persistent" ,
1792+ runtimeOptions : {
1793+ runtimeMode : "auto" ,
1794+ timeoutSeconds : 30 ,
1795+ } ,
1796+ cwd : "/tmp/acp-session" ,
1797+ state : "idle" ,
1798+ } ) ;
17651799 expect ( acpManagerMocks . closeSession ) . toHaveBeenCalledWith ( {
17661800 allowBackendUnavailable : true ,
17671801 cfg : expect . any ( Object ) ,
17681802 requireAcpSession : false ,
17691803 reason : "session-reset" ,
17701804 sessionKey : "agent:main:main" ,
17711805 } ) ;
1806+ const store = JSON . parse ( await fs . readFile ( storePath , "utf-8" ) ) as Record <
1807+ string ,
1808+ {
1809+ acp ?: {
1810+ backend ?: string ;
1811+ agent ?: string ;
1812+ runtimeSessionName ?: string ;
1813+ mode ?: string ;
1814+ runtimeOptions ?: {
1815+ runtimeMode ?: string ;
1816+ timeoutSeconds ?: number ;
1817+ } ;
1818+ cwd ?: string ;
1819+ state ?: string ;
1820+ } ;
1821+ }
1822+ > ;
1823+ expect ( store [ "agent:main:main" ] ?. acp ) . toMatchObject ( {
1824+ backend : "acpx" ,
1825+ agent : "codex" ,
1826+ runtimeSessionName : "runtime:reset" ,
1827+ mode : "persistent" ,
1828+ runtimeOptions : {
1829+ runtimeMode : "auto" ,
1830+ timeoutSeconds : 30 ,
1831+ } ,
1832+ cwd : "/tmp/acp-session" ,
1833+ state : "idle" ,
1834+ } ) ;
17721835
17731836 ws . close ( ) ;
17741837 } ) ;
0 commit comments