66from fastapi import HTTPException
77
88from plugin .core .state import state
9+ from plugin .logging_config import get_logger
910from plugin .settings import PLUGIN_CONFIG_ROOTS
1011
12+ logger = get_logger ("server.infrastructure.config_paths" )
13+
1114
1215def _resolve_registered_plugin_config_path (plugin_id : str ) -> Path | None :
1316 candidates : list [object ] = []
@@ -29,10 +32,30 @@ def _resolve_registered_plugin_config_path(plugin_id: str) -> Path | None:
2932 continue
3033 try :
3134 path = Path (candidate ).resolve ()
32- except (TypeError , ValueError , OSError , RuntimeError ):
35+ except (TypeError , ValueError , OSError , RuntimeError ) as exc :
36+ logger .warning (
37+ "Plugin config registered path ignored: plugin_id={}, candidate_type={}, err_type={}, err={}" ,
38+ plugin_id ,
39+ type (candidate ).__name__ ,
40+ type (exc ).__name__ ,
41+ str (exc ),
42+ )
3343 continue
3444 if path .is_file () and path .name == "plugin.toml" :
45+ logger .debug (
46+ "Plugin config path resolved from registered metadata: plugin_id={}, config_path={}" ,
47+ plugin_id ,
48+ path ,
49+ )
3550 return path
51+ logger .warning (
52+ "Plugin config registered path ignored: plugin_id={}, config_path={}, exists={}, is_file={}, name={}" ,
53+ plugin_id ,
54+ path ,
55+ path .exists (),
56+ path .is_file (),
57+ path .name ,
58+ )
3659
3760 return None
3861
@@ -72,6 +95,12 @@ def get_plugin_config_path(plugin_id: str) -> Path:
7295 continue
7396
7497 if config_file .exists ():
98+ logger .debug (
99+ "Plugin config path resolved from config root: plugin_id={}, root={}, config_path={}" ,
100+ plugin_id ,
101+ root ,
102+ config_file ,
103+ )
75104 return config_file
76105
77106 raise HTTPException (
0 commit comments