@@ -12,7 +12,7 @@ import { getUniqueAgentId } from '../context/index.js';
1212import { executeStep } from './execute.js' ;
1313import { selectEngine } from './engine.js' ;
1414import { registry } from '../../infra/engines/index.js' ;
15- import { getSelectedConditions } from '../../shared/workflows/template.js' ;
15+ import { getSelectedConditions , getSelectedTrack } from '../../shared/workflows/template.js' ;
1616import { loadAgentConfig } from '../../agents/runner/index.js' ;
1717import { loadChainedPrompts } from '../../agents/runner/chained.js' ;
1818import { beforeRun , afterRun , cleanupRun } from './hooks.js' ;
@@ -115,14 +115,18 @@ export async function runStepFresh(ctx: RunnerContext): Promise<RunStepResult |
115115 ctx . emitter . updateAgentModel ( uniqueAgentId , resolvedModel ) ;
116116 }
117117
118+ // Fetch conditions and track for chained prompt filtering
119+ const selectedConditions = await getSelectedConditions ( ctx . cmRoot ) ;
120+ const selectedTrack = await getSelectedTrack ( ctx . cmRoot ) ;
121+
118122 // Pre-load chained prompts from agent config so UI can show step info immediately
119123 const agentConfig = await loadAgentConfig ( step . agentId , ctx . cwd ) ;
120124 if ( agentConfig ?. chainedPromptsPath ) {
121- const selectedConditions = await getSelectedConditions ( ctx . cmRoot ) ;
122125 const preloadedPrompts = await loadChainedPrompts (
123126 agentConfig . chainedPromptsPath ,
124127 ctx . cwd ,
125- selectedConditions
128+ selectedConditions ,
129+ selectedTrack
126130 ) ;
127131 if ( preloadedPrompts . length > 0 ) {
128132 debug ( '[step/run] Pre-loaded %d chained prompts for UI' , preloadedPrompts . length ) ;
@@ -150,6 +154,8 @@ export async function runStepFresh(ctx: RunnerContext): Promise<RunStepResult |
150154 emitter : ctx . emitter ,
151155 abortSignal : abortController . signal ,
152156 uniqueAgentId,
157+ selectedConditions,
158+ selectedTrack : selectedTrack ?? undefined ,
153159 } ) ;
154160
155161 debug ( '[step/run] Step completed' ) ;
@@ -289,6 +295,10 @@ export async function runStepResume(
289295 ctx . machine . send ( { type : 'RESUME' } ) ;
290296 ctx . emitter . setWorkflowStatus ( 'running' ) ;
291297
298+ // Fetch conditions and track for chained prompt filtering
299+ const selectedConditions = await getSelectedConditions ( ctx . cmRoot ) ;
300+ const selectedTrack = await getSelectedTrack ( ctx . cmRoot ) ;
301+
292302 try {
293303 const output = await executeStep ( step , ctx . cwd , {
294304 logger : ( ) => { } ,
@@ -299,6 +309,8 @@ export async function runStepResume(
299309 resumeMonitoringId : options . resumeMonitoringId ,
300310 resumeSessionId : sessionId ,
301311 resumePrompt : options . resumePrompt ,
312+ selectedConditions,
313+ selectedTrack : selectedTrack ?? undefined ,
302314 } ) ;
303315
304316 // Update context with new output
0 commit comments