86 """Return the active risk profile, selected out-of-band only (F33).
88 Reads ``OC_CHAT_PROFILE`` from the process environment (case-insensitive,
89 whitespace-tolerant). Never consults a settings file, prompt, resume payload,
90 or model output. An unset value uses :data:`DEFAULT_PROFILE`; an explicitly
91 set but unrecognized value is logged and also falls to the default.
93 func =
"resolve_risk_profile"
94 raw = os.environ.get(PROFILE_ENV_VAR,
"").strip().lower()
95 if raw
in VALID_PROFILES:
96 profile: RiskProfile = raw
99 _dbg(
"OC_CHAT.CORE", func,
100 f
"unrecognized {PROFILE_ENV_VAR}={raw!r}; falling to {DEFAULT_PROFILE!r}", 2)
101 profile = DEFAULT_PROFILE
102 _dbg(
"OC_CHAT.CORE", func, f
"active risk profile: {profile}", 2)