I believe the answer to your questions comes from sections SCR.220.127.116.11.2 and SCR.4.3.1 of the JSR-223 spec. From the former, I quote:
In the eval methods taking a single argument, the default ScriptContext of the ScriptEngine is used during execution of the script.
There are one engine and one global bindings associated with each ScriptContext.
From the latter section I quote:
The method getAttribute(String) returns getAttribute(String, int) for the lowest scope in which it returns a non-null value.