@@ -131,13 +131,41 @@ pub async fn upgrade_now(current_version: &str, release_feed_url: &str) -> Resul
131131 current : current_version. to_string ( ) ,
132132 } ) ;
133133 }
134+ // Save the executable path before replacing its on-disk inode. After the
135+ // swap, launch the new binary's full benchmark under this node's identity
136+ // so its refreshed report is what the worker advertises on restart.
137+ let new_exe = std:: env:: current_exe ( ) . ok ( ) ;
134138 perform_upgrade ( & manifest) . await ?;
139+ if let Some ( exe) = new_exe {
140+ if let Err ( error) = run_post_update_benchmark ( exe) . await {
141+ warn ! ( err = %error, "post-update benchmark failed; continuing with the updated binary" ) ;
142+ }
143+ } else {
144+ warn ! ( "could not locate updated executable to run the post-update benchmark" ) ;
145+ }
135146 Ok ( UpgradeOutcome :: Upgraded {
136147 from : current_version. to_string ( ) ,
137148 to : manifest. version ,
138149 } )
139150}
140151
152+ async fn run_post_update_benchmark ( exe : std:: path:: PathBuf ) -> Result < ( ) > {
153+ let status = tokio:: task:: spawn_blocking ( move || {
154+ std:: process:: Command :: new ( exe)
155+ . arg ( "benchmark" )
156+ // The child already is the newly installed version; avoid another
157+ // release-feed request before it starts measuring this machine.
158+ . env ( "C0MPUTE_NO_AUTO_UPDATE" , "1" )
159+ . status ( )
160+ } )
161+ . await
162+ . context ( "join post-update benchmark" ) ??;
163+ if !status. success ( ) {
164+ anyhow:: bail!( "`c0mpute benchmark` exited with {status}" ) ;
165+ }
166+ Ok ( ( ) )
167+ }
168+
141169/// Map the compile-time target to the release artifact's os/arch tokens
142170/// (matching `.github/workflows/release.yml` naming).
143171fn target_os_arch ( ) -> Result < ( & ' static str , & ' static str ) > {
0 commit comments