@@ -2208,7 +2208,7 @@ async fn inactive_thread_approval_bubbles_into_active_view() -> Result<()> {
22082208 ThreadSessionState {
22092209 approval_policy : AskForApproval :: OnRequest ,
22102210 sandbox_policy : SandboxPolicy :: new_workspace_write_policy ( ) ,
2211- permission_profile : Some ( PermissionProfile :: workspace_write ( ) ) ,
2211+ permission_profile : PermissionProfile :: workspace_write ( ) ,
22122212 rollout_path : Some ( test_path_buf ( "/tmp/agent-rollout.jsonl" ) ) ,
22132213 ..test_thread_session ( agent_thread_id, test_path_buf ( "/tmp/agent" ) )
22142214 } ,
@@ -2368,7 +2368,7 @@ async fn side_defers_subagent_approval_overlay_until_side_exits() -> Result<()>
23682368 ThreadSessionState {
23692369 approval_policy : AskForApproval :: OnRequest ,
23702370 sandbox_policy : SandboxPolicy :: new_workspace_write_policy ( ) ,
2371- permission_profile : Some ( PermissionProfile :: workspace_write ( ) ) ,
2371+ permission_profile : PermissionProfile :: workspace_write ( ) ,
23722372 rollout_path : Some ( test_path_buf ( "/tmp/agent-rollout.jsonl" ) ) ,
23732373 ..test_thread_session ( agent_thread_id, test_path_buf ( "/tmp/agent" ) )
23742374 } ,
@@ -2591,7 +2591,7 @@ async fn inactive_thread_approval_badge_clears_after_turn_completion_notificatio
25912591 ThreadSessionState {
25922592 approval_policy : AskForApproval :: OnRequest ,
25932593 sandbox_policy : SandboxPolicy :: new_workspace_write_policy ( ) ,
2594- permission_profile : Some ( PermissionProfile :: workspace_write ( ) ) ,
2594+ permission_profile : PermissionProfile :: workspace_write ( ) ,
25952595 rollout_path : Some ( test_path_buf ( "/tmp/agent-rollout.jsonl" ) ) ,
25962596 ..test_thread_session ( agent_thread_id, test_path_buf ( "/tmp/agent" ) )
25972597 } ,
@@ -2645,7 +2645,7 @@ async fn inactive_thread_started_notification_initializes_replay_session() -> Re
26452645 let primary_session = ThreadSessionState {
26462646 approval_policy : AskForApproval :: OnRequest ,
26472647 sandbox_policy : SandboxPolicy :: new_workspace_write_policy ( ) ,
2648- permission_profile : Some ( PermissionProfile :: workspace_write ( ) ) ,
2648+ permission_profile : PermissionProfile :: workspace_write ( ) ,
26492649 ..test_thread_session ( main_thread_id, test_path_buf ( "/tmp/main" ) )
26502650 } ;
26512651
@@ -2758,7 +2758,7 @@ async fn inactive_thread_started_notification_preserves_primary_model_when_path_
27582758 let primary_session = ThreadSessionState {
27592759 approval_policy : AskForApproval :: OnRequest ,
27602760 sandbox_policy : SandboxPolicy :: new_workspace_write_policy ( ) ,
2761- permission_profile : Some ( PermissionProfile :: workspace_write ( ) ) ,
2761+ permission_profile : PermissionProfile :: workspace_write ( ) ,
27622762 ..test_thread_session ( main_thread_id, test_path_buf ( "/tmp/main" ) )
27632763 } ;
27642764
@@ -2827,7 +2827,7 @@ async fn thread_read_session_state_does_not_reuse_primary_permission_profile() {
28272827 let primary_session = ThreadSessionState {
28282828 approval_policy : AskForApproval :: OnRequest ,
28292829 sandbox_policy : SandboxPolicy :: new_workspace_write_policy ( ) ,
2830- permission_profile : Some ( PermissionProfile :: workspace_write ( ) ) ,
2830+ permission_profile : PermissionProfile :: workspace_write ( ) ,
28312831 ..test_thread_session ( main_thread_id, test_path_buf ( "/tmp/main" ) )
28322832 } ;
28332833 app. primary_session_configured = Some ( primary_session) ;
@@ -2858,10 +2858,17 @@ async fn thread_read_session_state_does_not_reuse_primary_permission_profile() {
28582858
28592859 assert_eq ! ( session. thread_id, read_thread_id) ;
28602860 assert_eq ! ( session. cwd. as_path( ) , test_path_buf( "/tmp/read" ) . as_path( ) ) ;
2861+ let expected_permission_profile = PermissionProfile :: from_legacy_sandbox_policy_for_cwd (
2862+ & app. config
2863+ . permissions
2864+ . legacy_sandbox_policy ( thread. cwd . as_path ( ) ) ,
2865+ thread. cwd . as_path ( ) ,
2866+ ) ;
28612867 assert_eq ! (
2862- session. permission_profile, None ,
2863- "thread/read does not return an authoritative permission profile; reusing the primary \
2864- session profile would reinterpret cwd-bound entries against the read thread cwd"
2868+ session. permission_profile, expected_permission_profile,
2869+ "thread/read does not return authoritative server permissions; the fallback profile must \
2870+ be rebuilt from local legacy settings against the read thread cwd rather than reusing \
2871+ the primary session profile"
28652872 ) ;
28662873}
28672874
@@ -3727,7 +3734,7 @@ fn test_thread_session(thread_id: ThreadId, cwd: PathBuf) -> ThreadSessionState
37273734 approval_policy : AskForApproval :: Never ,
37283735 approvals_reviewer : ApprovalsReviewer :: User ,
37293736 sandbox_policy : SandboxPolicy :: new_read_only_policy ( ) ,
3730- permission_profile : Some ( PermissionProfile :: read_only ( ) ) ,
3737+ permission_profile : PermissionProfile :: read_only ( ) ,
37313738 cwd : cwd. abs ( ) ,
37323739 instruction_source_paths : Vec :: new ( ) ,
37333740 reasoning_effort : None ,
0 commit comments