Private
Public Access
fix(app_controller): make _load_active_project fallback save defensive (FR1 guard)
This commit is contained in:
+14
-4
@@ -2213,10 +2213,20 @@ class AppController:
|
|||||||
if not self.active_project_path:
|
if not self.active_project_path:
|
||||||
name = self.project.get("project", {}).get("name", "project")
|
name = self.project.get("project", {}).get("name", "project")
|
||||||
fallback_path = f"{name}.toml"
|
fallback_path = f"{name}.toml"
|
||||||
project_manager.save_project(self.project, fallback_path)
|
try:
|
||||||
self.active_project_path = fallback_path
|
project_manager.save_project(self.project, fallback_path)
|
||||||
if fallback_path not in self.project_paths:
|
self.active_project_path = fallback_path
|
||||||
self.project_paths.append(fallback_path)
|
if fallback_path not in self.project_paths:
|
||||||
|
self.project_paths.append(fallback_path)
|
||||||
|
except (OSError, IOError, PermissionError) as e:
|
||||||
|
logging.getLogger(__name__).debug(
|
||||||
|
"Could not save fallback project to %s: %s", fallback_path, e,
|
||||||
|
extra={"source": "app_controller._load_active_project.fallback_save"},
|
||||||
|
)
|
||||||
|
# The save is best-effort; the app can still operate without persisting
|
||||||
|
# the empty fallback (e.g., when the test sandbox FR1 guard blocks
|
||||||
|
# writes to the project root). active_project_path stays empty;
|
||||||
|
# the next save will use a proper path.
|
||||||
self.preset_manager = presets.PresetManager(Path(self.active_project_path).parent if self.active_project_path else None)
|
self.preset_manager = presets.PresetManager(Path(self.active_project_path).parent if self.active_project_path else None)
|
||||||
self.tool_preset_manager = tool_presets.ToolPresetManager(Path(self.active_project_path).parent if self.active_project_path else None)
|
self.tool_preset_manager = tool_presets.ToolPresetManager(Path(self.active_project_path).parent if self.active_project_path else None)
|
||||||
from src.personas import PersonaManager
|
from src.personas import PersonaManager
|
||||||
|
|||||||
Reference in New Issue
Block a user