fix: guard unsaved prompt-stage edits when switching stages (#6021) - #6126
Merged
Conversation
Editing a prompt stage's template, model tier, or timeout override and then clicking another stage in the list silently threw the edits away — the click updated the URL, which re-fetched and overwrote the editor with no warning. Prompt templates run to hundreds of lines, so a mis-tap in the 120+ row stage list could destroy real work with no undo. The Stages tab now tracks the loaded template/config as a saved baseline and adopts the same inline discard confirmation the Job Skills tab has had since badge on its list row, and clicking a different stage parks that stage and turns its list slot into a "Discard / Keep editing" row instead of switching. Undoing the edit or saving clears the prompt on its own. Claude-Session: https://claude.ai/code/session_01VjkWVTfzKyRuAv3HEsspwN
atomantic
force-pushed
the
claim/issue-6021
branch
from
September 3, 2026 22:21
f992f8d to
0f10c1a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Editing a prompt stage's template, model tier, or timeout override and then clicking another stage in the Stages list silently discarded the edits: the click called
setSelectedStagedirectly, and theselectedStageeffect immediately re-fetched and overwrote the editor. Prompt templates run to hundreds of lines, so a mis-tap in the 120+ row stage list destroyed real work with no warning and no undo.The Stages tab now uses the same unsaved-edit guard the Job Skills tab has had since #3939:
savedStageTemplate/savedStageConfighold the last server-confirmed values (set whengetPromptresolves and after a successful save), so an edit undone back to the original stops counting as dirty.pendingStageand turns that row into anInlineConfirmRow("Discard" / "Keep editing") instead of switching — the URL, the fetch, and the typed text all hold. Nowindow.confirm, perclient/src/AGENTS.md.Deep linking is untouched — selection still lives entirely in the
?stage=param.Test plan
client/src/pages/PromptManager.test.jsxgains aPromptManager stage unsaved-edit guardsuite (10 cases): dirty on template edit, dirty on config-only change, revert-to-clean, arming the confirm row without switching, "Keep editing", "Discard", no prompt after a save, disarm on undo, back-out on re-click, and no prompt from a clean editor. 9 of the 10 fail againstmain(the 10th is the clean-switch regression guard).cd client && npm test— 834 files / 10230 tests pass.cd client && npx vite build— clean.Closes #6021
https://claude.ai/code/session_01VjkWVTfzKyRuAv3HEsspwN