@@ -215,6 +215,8 @@ export class RunExecution {
215215 this . snapshotPoller ?. updateSnapshotId ( snapshot . friendlyId ) ;
216216 this . snapshotPoller ?. resetCurrentInterval ( ) ;
217217
218+ await this . processEnvOverrides ( "snapshot change" ) ;
219+
218220 switch ( snapshot . executionStatus ) {
219221 case "PENDING_CANCEL" : {
220222 this . sendDebugLog ( "run was cancelled" , snapshotMetadata ) ;
@@ -780,7 +782,7 @@ export class RunExecution {
780782 await sleep ( 100 ) ;
781783
782784 // Process any env overrides
783- await this . processEnvOverrides ( ) ;
785+ await this . processEnvOverrides ( "restore" ) ;
784786
785787 const continuationResult = await this . httpClient . continueRunExecution (
786788 this . runFriendlyId ,
@@ -798,21 +800,31 @@ export class RunExecution {
798800 /**
799801 * Processes env overrides from the metadata service. Generally called when we're resuming from a suspended state.
800802 */
801- private async processEnvOverrides ( ) {
803+ async processEnvOverrides ( reason ?: string ) {
802804 if ( ! this . env . TRIGGER_METADATA_URL ) {
803- this . sendDebugLog ( "no metadata url, skipping env overrides" ) ;
805+ this . sendDebugLog ( "no metadata url, skipping env overrides" , { reason } ) ;
804806 return ;
805807 }
806808
807809 const metadataClient = new MetadataClient ( this . env . TRIGGER_METADATA_URL ) ;
808810 const overrides = await metadataClient . getEnvOverrides ( ) ;
809811
810812 if ( ! overrides ) {
811- this . sendDebugLog ( "no env overrides, skipping" ) ;
813+ this . sendDebugLog ( "no env overrides, skipping" , { reason } ) ;
812814 return ;
813815 }
814816
815- this . sendDebugLog ( "processing env overrides" , overrides ) ;
817+ this . sendDebugLog ( `processing env overrides: ${ reason } ` , {
818+ overrides,
819+ currentEnv : this . env . raw ,
820+ } ) ;
821+
822+ if ( this . env . TRIGGER_RUNNER_ID !== overrides . TRIGGER_RUNNER_ID ) {
823+ this . sendDebugLog ( "runner ID changed -> run was restored from a checkpoint" , {
824+ currentRunnerId : this . env . TRIGGER_RUNNER_ID ,
825+ newRunnerId : overrides . TRIGGER_RUNNER_ID ,
826+ } ) ;
827+ }
816828
817829 // Override the env with the new values
818830 this . env . override ( overrides ) ;
0 commit comments