Skip to content

Commit affe17b

Browse files
Cover computer_use in the autonomy drift guard
The lowered check ignores three fields, not two. computer_use is the likeliest of them to drift: the lowering carries it into AiAutonomySettings, so it reads as an omission from the check rather than a field the check has no view of. Adding it to autonomy_allowed_by_policy previously left every test passing. Also drops caller descriptions from the two new doc comments, per AGENTS.md.
1 parent 39ea3ad commit affe17b

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

app/src/workspaces/user_workspaces.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,8 +1065,9 @@ impl UserWorkspaces {
10651065
/// The tier policy is billing entitlement, which belongs to the paying workspace rather
10661066
/// than to any team, so it is read from the workspace either way.
10671067
///
1068-
/// Callers are on render and per-action paths, so this asks each team's settings the
1069-
/// question directly rather than lowering them into [`AiAutonomySettings`] first.
1068+
/// Asks each team's settings the question directly rather than lowering them into
1069+
/// [`AiAutonomySettings`] first, which would compile every list entry into a regex to
1070+
/// answer something that needs none.
10701071
pub fn all_teams_allow_ai_autonomy(&self) -> bool {
10711072
let tier_allows_autonomy = self.current_workspace().is_none_or(|workspace| {
10721073
workspace

app/src/workspaces/user_workspaces_tests.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ use warpui::{AddSingletonModel, App, Element, TypedActionView, View, ViewHandle,
4848
use warpui_extras::user_preferences;
4949

5050
use super::*;
51-
use crate::ai::execution_profiles::{ActionPermission, WriteToPtyPermission};
51+
use crate::ai::execution_profiles::{
52+
ActionPermission, ComputerUsePermission, WriteToPtyPermission,
53+
};
5254
use crate::ai::llms::LLMModelHost;
5355
use crate::auth::AuthManager;
5456
use crate::cloud_object::model::persistence::CloudModel;
@@ -1556,8 +1558,10 @@ fn test_team_autonomy_configuration_agrees_with_the_lowered_policy() {
15561558
..Default::default()
15571559
},
15581560
),
1559-
// Neither of the next two counts as evidence of autonomy in the lowered check, so
1560-
// both implementations must ignore them.
1561+
// None of the next three counts as evidence of autonomy in the lowered check, so
1562+
// both implementations must ignore them. `write_to_pty` and `computer_use` are the
1563+
// likeliest to drift: the lowering does carry them into `AiAutonomySettings`, so
1564+
// they read as omissions from the check rather than as fields it has no view of.
15611565
(
15621566
"write_to_pty only",
15631567
TeamAiAutonomySettings {
@@ -1568,6 +1572,16 @@ fn test_team_autonomy_configuration_agrees_with_the_lowered_policy() {
15681572
..Default::default()
15691573
},
15701574
),
1575+
(
1576+
"computer_use only",
1577+
TeamAiAutonomySettings {
1578+
computer_use: EnforceableSetting {
1579+
value: Some(ComputerUsePermission::AlwaysAsk),
1580+
is_enforced_by_workspace: false,
1581+
},
1582+
..Default::default()
1583+
},
1584+
),
15711585
(
15721586
"create_plans only",
15731587
TeamAiAutonomySettings {

app/src/workspaces/workspace.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,8 @@ impl TeamAiAutonomySettings {
11221122
/// Whether an admin configured any of the policies that count as evidence autonomy is
11231123
/// in use — the same fields the lowered [`AiAutonomySettings`] is inspected for.
11241124
///
1125-
/// Answers without lowering on purpose. Lowering compiles every allow- and denylist
1126-
/// entry into a regex, and the callers asking this question are on render and
1127-
/// per-action paths that would pay for that on every frame and then discard it.
1125+
/// Answers without lowering on purpose: lowering compiles every allow- and denylist
1126+
/// entry into a regex, and this question does not need one.
11281127
pub fn configures_any_policy(&self) -> bool {
11291128
self.apply_code_diffs.value.is_some()
11301129
|| self.read_files.value.is_some()

0 commit comments

Comments
 (0)