Using local variables, that include global Variables?

How are you setting that variable? In the agent environment configuation screen?

How are you confirming that variable isn’t set?

Have you looked at the Jenkins tool system that can extract to an agent as needed?