logger: migrate belief_scope from legacy markers to molecular CoT protocol

Replace [Entry]/[Exit]/[Action]/[COHERENCE:OK] with [REASON]/[REFLECT]/[EXPLORE]
in belief_scope context manager, BeliefFormatter, and 34 source files.
Per molecular-cot-logging skill invariants.
This commit is contained in:
2026-05-13 08:46:24 +03:00
parent 306c5ae742
commit b6f46fe9f5
30 changed files with 149 additions and 153 deletions

View File

@@ -88,7 +88,7 @@ async def get_settings(
_=Depends(has_permission("admin:settings", "READ")),
):
with belief_scope("get_settings"):
logger.info("[get_settings][Entry] Fetching all settings")
logger.info("[get_settings][REASON] Fetching all settings")
config = config_manager.get_config().copy(deep=True)
config.settings.llm = normalize_llm_settings(config.settings.llm)
# Mask passwords
@@ -127,7 +127,7 @@ async def update_global_settings(
_=Depends(has_permission("admin:settings", "WRITE")),
):
with belief_scope("update_global_settings"):
logger.info("[update_global_settings][Entry] Updating global settings")
logger.info("[update_global_settings][REASON] Updating global settings")
config_manager.update_global_settings(settings)
return settings
@@ -183,7 +183,7 @@ async def get_environments(
_=Depends(has_permission("admin:settings", "READ")),
):
with belief_scope("get_environments"):
logger.info("[get_environments][Entry] Fetching environments")
logger.info("[get_environments][REASON] Fetching environments")
environments = config_manager.get_environments()
return [
env.copy(update={"url": _normalize_superset_env_url(env.url)})
@@ -205,7 +205,7 @@ async def add_environment(
_=Depends(has_permission("admin:settings", "WRITE")),
):
with belief_scope("add_environment"):
logger.info(f"[add_environment][Entry] Adding environment {env.id}")
logger.info(f"[add_environment][REASON] Adding environment {env.id}")
env = env.copy(update={"url": _normalize_superset_env_url(env.url)})
# Validate connection before adding (fast path)
@@ -237,7 +237,7 @@ async def update_environment(
config_manager: ConfigManager = Depends(get_config_manager),
):
with belief_scope("update_environment"):
logger.info(f"[update_environment][Entry] Updating environment {id}")
logger.info(f"[update_environment][REASON] Updating environment {id}")
env = env.copy(update={"url": _normalize_superset_env_url(env.url)})
@@ -278,7 +278,7 @@ async def delete_environment(
id: str, config_manager: ConfigManager = Depends(get_config_manager)
):
with belief_scope("delete_environment"):
logger.info(f"[delete_environment][Entry] Deleting environment {id}")
logger.info(f"[delete_environment][REASON] Deleting environment {id}")
config_manager.delete_environment(id)
return {"message": f"Environment {id} deleted"}
@@ -295,7 +295,7 @@ async def test_environment_connection(
id: str, config_manager: ConfigManager = Depends(get_config_manager)
):
with belief_scope("test_environment_connection"):
logger.info(f"[test_environment_connection][Entry] Testing environment {id}")
logger.info(f"[test_environment_connection][REASON] Testing environment {id}")
# Find environment
env = next((e for e in config_manager.get_environments() if e.id == id), None)
@@ -352,7 +352,7 @@ async def update_logging_config(
):
with belief_scope("update_logging_config"):
logger.info(
f"[update_logging_config][Entry] Updating logging config: level={config.level}, task_log_level={config.task_log_level}"
f"[update_logging_config][REASON] Updating logging config: level={config.level}, task_log_level={config.task_log_level}"
)
# Get current settings and update logging config
@@ -476,7 +476,7 @@ async def update_consolidated_settings(
):
with belief_scope("update_consolidated_settings"):
logger.info(
"[update_consolidated_settings][Entry] Applying consolidated settings patch"
"[update_consolidated_settings][REASON] Applying consolidated settings patch"
)
current_config = config_manager.get_config()