Private
Public Access
0
0

fix(app_controller): make _load_active_project fallback save defensive (FR1 guard)

This commit is contained in:
2026-06-19 12:03:17 -04:00
parent 4dd48f1e8a
commit 848b9e293f
+14 -4
View File
@@ -2213,10 +2213,20 @@ class AppController:
if not self.active_project_path:
name = self.project.get("project", {}).get("name", "project")
fallback_path = f"{name}.toml"
project_manager.save_project(self.project, fallback_path)
self.active_project_path = fallback_path
if fallback_path not in self.project_paths:
self.project_paths.append(fallback_path)
try:
project_manager.save_project(self.project, fallback_path)
self.active_project_path = 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.tool_preset_manager = tool_presets.ToolPresetManager(Path(self.active_project_path).parent if self.active_project_path else None)
from src.personas import PersonaManager