@@ -310,6 +310,7 @@ describe('Scheduled Sessions', () => {
310310
311311 it ( 'should edit the custom workflow on an existing scheduled session' , ( ) => {
312312 // Create a scheduled session with a custom workflow via API
313+ // Use fields that do NOT match any OOTB workflow so it stays as "Custom workflow..."
313314 cy . request ( {
314315 method : 'POST' ,
315316 url : `/api/projects/${ workspaceSlug } /scheduled-sessions` ,
@@ -323,9 +324,9 @@ describe('Scheduled Sessions', () => {
323324 llmSettings : { model : 'claude-sonnet-4-20250514' , temperature : 0.7 , maxTokens : 4000 } ,
324325 timeout : 300 ,
325326 activeWorkflow : {
326- gitUrl : 'https://github.com/ambient-code/ workflows.git' ,
327+ gitUrl : 'https://github.com/my-org/my-custom- workflows.git' ,
327328 branch : 'main' ,
328- path : 'workflows/bugfix ' ,
329+ path : 'workflows/custom-one ' ,
329330 } ,
330331 } ,
331332 } ,
@@ -336,22 +337,21 @@ describe('Scheduled Sessions', () => {
336337 // Navigate to edit page
337338 cy . visit ( `/projects/${ workspaceSlug } /scheduled-sessions/${ scheduleName } /edit` )
338339
339- // Wait for form to load — workflow fields should be pre-populated
340+ // Wait for form to load — should show "Custom workflow..." (no OOTB match)
340341 cy . get ( '[data-testid="workflow-select"]' , { timeout : 10000 } )
341342 . should ( 'contain.text' , 'Custom workflow...' )
342343
343344 // Verify pre-populated custom workflow fields
344345 cy . get ( '[data-testid="workflow-git-url"]' )
345- . should ( 'have.value' , 'https://github.com/ambient-code/ workflows.git' )
346+ . should ( 'have.value' , 'https://github.com/my-org/my-custom- workflows.git' )
346347 cy . get ( '[data-testid="workflow-branch"]' )
347348 . should ( 'have.value' , 'main' )
348349 cy . get ( '[data-testid="workflow-path"]' )
349- . should ( 'have.value' , 'workflows/bugfix ' )
350+ . should ( 'have.value' , 'workflows/custom-one ' )
350351
351352 // Update the workflow fields
352- cy . get ( '[data-testid="workflow-git-url"]' ) . clear ( ) . type ( 'https://github.com/ambient-code/workflows.git' )
353353 cy . get ( '[data-testid="workflow-branch"]' ) . clear ( ) . type ( 'develop' )
354- cy . get ( '[data-testid="workflow-path"]' ) . clear ( ) . type ( 'workflows/triage ' )
354+ cy . get ( '[data-testid="workflow-path"]' ) . clear ( ) . type ( 'workflows/custom-two ' )
355355
356356 // Submit
357357 cy . get ( '[data-testid="scheduled-session-submit"]' ) . click ( )
@@ -367,12 +367,64 @@ describe('Scheduled Sessions', () => {
367367 } ) . then ( ( getResp ) => {
368368 expect ( getResp . status ) . to . eq ( 200 )
369369 const workflow = getResp . body . sessionTemplate . activeWorkflow
370- expect ( workflow . gitUrl ) . to . eq ( 'https://github.com/ambient-code/ workflows.git' )
370+ expect ( workflow . gitUrl ) . to . eq ( 'https://github.com/my-org/my-custom- workflows.git' )
371371 expect ( workflow . branch ) . to . eq ( 'develop' )
372- expect ( workflow . path ) . to . eq ( 'workflows/triage ' )
372+ expect ( workflow . path ) . to . eq ( 'workflows/custom-two ' )
373373 } )
374374 } )
375375 } )
376+
377+ it ( 'should show OOTB workflow name when editing a session created with an OOTB workflow' , ( ) => {
378+ // Create a session with fields that match the "bugfix" OOTB workflow
379+ cy . request ( {
380+ method : 'POST' ,
381+ url : `/api/projects/${ workspaceSlug } /scheduled-sessions` ,
382+ headers : apiHeaders ( ) ,
383+ body : {
384+ displayName : 'OOTB Workflow Edit Test' ,
385+ schedule : '0 * * * *' ,
386+ sessionTemplate : {
387+ initialPrompt : 'run bugfix workflow' ,
388+ runnerType : 'claude-code' ,
389+ llmSettings : { model : 'claude-sonnet-4-20250514' , temperature : 0.7 , maxTokens : 4000 } ,
390+ timeout : 300 ,
391+ activeWorkflow : {
392+ gitUrl : 'https://github.com/ambient-code/workflows.git' ,
393+ branch : 'main' ,
394+ path : 'workflows/bugfix' ,
395+ } ,
396+ } ,
397+ } ,
398+ } ) . then ( ( resp ) => {
399+ expect ( resp . status ) . to . be . oneOf ( [ 200 , 201 ] )
400+ const scheduleName = resp . body . name
401+
402+ // Navigate to edit page
403+ cy . visit ( `/projects/${ workspaceSlug } /scheduled-sessions/${ scheduleName } /edit` )
404+
405+ // The workflow select should show the OOTB workflow name, not "Custom workflow..."
406+ cy . get ( '[data-testid="workflow-select"]' , { timeout : 10000 } )
407+ . should ( 'contain.text' , 'Fix a bug' )
408+
409+ // Custom workflow fields should NOT be visible (OOTB selected, not custom)
410+ cy . get ( '[data-testid="workflow-git-url"]' ) . should ( 'not.exist' )
411+ } )
412+ } )
413+
414+ it ( 'should show General chat when editing a session with no workflow' , ( ) => {
415+ // Create a session without any workflow
416+ createScheduledSessionViaApi ( '0 * * * *' , 'No Workflow Edit Test' ) . then ( ( scheduleName ) => {
417+ // Navigate to edit page
418+ cy . visit ( `/projects/${ workspaceSlug } /scheduled-sessions/${ scheduleName } /edit` )
419+
420+ // The workflow select should show "General chat"
421+ cy . get ( '[data-testid="workflow-select"]' , { timeout : 10000 } )
422+ . should ( 'contain.text' , 'General chat' )
423+
424+ // Custom workflow fields should NOT be visible
425+ cy . get ( '[data-testid="workflow-git-url"]' ) . should ( 'not.exist' )
426+ } )
427+ } )
376428 } )
377429
378430 // ─── Schedule Deletion ────────────────────────────────────────
0 commit comments