mirror of
https://github.com/coder/coder.git
synced 2026-09-23 05:43:53 +08:00
https://github.com/user-attachments/assets/a482ef45-402a-4d86-af59-b1526b2ce3e2 ## Summary Redesigns the **Default Autostop** section on the `/agents` settings page to clarify that it is a fallback for chat-linked workspaces whose templates do not define their own autostop policy. Template-level settings always take priority — this is a backstop, not an override. ## Changes ### UX - Renamed to **Workspace Autostop Fallback** with clearer description - Replaced always-visible duration field (confusing `0` in an hours box) with a **toggle-to-enable** pattern matching the Virtual Desktop section - Toggle ON auto-saves with a 1-hour default; toggle OFF auto-saves with 0 - Save button is always visible when the toggle is on but disabled until the user changes the duration value - Per-section disabled flags — toggling autostop no longer freezes the Virtual Desktop switch or prompt textareas during the save round-trip ### Reliability - `onError` rollback on toggle auto-saves so the UI snaps back to server truth on failure - Stateful mocks in Storybook stories to prevent race conditions from instant mock resolution ### Accessibility - Added `aria-label="Autostop duration"` to the DurationField input - Updated `DurationField` component to merge external `inputProps` with internal ones (preserves `step: 1`) ### Stories - Updated all existing autostop stories for the new toggle-based flow - Added `DefaultAutostopToggleOff` — tests disabling from an enabled state - Added `DefaultAutostopSaveDisabled` — verifies Save button is visible but disabled when no duration change --- PR generated with Coder Agents