ca2ca5b9e1
Three shims caught UnscopedSecretError and degraded to "" (mem0._scoped_env) or to os.environ (langfuse._secret, azure_identity_adapter._scoped_env). Under multiplex os.environ holds the DEFAULT profile's .env, so the langfuse/azure fallback could ship another profile's keys, and the mem0 fallback silently routed a mis-spawned turn's memories into the default profile's account. The exception exists to surface exactly that spawn-site bug (agent/AGENTS.md: never add environ fallthrough, never swallow it). All three now call agent.secret_scope.get_secret directly: with a scope installed a miss returns the default; single-profile deployments (multiplex off) still read the process env inside get_secret; a scope-less multiplex caller raises. Behavior change: a mis-spawned child under gateway.multiplex_profiles now fails loud with UnscopedSecretError instead of running silently unauthenticated / on the default profile's identity. The #99121 contract (OSS mode needs no MEM0_API_KEY in scope) is unchanged and its test now installs an empty profile scope, which is the situation the issue described; a genuinely scope-less caller is asserted to raise in a new test. Tests: tests/plugins/test_scoped_secret_readers_fail_closed.py (scope wins over environ; scope-less multiplex raises) for langfuse + azure, sabotage red when the langfuse fallthrough is restored; tests/plugins/memory/test_mem0_v3.py:: test_load_config_fails_closed_without_scope_even_for_identity_settings, sabotage red with a swallowing wrapper reinstated.