@@ -113,6 +113,42 @@ describe("Codex Provider Definition", () => {
113113 expect ( result . argv . some ( ( a : string ) => a . startsWith ( "notify=" ) ) ) . toBe ( false ) ;
114114 } ) ;
115115
116+ it ( "injects notify bridge arguments when bridgeScriptPath is provided" , ( ) => {
117+ const config : ProviderConfig = { additionalArgs : [ "--flag" ] , envVars : { } } ;
118+ const ctx = {
119+ sessionId : "session-123" ,
120+ workspacePath : "/workspace" ,
121+ bridgeScriptPath : "/home/test/.coder-studio/hooks/codex-bridge.js" ,
122+ } ;
123+
124+ const result = codexDefinition . buildCommand ( config , ctx ) ;
125+
126+ expect ( result . argv ) . toEqual ( [
127+ "codex" ,
128+ "-c" ,
129+ 'notify=["node","/home/test/.coder-studio/hooks/codex-bridge.js"]' ,
130+ "--flag" ,
131+ ] ) ;
132+ } ) ;
133+
134+ it ( "keeps notify injection ahead of additional args with paths that contain spaces" , ( ) => {
135+ const config : ProviderConfig = { additionalArgs : [ "--flag" ] , envVars : { } } ;
136+ const ctx = {
137+ sessionId : "session-123" ,
138+ workspacePath : "/workspace" ,
139+ bridgeScriptPath : "/home/with space/codex bridge.js" ,
140+ } ;
141+
142+ const result = codexDefinition . buildCommand ( config , ctx ) ;
143+
144+ expect ( result . argv ) . toEqual ( [
145+ "codex" ,
146+ "-c" ,
147+ 'notify=["node","/home/with space/codex bridge.js"]' ,
148+ "--flag" ,
149+ ] ) ;
150+ } ) ;
151+
116152 it ( "should include additional arguments and env vars" , ( ) => {
117153 const config : ProviderConfig = {
118154 additionalArgs : [ "--flag" ] ,
@@ -132,6 +168,40 @@ describe("Codex Provider Definition", () => {
132168 } ) ;
133169 } ) ;
134170
171+ describe ( "buildResumeCommand" , ( ) => {
172+ it ( "builds a resume command and retains notify bridge injection" , ( ) => {
173+ const config : ProviderConfig = { additionalArgs : [ "--flag" ] , envVars : { TOKEN : "abc" } } ;
174+ const ctx = {
175+ sessionId : "session-123" ,
176+ workspacePath : "/workspace" ,
177+ bridgeScriptPath : "/bridge.js" ,
178+ } ;
179+
180+ const result = codexDefinition . buildResumeCommand ?.( config , ctx , "thread-uuid-1" ) ;
181+
182+ expect ( result ) . toEqual ( {
183+ argv : [ "codex" , "resume" , "thread-uuid-1" , "-c" , 'notify=["node","/bridge.js"]' , "--flag" ] ,
184+ env : {
185+ TOKEN : "abc" ,
186+ CODER_STUDIO_SESSION_ID : "session-123" ,
187+ } ,
188+ cwd : "/workspace" ,
189+ } ) ;
190+ } ) ;
191+
192+ it ( "omits notify injection on resume when bridgeScriptPath is missing" , ( ) => {
193+ const config : ProviderConfig = { additionalArgs : [ "--flag" ] , envVars : { } } ;
194+ const ctx = {
195+ sessionId : "session-123" ,
196+ workspacePath : "/workspace" ,
197+ } ;
198+
199+ const result = codexDefinition . buildResumeCommand ?.( config , ctx , "thread-uuid-1" ) ;
200+
201+ expect ( result ?. argv ) . toEqual ( [ "codex" , "resume" , "thread-uuid-1" , "--flag" ] ) ;
202+ } ) ;
203+ } ) ;
204+
135205 describe ( "buildSupervisorEvalCommand" , ( ) => {
136206 it ( "builds a supervisor eval command with codex exec --json" , ( ) => {
137207 const result = codexDefinition . buildSupervisorEvalCommand ?.(
@@ -197,11 +267,17 @@ describe("Codex Provider Definition", () => {
197267 expect ( codexDefinition . idleHeuristics ?. idleDebounceMs ) . toBe ( 3000 ) ;
198268 } ) ;
199269
200- it ( "does not expose legacy hooks or transcript helpers " , ( ) => {
270+ it ( "keeps legacy hook fields absent while exposing resume and transcript resolution " , ( ) => {
201271 expect ( "hooks" in codexDefinition ) . toBe ( false ) ;
202- expect ( "buildResumeCommand" in codexDefinition ) . toBe ( false ) ;
203- expect ( "resolveTranscriptPath" in codexDefinition ) . toBe ( false ) ;
272+ expect ( codexDefinition . buildResumeCommand ) . toBeTypeOf ( "function" ) ;
273+ expect ( codexDefinition . resolveTranscriptPath ) . toBeTypeOf ( "function" ) ;
204274 expect ( "readTranscriptExcerpt" in codexDefinition ) . toBe ( false ) ;
205275 } ) ;
206276 } ) ;
277+
278+ describe ( "resolveTranscriptPath" , ( ) => {
279+ it ( "returns undefined when providerSessionId is absent" , ( ) => {
280+ expect ( codexDefinition . resolveTranscriptPath ?.( { id : "sess-1" } ) ) . toBeUndefined ( ) ;
281+ } ) ;
282+ } ) ;
207283} ) ;
0 commit comments