fix(desktop): surface automation update errors and make team automations read-only
Problem
Choosing another host on an automation appeared to do nothing — the picker snapped back to the old device with no feedback.
CDP repro (dev app, real UI journey): on a teammate's automation (Team tab), picking another device fired automation.update which the server rejected with 404 — every automation mutation is owner-gated server-side via getAutomationForUser. The sidebar's mutation had no onError, and the pickers re-render from the Electric-synced row, so the rejected update silently reverted. Same silent failure applied to every field on the detail page (project, workspace, schedule, agent, timezone, name, prompt) plus the pause toggle.
Owned automations were verified unaffected end-to-end (update 200 → row syncs → picker label updates).
Fix
- Detail page renders read-only for non-owners (matches the list page, which already gates row actions on
isOwner): pickers disabled, header actions hidden (all owner-gated: pause, delete, run now, version history), name/prompt editors non-editable, plus an "Owned by X — only they can edit this automation" note. - Every detail-page mutation now toasts server rejections (
update,setPrompt,setEnabled) so no failure class can be silent again. DevicePicker/AgentPickergained an explicitdisabledprop: Chrome still firespointerdownon fieldset-disabled buttons, and that's the event that opens a Radix DropdownMenu — verified with trusted CDP input that the fieldset alone doesn't block them (Popover-based pickers open onclick, which disabled controls do suppress).MarkdownEditor/EmojiTextInputgained aneditableprop (TipTapsetEditable).
Verification (CDP, dev app from this worktree)
- Before: Team tab → "Sentry triage" → pick Town-Hall → request 404s, no toast, picker snaps back (the reported symptom).
- After: same journey → ownership note shown, header actions hidden, prompt
contenteditable=false, Device/Agent pickers don't open under trusted CDP clicks. - Regression: owned automation host change Kiets-Spaceship → Town-Hall persists, label updates, and DB row confirms; restored afterwards.
Open question
If teammates should be able to repoint each other's automations (e.g. off a dead host), that's a server-side authorization change (getAutomationForUser ownership check) — happy to follow up; this PR makes the current permission model visible instead of silent.
Summary by cubic
Make teammate-owned automations read-only and surface server rejections as toasts, fixing silent reverts and clarifying permissions. Also hide editor toolbars in read-only mode and block version history for non-owners.
-
Bug Fixes
- Toast on automation mutation failures (update, prompt save, enable/disable) to avoid silent reverts.
- Prevent device/agent pickers from opening when disabled by enforcing trigger
disabled. - Block Version History for non-owners, including via
?history=true.
-
New Features
- Read-only view for non-owners: disable pickers and editors, hide header actions, and show “Owned by X — only they can edit this automation.”
- Read-only support:
editableonMarkdownEditor/EmojiTextInput;disabledonDevicePicker/AgentPicker. Bubble menu hides when read-only.
Summary by CodeRabbit
-
New Features
- Automation details are now read-only when viewed by someone other than the owner.
- Read-only views display ownership information and disable editing, settings, version history, and action controls.
- Editors, dropdowns, and selection controls now support disabled and read-only states.
-
Bug Fixes
- Added error notifications when automation updates, prompt saves, or enable/disable actions fail.