feat(app_controller): reset project state in _handle_reset_session
Stale project state from prior live_gui tests (shared session-scoped subprocess) was leaking into subsequent tests, causing the test_full_live_workflow race condition: 'Project not switched' errors when self.project still claimed to be a different project. The fix: _handle_reset_session now mirrors the default-project branch of __init__ (lines 1743-1745), creating a fresh default project dict, clearing active_project_path and project_paths, and reinitializing the workspace manager. - src/app_controller.py: 6 new lines in _handle_reset_session - tests/test_handle_reset_session_clears_project.py: 3 tests (active_project_path, project_paths, self.project)
This commit is contained in:
@@ -3266,6 +3266,15 @@ class AppController:
|
||||
discussions = disc_sec.get("discussions", {})
|
||||
for d_name in discussions:
|
||||
discussions[d_name]["history"] = []
|
||||
# Reset project state so stale data from prior live_gui tests does not
|
||||
# leak into the next session. Mirrors the default-project branch in
|
||||
# __init__ (see lines 1743-1745).
|
||||
reset_name = Path(self.active_project_path).stem if self.active_project_path else "unnamed"
|
||||
self.project = project_manager.default_project(reset_name)
|
||||
self.active_project_path = ""
|
||||
self.project_paths = []
|
||||
self.workspace_manager = workspace_manager.WorkspaceManager(project_root=None)
|
||||
self.workspace_profiles = self.workspace_manager.load_all_profiles()
|
||||
self.ai_status = "session reset"
|
||||
self.ai_response = ""
|
||||
self.ui_ai_input = ""
|
||||
|
||||
Reference in New Issue
Block a user