Skip to content

fix(site): keep activity bump editable when allow_user_autostop is on (#27083) - #27142

Merged
mtojek merged 1 commit into
release/2.35from
backport/27083-to-2.35
Jul 14, 2026
Merged

fix(site): keep activity bump editable when allow_user_autostop is on (#27083)#27142
mtojek merged 1 commit into
release/2.35from
backport/27083-to-2.35

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #27083

Original PR: #27083 — fix(site): keep activity bump editable when allow_user_autostop is on
Merge commit: 1eea4a7
Requested by: @rowansmithau

…#27083)

> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

The UI guard added in #22112 disabled the `Activity bump` field and
cleared its saved value whenever the template's `Default autostop` was
0. It did not check the "Allow users to customize autostop duration for
workspaces" (`allow_user_autostop`) setting, so templates that relied on
user-defined autostop timers had their `activity_bump_ms` silently
cleared when saving in the Coder UI.

Enable the field, preserve the value on submit, and update the helper
text when either `default_ttl_ms > 0` or `allow_user_autostop` is true.

Closes
[DEVEX-438](https://linear.app/codercom/issue/DEVEX-438/allow-user-autostop-default-autostop-disabled-causes-activity-bump-to).

> **Note:** This needs to be backported to 2.34 (ESR).

<details>
<summary>Implementation notes</summary>

### Problem

[#22112](#22112) introduced a UI
guard that:

1. Disables the `Activity bump (hours)` field when `default_ttl_ms ===
0`.
2. Sends `activity_bump_ms: undefined` on submit under the same
condition, which the backend treats as "do not update", but combined
with the disabled state users cannot re-enter a value once cleared and
the previously stored value effectively becomes orphaned.

The guard ignored `allow_user_autostop`. When that setting is enabled,
workspaces still have a scheduled stop (whatever the user configures on
their workspace), so `activity_bump_ms` is still meaningful.

### Fix

Broaden the guard to consider both signals. The field is only disabled
and the value only discarded when **both** `default_ttl_ms === 0`
**and** `allow_user_autostop === false`.

Changes:

- `TemplateScheduleForm.tsx`
- `disabled` prop now checks `!default_ttl_ms && !allow_user_autostop`.
- Submit path preserves `activity_bump_ms` when either signal is truthy.
  - Passes `allowUserAutostop` through to the helper text.
- `TTLHelperText.tsx`
- `ActivityBumpHelperText` accepts `allowUserAutostop` and only shows
the "no scheduled stop" hint when neither signal is set. Updated copy
mentions both signals.
- Tests and stories
- Existing tests explicitly uncheck `allow_user_autostop` before
asserting the guard fires (since `MockTemplate.allow_user_autostop`
defaults to `true`).
- Added coverage: guard stays off when only `allow_user_autostop` is
enabled; toggling `allow_user_autostop` re-enables the field without
touching `default_ttl_ms`.
- Added a story that verifies `activity_bump_ms` is preserved on submit
when `allow_user_autostop` is enabled and `default_ttl_ms` is 0.

</details>

(cherry picked from commit 1eea4a7)
@mtojek

mtojek commented Jul 14, 2026

Copy link
Copy Markdown
Member

@rowansmithau @jakehwll FYI, we require engineers to post backport requests in the #releases channel. I'll post this one for you, but please remember to do it yourselves next time. We monitor the channel regularly, but direct GitHub review requests can easily go unnoticed.

@mtojek
mtojek merged commit 5c2838a into release/2.35 Jul 14, 2026
23 of 24 checks passed
@mtojek
mtojek deleted the backport/27083-to-2.35 branch July 14, 2026 07:10
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 14, 2026

Copy link
Copy Markdown
Member

apologies @mtojek, I’ve done it for every other backport I’ve created, just missed this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants