Repository navigation
Closed
Labels
Description
Problem
Editing agent settings and then navigating to another tab triggers a Stay / Discard dialog that feels heavy-handed. Automation settings have the opposite gap — inline edits do not register with the global dirty blocker and tab switches are unguarded. Neither surface handles unsaved state in a cohesive way.
Current behaviour
Agent settings:
AgentNavigationregisters global dirty state viauseRegisterDirtySource(isDirty)(agent-navigation.tsx)DirtyBlockerProviderblocks any route navigation when dirty, including switching between agent tabs (each tab is a separate route) (dirty-blocker-provider.tsx)- Dialog is two-button only (Stay / Discard) — no Save & Leave because
onSaveAllis not passed to the provider on the dashboard shell (routes/dashboard/$id.tsx) - Save / Discard live in
EditorActionsin the tab nav header - Per-tab amber dots indicate which tabs have changes (
tab-navigation.tsx,agent-navigation.tsx)
Automation settings:
- Configuration tab is read-only; agent instructions/env edits happen in dialogs with local
isDirtyonly (agent-instructions-dialog.tsx,agent-env-dialog.tsx) - Automation tabs use
@tale/ui/tabswith URL?tab=— client state, no navigation blocker (automation-page.tsx) - No unsaved-changes prompt when leaving automation pages or switching automation tabs
Proposed change
Design and implement a consistent unsaved-changes strategy for settings surfaces:
- Agent tabs: Switching between tabs on the same agent should not feel like leaving the page — consider scoping the blocker to cross-entity navigation (different agent, different section) while preserving edits per tab, or offer Save & Leave in the dialog via
onSaveAll. - Automation settings: Wire inline edits into the same dirty-source / blocker pattern where edits can be lost.
- Shared UX: Per-tab dirty indicators (Improvement: Add per-tab unsaved indicator to automation settings #2573) plus a dialog that offers a path to save when possible, not only Stay / Discard.
The exact approach should follow existing editor infrastructure (DirtyBlockerProvider, useRegisterDirtySource, changedKeys) rather than inventing a one-off per page.
Acceptance criteria
- Switching agent settings tabs with unsaved edits on the current tab is handled predictably (no surprise data loss, no unnecessary friction).
- Leaving an agent or automation settings context with unsaved edits shows a clear prompt with a save path when save is available.
- Automation inline edits (instructions, environment, configuration changes) participate in the same dirty-state model.
- Behaviour is consistent between agent settings and automation settings.
- Existing Save / Discard header actions continue to work.
Activity