Quickstart: Verify Agent Editor Unsaved Changes Warning
Manual verification recipe for all three navigation paths covered by the feature, plus the must-not-trigger negative cases. Run after any change to the dirty-tracking hook, the dialog, the editor's back button, the agents page tab switcher, or AppHeader.GuardedLink.
Prerequisites
- Local UI dev server running:
cd ui && npm run dev. - A user account with admin / dynamic-agents access (see
useAdminRole). - At least one existing dynamic agent (or willingness to create one).
P1 — Back button warns when dirty
- Navigate to
/dynamic-agents(Agents tab). - Click an existing non-config-driven agent to open the editor.
- Don't change anything. Click the back arrow (top-left of the editor).
- Expected: editor closes immediately, no modal. Returns to agent list.
- Open the same agent again.
- Change any field (e.g., append " test" to the name, or edit description).
- Click the back arrow.
- Expected: in-app modal appears with title "Unsaved changes" and a description that mentions the agent editor.
- Click Keep editing.
- Expected: modal closes, editor remains open, your typed changes are still in the field.
- Click the back arrow again, then click Discard changes.
- Expected: modal closes, editor closes, agent list is shown, your edits are gone.
P1 — Sub-tab switch warns when dirty
- Open an agent in the editor and modify any field.
- Click the MCP Servers sub-tab on the Agents page.
- Expected: in-app modal appears. URL has NOT changed yet.
- Click Keep editing.
- Expected: modal closes; you remain on the Agents tab; editor still open with edits intact.
- Click LLM Models sub-tab, then in the modal click Discard changes.
- Expected: modal closes; URL switches to
?tab=llm-models; LLM Models content renders; the editor is gone.
- Expected: modal closes; URL switches to
- Re-open an agent (no changes), click Conversations sub-tab.
- Expected: switches immediately, no modal.
P2 — Top-level header navigation warns when dirty
- Open an agent and modify any field.
- In the top header, click Chat.
- Expected: in-app modal appears (title "Unsaved changes", generic description). URL has NOT changed.
- Click Keep editing.
- Expected: modal closes; still on
/dynamic-agents; editor still open and intact.
- Expected: modal closes; still on
- Click Home (or the app logo), then Discard changes.
- Expected: navigates to
/; modal gone.
- Expected: navigates to
Negative — does not warn when not dirty
- Open an agent (no changes). Click any sub-tab → switches immediately.
- Open an agent (no changes). Click any header link → navigates immediately.
- Open an agent (no changes). Click back arrow → returns to list immediately.
Negative — does not warn for read-only / config-driven agents
- Find a config-driven agent (badged "Config" in the list). Click it to open the read-only viewer.
- Try to interact with form fields — they are disabled.
- Click back, click any sub-tab, click any header link.
- Expected: in all three cases, the action proceeds immediately with no modal.
Negative — wizard step navigation does not warn
- Open an agent and modify the description on Step 1.
- Click into Step 2 (Instructions) using the step indicator at the top.
- Expected: switches steps immediately, no modal. Your description edit is preserved.
- Click back through Step 1.
- Expected: same — step indicator never warns; your edit is still there.
Save flows — clears dirty correctly
- Open an agent, change a field, click Save at the bottom.
- After save succeeds and the editor closes, re-open the same agent.
- Click any sub-tab without changing anything.
- Expected: switches immediately, no modal. (Confirms successful save cleared the dirty flag and didn't leak.)
- Open an agent, intentionally trigger a save failure (e.g., disconnect network or set a duplicate ID for new-agent flow). Save errors out.
- Click the back arrow.
- Expected: modal appears (because dirty is still true after a failed save).
Negative — no native browser dialog
- Open an agent and modify any field.
- With the editor open, hit your browser's reload button (Cmd-R / F5).
- Expected: page reloads without any "Leave site?" native browser confirmation. (We intentionally do not block this; the spec excludes native dialogs.)
Edge — revert clears dirty
- Open an agent. Note the current name.
- Type one extra character at the end of the name. Confirm typing makes the dirty state effective by clicking back — modal appears. Click Keep editing.
- Delete that one extra character so the name matches the original exactly.
- Click back.
- Expected: editor closes immediately, no modal.
Cloning — starts clean
- From the agent list, click the Clone (CopyPlus) icon on any agent.
- Editor opens with " (New)" appended to the name.
- Without changing anything else, click back.
- Expected: editor closes immediately, no modal. (The " (New)" suffix is part of the initial snapshot.)
- Open the clone flow again, change the description, click back.
- Expected: modal appears.
Done
If every section above behaves as described, the feature is verified end-to-end.