1515)
1616from task_engine import TaskManager
1717from capability_tokens import issue_capability_token
18+ from workspace_context import resolve_launch_context
1819
1920
2021class InteractionTests (unittest .TestCase ):
@@ -36,6 +37,34 @@ def test_auto_routing_and_mode_capabilities_are_narrowing_only(self):
3637 self .assertEqual (mode_capabilities (base , "plan" ), frozenset ({"read" , "network" }))
3738 self .assertEqual (mode_capabilities (frozenset ({"read" }), "agent" ), frozenset ({"read" }))
3839
40+ def test_project_interaction_state_is_isolated_from_other_projects (self ):
41+ with tempfile .TemporaryDirectory () as home , tempfile .TemporaryDirectory () as first , \
42+ tempfile .TemporaryDirectory () as second :
43+ first_context = resolve_launch_context (home = home , project_path = first )
44+ second_context = resolve_launch_context (home = home , project_path = second )
45+ first_scope = main .interaction_workspace_id (first_context )
46+ second_scope = main .interaction_workspace_id (second_context )
47+ self .assertNotEqual (first_scope , second_scope )
48+
49+ first_controller = InteractionController (
50+ self .store , workspace_id = first_scope , session_id = "surface:tui" ,
51+ )
52+ first_controller .propose_plan ({
53+ "title" : "First" , "summary" : "Only the first project." , "assumptions" : [],
54+ "steps" : [{"id" : "one" , "title" : "One" , "description" : "Change first." ,
55+ "acceptance" : ["First changed" ]}],
56+ })
57+ second_controller = InteractionController (
58+ self .store , workspace_id = second_scope , session_id = "surface:tui" ,
59+ )
60+ self .assertIsNotNone (first_controller .state ()["pending_plan" ])
61+ self .assertIsNone (second_controller .state ()["pending_plan" ])
62+
63+ global_context = resolve_launch_context (home = home , global_mode = True )
64+ self .assertEqual (
65+ main .interaction_workspace_id (global_context ), main .memory_bank .workspace_id ,
66+ )
67+
3968 def test_question_bounds_and_event_reconstruction (self ):
4069 question = self .controller .request_question ({"questions" : [{
4170 "id" : "scope" , "header" : "Scope" , "prompt" : "Which package?" ,
0 commit comments