Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(settings): remove obsolete require_task_plan_approval tests

Steven Enamakel5532d9b3eef3
diff --git a/app/src/components/settings/panels/__tests__/AgentAccessPanel.defaults.test.tsx b/app/src/components/settings/panels/__tests__/AgentAccessPanel.defaults.test.tsx
index 1e64290a42..e4d60b5811 100644
--- a/app/src/components/settings/panels/__tests__/AgentAccessPanel.defaults.test.tsx
+++ b/app/src/components/settings/panels/__tests__/AgentAccessPanel.defaults.test.tsx
@@ -16,23 +16,21 @@ import AgentAccessPanel from '../AgentAccessPanel';
/**
* The fail-safe half of `AgentAccessPanel`.
*
- * On load the panel reads four security fields through nullish coalescing
- * (panel :94-97):
+ * On load the panel reads three security fields through nullish coalescing:
*
- * require_task_plan_approval ?? true
* auto_approve_all ?? false
* trusted_roots ?? []
* auto_approve ?? []
*
* Each default is chosen to fail CLOSED — an older core, or one that drops a
- * field, must land on "approval required" and "nothing auto-approved" rather
- * than the permissive value. The existing suite always supplies every field, so
- * none of those four arms is exercised; the panel measured 66.2% branches.
+ * field, must land on "nothing auto-approved" rather than the permissive
+ * value. The existing suite always supplies every field, so none of those
+ * arms is exercised otherwise.
*
- * If `require_task_plan_approval ?? true` were ever written `?? false`, a core
- * that omitted the field would silently stop requiring plan approval and the
- * toggle would show OFF as though the user had chosen it. That is the failure
- * these tests exist to catch.
+ * If `auto_approve_all ?? false` were ever written `?? true`, a core that
+ * omitted the field would silently approve every tool call and the toggle
+ * would show ON as though the user had chosen it. That is the failure these
+ * tests exist to catch.
*
* Also covers `addRoot`'s guards (blank, duplicate) and its Enter-key path,
* which the existing suite reaches only through the Add button.
@@ -100,7 +98,6 @@ const mockUpdate = vi.mocked(openhumanUpdateAutonomySettings);
const mockGetAgent = vi.mocked(openhumanGetAgentSettings);
const mockUpdateAgent = vi.mocked(openhumanUpdateAgentSettings);
-const taskPlanToggle = () => screen.getByRole('switch', { name: /plan|approval/i });
beforeEach(() => {
vi.clearAllMocks();
@@ -112,25 +109,6 @@ beforeEach(() => {
});
describe('AgentAccessPanel — fail-closed defaults for omitted security fields', () => {
- it('requires task-plan approval when the core omits the field', async () => {
- mockGet.mockResolvedValue({ result: autonomyMissingOptionals(), logs: [] });
- renderWithProviders(<AgentAccessPanel />);
-
- await waitFor(() => expect(mockGet).toHaveBeenCalled());
- // `?? true`: absent must read as ON, never as the permissive OFF.
- await waitFor(() => expect(taskPlanToggle()).toHaveAttribute('aria-checked', 'true'));
- });
-
- it('still honours an explicit false for task-plan approval', async () => {
- // The default must not mask a real value the user chose.
- mockGet.mockResolvedValue({
- result: autonomy({ require_task_plan_approval: false } as never),
- logs: [],
- });
- renderWithProviders(<AgentAccessPanel />);
- await waitFor(() => expect(taskPlanToggle()).toHaveAttribute('aria-checked', 'false'));
- });
-
it('leaves auto-approve-all OFF when the core omits the field', async () => {
mockGet.mockResolvedValue({ result: autonomyMissingOptionals(), logs: [] });
renderWithProviders(<AgentAccessPanel />);
diff --git a/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx b/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx
index e050f27973..f7d47876cb 100644
--- a/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx
+++ b/app/src/components/settings/panels/__tests__/AgentAccessPanel.test.tsx
@@ -16,7 +16,7 @@ import AgentAccessPanel from '../AgentAccessPanel';
// ──────────────────────────────────────────────────────────────────────────────
// Note: Tier-selection and action-dir editing tests live in
// PermissionsPanel.test.tsx (those controls moved to the layman panel).
-// This file covers the ADVANCED surface: workspace confinement, task-plan
+// This file covers the ADVANCED surface: workspace confinement,
// approval, action timeout, granted folders, always-allowed tools, and the
// approval-history link.
// ──────────────────────────────────────────────────────────────────────────────
@@ -104,17 +104,6 @@ describe('AgentAccessPanel (advanced)', () => {
);
});
- it('toggling task plan approval persists require_task_plan_approval', async () => {
- renderWithProviders(<AgentAccessPanel />);
- await screen.findByText('Confine to workspace');
- fireEvent.click(screen.getByRole('switch', { name: /require task plan approval/i }));
- await waitFor(() =>
- expect(mockUpdate).toHaveBeenCalledWith(
- expect.objectContaining({ require_task_plan_approval: false })
- )
- );
- });
-
it('adding then removing a granted folder persists the updated list', async () => {
renderWithProviders(<AgentAccessPanel />);
await screen.findByText('Granted folders');
diff --git a/app/src/components/settings/panels/__tests__/PermissionsPanel.races.test.tsx b/app/src/components/settings/panels/__tests__/PermissionsPanel.races.test.tsx
index 29a6a81a3b..3449d7319f 100644
--- a/app/src/components/settings/panels/__tests__/PermissionsPanel.races.test.tsx
+++ b/app/src/components/settings/panels/__tests__/PermissionsPanel.races.test.tsx
@@ -108,14 +108,13 @@ describe('PermissionsPanel — load-shape defaults', () => {
mockGetPaths.mockResolvedValue({ result: agentPaths(), logs: [] });
});
- // `require_task_plan_approval ?? true` and `trusted_roots ?? []`
- // (`PermissionsPanel.tsx:90-91`) exist because an older core omits both
- // fields. The defaults matter: they are carried straight back into the next
- // save, so getting them wrong silently rewrites the user's settings.
+ // `trusted_roots ?? []` (`PermissionsPanel.tsx`) exists because an older
+ // core omits the field. The default matters: it is carried straight back
+ // into the next save, so getting it wrong silently rewrites the user's
+ // settings.
it('defaults the fields an older core omits, and carries them into a save', async () => {
const partial = autonomy();
delete (partial as Partial<AutonomySettings>).trusted_roots;
- delete (partial as { require_task_plan_approval?: boolean }).require_task_plan_approval;
mockGet.mockResolvedValue({ result: partial as AutonomySettings, logs: [] });
mockUpdate.mockResolvedValue({ result: {} as never, logs: [] });
@@ -126,26 +125,9 @@ describe('PermissionsPanel — load-shape defaults', () => {
await waitFor(() => expect(mockUpdate).toHaveBeenCalled());
const sent = mockUpdate.mock.calls[0][0];
- expect(sent.require_task_plan_approval).toBe(true);
expect(sent.trusted_roots).toEqual([]);
});
- it('preserves a false require_task_plan_approval rather than defaulting it on', async () => {
- mockGet.mockResolvedValue({
- result: autonomy({ require_task_plan_approval: false } as Partial<AutonomySettings>),
- logs: [],
- });
- mockUpdate.mockResolvedValue({ result: {} as never, logs: [] });
-
- renderWithProviders(<PermissionsPanel />);
- await screen.findByText(/Full control/i);
-
- fireEvent.click(preset(/Full control/i));
-
- await waitFor(() => expect(mockUpdate).toHaveBeenCalled());
- expect(mockUpdate.mock.calls[0][0].require_task_plan_approval).toBe(false);
- });
-
it('reports an autonomy load failure but still renders the folder section', async () => {
mockGet.mockRejectedValue(new Error('autonomy rpc down'));