The rule is that closures passed to the primary Task initializer[1] from an isolated context inherit that isolation. Currently there is an exception that this does not happen when the outer context is actor-isolated and the closure doesn't capture that actor, but we've discussed removing that exception because it's quite confusing in practice.
in general: when a closure expression is used directly as the argument for an
@_inheritsActorContextparameter; but that is not an official feature, and proposal documents always talk aboutTask.init↩︎