🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

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

Merged
mtojek merged 2 commits into
release/2.34from
backport/27083-to-2.34
Jul 16, 2026
Merged

fix(site): keep activity bump editable when allow_user_autostop is on (#27083)#27144
mtojek merged 2 commits into
release/2.34from
backport/27083-to-2.34

Conversation

@github-actions

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

Copy link
Copy Markdown

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

Backport of #27083

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

Cherry-pick conflict resolution

The automatic cherry-pick of the merge commit (-m1) conflicted because its diff pulled in the autostop reminder feature (AutostopReminderHelperText, the "Autostop reminder (hours)" field, and time_til_autostop_notify_ms), which does not exist on release/2.34.

Resolution: apply only PR #27083's actual change (the allow_user_autostop / activity-bump fix) and drop the unrelated autostop-reminder additions that the merge-commit diff dragged in.

  • TTLHelperText.tsx: applied the ActivityBumpHelperText allowUserAutostop change; did not add AutostopReminderHelperText.
  • TemplateScheduleForm.tsx: applied the activity-bump disabled and submit changes; did not add the autostop-reminder field.
  • TemplateSchedulePage.test.tsx: removed the three superseded activity-bump tests (auto-merged cleanly).
  • TemplateSchedulePageView.stories.tsx: added the three activity-bump stories; dropped the autostop-reminder stories.

Verified on 2.34: TemplateSchedulePage.test.tsx (20 tests) and the TemplateSchedulePageView storybook interaction tests (6) pass; the changed files type-check and lint cleanly.

…#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>

[#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.

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)
@jakehwll
jakehwll force-pushed the backport/27083-to-2.34 branch from 92de4d9 to f4da76c Compare July 13, 2026 02:53
@jakehwll jakehwll changed the title fix(site): keep activity bump editable when allow_user_autostop is on (#27083) (conflicts) fix(site): keep activity bump editable when allow_user_autostop is on (#27083) Jul 13, 2026
@jakehwll
jakehwll changed the base branch from release/2.34 to backport/25848-to-2.34 July 14, 2026 02:11
@jakehwll
jakehwll changed the base branch from backport/25848-to-2.34 to fix/bedrock-provider-form-story-2.34 July 14, 2026 02:15
mtojek pushed a commit that referenced this pull request Jul 14, 2026
…rock story (#27211)

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

Test-only fix for `release/2.34`.

### Problem

The `AddBedrockWithoutStaticCredentials` interaction test in
`ProviderForm.stories.tsx` asserts:

```ts
expect(args.onSubmit).toHaveBeenCalledWith(expect.objectContaining({ type: "bedrock", ... }))
```

Formik invokes `onSubmit(values, formikHelpers)` with **two** arguments,
so `toHaveBeenCalledWith` never matches and the storybook/Chromatic
interaction test fails deterministically. This breaks storybook CI for
**any** PR targeting `release/2.34` (e.g. the #27083 backport in
#27144).

`main` and `release/2.35` don't hit this because #25848 refactored the
story there to forward only `values` to the spy; that refactor was never
backported to 2.34.

### Fix

Match the second argument with `expect.anything()` so the assertion
reflects Formik's actual call signature. Test-only, minimal, no product
code change.

Verified on 2.34: `ProviderForm` storybook stories (13) pass; lint
clean.
Base automatically changed from fix/bedrock-provider-form-story-2.34 to release/2.34 July 14, 2026 07:12
@rowansmithau
rowansmithau requested review from jakehwll and mtojek and removed request for rowansmithau July 16, 2026 02:20
@mtojek
mtojek merged commit ee17a3b into release/2.34 Jul 16, 2026
39 of 41 checks passed
@mtojek
mtojek deleted the backport/27083-to-2.34 branch July 16, 2026 07:06
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 16, 2026
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