Skip to content

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

Merged
jakehwll merged 3 commits into
mainfrom
jakehwll/DEVEX-438-activity-bump-check-allow-user-autostop
Jul 9, 2026
Merged

fix(site): keep activity bump editable when allow_user_autostop is on#27083
jakehwll merged 3 commits into
mainfrom
jakehwll/DEVEX-438-activity-bump-check-allow-user-autostop

Conversation

@jakehwll

@jakehwll jakehwll commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🤖 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.

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

Implementation notes

Problem

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

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 on save.

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.

Fixes DEVEX-438.
@linear-code

linear-code Bot commented Jul 8, 2026

Copy link
Copy Markdown

DEVEX-438

@jakehwll
jakehwll requested a review from jeremyruppel July 8, 2026 03:49
@jakehwll
jakehwll marked this pull request as ready for review July 8, 2026 03:49
@jakehwll

jakehwll commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review

coder-agents-review Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Chat: Review posted | View chat
Requested: 2026-07-08 04:56 UTC by @jakehwll
Spend: $54.66 / $100.00

Review history
  • R1 (2026-07-08): 12 reviewers, 1 Nit, 1 P3, 1 P4, COMMENT. Review
  • R2 (2026-07-08): 13 reviewers, 2 Nit, 1 Note, 1 P3, 2 P4, APPROVE. Review
  • R3 (2026-07-08): 13 reviewers, 2 Nit, 1 Note, 1 P3, 2 P4, APPROVE. Review

deep-review v0.9.0 | Round 3 | 195dffc..7069c86

Last posted: Round 3, 6 findings (1 P3, 2 P4, 2 Nit, 1 Note), APPROVE. Review

Finding inventory

Findings

# Sev Status Location Summary Round Reviewer Posted
CRF-1 P4 Author accepted R2 (activity bump is no-op when only deadline source is autostop_requirement; enabling field would produce no-op UX) TemplateScheduleForm.tsx:325 Guard misses autostop_requirement as third deadline source (no-op in practice due to max_deadline cap) R1 Mafuuu P3 (downgraded by orchestrator) Yes
CRF-2 P3 Author fixed (146650d) TTLHelperText.tsx:78 AutostopReminderHelperText has same allow_user_autostop gap R1 Chopper P3, Nami P4 Yes
CRF-3 Nit Author fixed (146650d) TTLHelperText.tsx:39 Helper text says "enable user autostop" but checkbox label differs R1 Gon, Leorio Yes
CRF-4 Nit Dropped by orchestrator (Leorio praises same comments as domain-explaining; Gon's brevity preference conflicts with Leorio's domain-context assessment) TTLHelperText.tsx:32 Comment verbosity pattern (7 comments) R1 Gon No
CRF-5 Note Author accepted R3 (intentional regression coverage for base-guard path; new allow_user_autostop behavior covered by other stories) TemplateSchedulePageView.stories.tsx:138 ReEnablesActivityBumpWhenDefaultTTLIsSetBack story passes without production changes (migrated from RTL, provides regression coverage) R2 Netero Yes
CRF-6 P4 Author fixed (7069c86) TTLHelperText.tsx:89 AutostopReminderHelperText guard fix has no test coverage for allowUserAutostop path R2 Bisky P4, Chopper Note Yes
CRF-7 Nit Author fixed (7069c86) TTLHelperText.tsx:38 Helper text says "default TTL" but field label is "Default autostop (hours)" R2 Leorio Yes
CRF-8 P4 Dropped by orchestrator (submit path covered by two other stories; toggle stories test UI state transitions, not submit payloads) TemplateSchedulePageView.stories.tsx:138 No submit assertion in ReEnablesActivityBumpWhenDefaultTTLIsSetBack R2 Bisky No
CRF-9 P2 Dropped by orchestrator (process observation about R1 methodology, not a code defect; issue resolved in R2) TTLHelperText.tsx:69 R1 sibling detection failure on AutostopReminderHelperText R2 Mafu-san No
CRF-10 P2 Dropped by orchestrator (process observation about R1 methodology, not a code defect; RTL tests migrated in R2) TemplateSchedulePage.test.tsx:353 R1 added RTL tests while creating Storybook stories R2 Mafu-san No
CRF-11 P2 Dropped by orchestrator (same class as CRF-4; Leorio found no comment issues in R3; production comments carry domain invariants; style preference, not defect) TTLHelperText.tsx:32 Comment verbosity pattern (14 comments across production and stories) R3 Gon No

Round log

Round 1

Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Gon, Leorio, Nami, Ging-ts, Ging-react, Komugi, Chopper. 1 P3, 1 P4, 1 Nit new. 1 dropped. Reviewed against 195dffc..a3a7c12.

Round 2

Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Nami, Leorio, Komugi, Chopper, Gon, Ging-ts, Ging-react, Razor. CRF-1 accepted, CRF-2 and CRF-3 fixed. 1 P4, 1 Nit new. 3 dropped. Reviewed against 195dffc..146650d.

Round 3

Panel: Bisky, Hisoka, Mafu-san, Mafuuu, Pariston, Leorio, Nami, Komugi, Chopper, Gon, Ging-ts, Ging-react, Kite. CRF-5 accepted, CRF-6 and CRF-7 fixed. No new findings posted. 1 dropped. Reviewed against 195dffc..7069c86.

About deep-review

CRF = Coder Review Finding (P0-P4, Nit, Note)

Reviewer Focus
Bisky tests
Chopper ops/errors
Churn-guard change verification
Ging language modernization
Gon naming
Hisoka edge cases
Killua perf
Kite change integrity
Knov contracts
Knuckle SQL
Komugi flake/determinism
Kurapika security
Law decomposition
Leorio docs
Luffy product
Mafu-san process
Mafuuu contracts
Melody dispatch/pairing
Meruem structural
Nami frontend
Netero mechanical checks
Pariston premise testing
Pen-botter product gaps
Razor verification
Robin duplication
Ryosuke Go arch
Takumi concurrency
Zoro shape

🤖 Managed by Coder Agents.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3a7c12e11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-scoped fix with strong test coverage (86% test density, 114 test lines for 19 production lines). The guard broadening is consistent across all three touchpoints (disabled state, submit path, helper text), and the backend confirms activity bump is meaningful when allow_user_autostop is true. Tests cover the full condition matrix including toggle transitions.

"I tried to build a case against this change and couldn't. The premises hold." (Pariston)

1 P3, 1 P4, 1 Nit. The P3 is about a sibling component (AutostopReminderHelperText) in the same file having the same class of allow_user_autostop gap. Outside the diff but same pattern.


site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TTLHelperText.tsx:78

P3 [CRF-2] AutostopReminderHelperText has the same class of bug this PR fixes: its guard checks !defaultTTL && !hasAutostopRequirement but does not consider allow_user_autostop. When default_ttl=0, autostop_requirement=off, and allow_user_autostop=true, the helper text reads "Autostop reminders only apply when an autostop deadline is configured," telling the admin the feature is inert when users DO have autostop deadlines.

The field itself is never disabled (only on isSubmitting), so no data is lost. But the misleading text may cause admins to skip configuring reminders, leaving users with no advance warning before workspace shutdown.

Fix: pass allowUserAutostop to AutostopReminderHelperText and broaden the guard to !defaultTTL && !hasAutostopRequirement && !allowUserAutostop. (Chopper P3, Nami P4)

🤖

🤖 This review was automatically generated with Coder Agents.

Comment thread site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TTLHelperText.tsx Outdated
- Fix the same allow_user_autostop gap in AutostopReminderHelperText so
  the "no autostop deadline" hint does not appear when users can
  configure their own autostop timers (CRF-2).
- Reword activity bump hint to reference the exact "Allow users to
  customize autostop duration for workspaces" checkbox label instead of
  the vague "enable user autostop" phrasing (CRF-3).
- Move UI interaction coverage for the activity bump guard from RTL
  page tests into Storybook stories per site/AGENTS.md.
@jakehwll

jakehwll commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All R1 findings addressed. CRF-2 fix (AutostopReminderHelperText guard broadened to check allowUserAutostop) verified by 9 reviewers. CRF-3 fix (label mismatch) matches the exact checkbox label in both helper texts. CRF-1 defense (autostop_requirement gap is a no-op) confirmed by 5 reviewers tracing the max_deadline cap in the bump SQL. Test migration from RTL to Storybook is clean and covers all prior scenarios plus new allow_user_autostop paths.

"Boring code. Consistent layering. Nothing hiding." (Hisoka)

1 P4, 1 Nit new. Both minor.

🤖 This review was automatically generated with Coder Agents.

Comment thread site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TTLHelperText.tsx Outdated
- Refer to the "Default autostop" field by its actual UI label instead
  of "default TTL" in both helper texts (CRF-7).
- Add a Storybook story asserting AutostopReminderHelperText suppresses
  the "no autostop deadline" hint when allow_user_autostop is on and
  every other deadline source is off (CRF-6).
@jakehwll

jakehwll commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All findings resolved across 3 rounds. CRF-6 fix verified: AutostopReminderHelperTextHidesWhenAllowUserAutostopIsEnabled story covers the missing test path. CRF-7 fix verified: both helper texts now use "Default autostop" matching the field label. Guard logic is consistent across all three touchpoints, test coverage is complete (truth table fully covered per Bisky's verification), and the RTL-to-Storybook migration is clean.

"Oh, this test suite. Five new stories, full Chromium browser runs, submit-path assertions, toggle transitions. It is gorgeous. And every single stone is real." (Bisky)

No new findings. Ship it.

🤖 This review was automatically generated with Coder Agents.

@jakehwll
jakehwll merged commit 1eea4a7 into main Jul 9, 2026
26 of 27 checks passed
@jakehwll
jakehwll deleted the jakehwll/DEVEX-438-activity-bump-check-allow-user-autostop branch July 9, 2026 14:38
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants