Repository navigation
ADFA-6276 | Allow editing sent prompts and branching chat versions - #115
Merged
Merged
Conversation
Edit loads a prompt and its files into the composer, pulsing its bubble; sending replaces the latest prompt or forks an earlier one, chevrons switch versions, and history commits on Main so Stop, clear or a chat switch can't race the run. Refs: ADFA-6276
jatezzz
force-pushed
the
feat/ADFA-6276-edit-last-prompt
branch
from
October 1, 2026 20:14
ef815ee to
39876ae
Compare
Daniel-ADFA
reviewed
Oct 1, 2026
Daniel-ADFA
left a comment
Collaborator
There was a problem hiding this comment.
IMPORTANT
- ChatFragment.kt:210 - a tab switch ends edit mode but keeps the edited text, so Send appends a new prompt
- ChatViewModel.kt:335 - after Stop, Edit is offered while
isGeneratingstill refuses it
MINOR
- ChatViewModel.kt:2348 -
finalizeInProgressMessagesremoves messages without relinking stored versions
NITPICK - 1 inline, not listed
ADFA-6276 acceptance criteria, against the code at this head:
- Edit is shown on user messages only, and Cancel leaves the transcript and history untouched.
- Confirming cuts the transcript and the model's history. Covered by
givenAFinishedRun_whenEditingItsPrompt_thenTheNextRunStartsFromBeforeItand the fork tests. - Edit is hidden while the agent is generating or waiting for approval, except in the window after Stop described at ChatViewModel.kt:335.
- Edits survive reopening the chat (
givenARewind_whenTheChatIsReopened_thenTheDiscardedPromptIsGone). - Tooltips are registered for Edit and the version switcher, and the Tier 2 text says file changes are not undone. I did not long-press them on a device.
- The new strings are in
strings.xml, and the tests use the givenX_whenY_thenZ names. - Scope: the ticket limited a first version to the newest prompt. Editing older prompts here keeps the original as a version instead of discarding it, so the confirmation step the ticket wanted for that case is not needed.
Checked and not posted:
- Editing a newest prompt that is itself a version replaces it. That is the documented rule, and
givenTheNewestPromptIsAVersion_whenEditingIt_thenItIsReplacedAndTheOriginalVersionStayscovers it. - The composer can fold away during an edit with blank text. The banner folds with it and comes back when the composer reopens.
removeFromScreenusesmapKeys, so two collapsed keys can overwrite each other. I found no way for a current caller to remove two keyed messages at once.rewinddrops the generated title while other versions of the first prompt are still stored, whereas a fork keeps it. I read that as a design choice, not a defect.- Per-token work in
promptVersions: an id list per emission. Small next to the per-token rendering.
Not verified on a device. Findings come from reading this head together with CoGo's EditorBottomSheetTabAdapter and GradleSyncHandler.
This repo has no written approve or request-changes rule, so these findings are graded against the default scale.
Restore an in-progress edit from saved state, gate Edit on isGenerating, relink versions when Stop drops empty bubbles, share showTranscript. Refs: ADFA-6276
Daniel-ADFA
approved these changes
Oct 2, 2026
Resolve ChatViewModel against main's prompt/ extraction, use runFiles for context files and the web check, and preload prompt config in tests. Refs: ADFA-6276
plugin-api's PromptConfigStore logs through slf4j, which only the host provides. Refs: ADFA-6276
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.
Description
This PR allows users to edit a prompt they have already sent to the agent. If the user edits their most recent message, the original prompt and everything after it are removed, and the agent runs on the edited text. If they edit an older message, it creates a new branch or version of the conversation from that point instead of discarding the original.
Details
ChatBranchesandPromptEditutilities to manage conversation tree logic, history rewinds, and switching between prompt versions.previous_versionandnext_versionnavigation arrows to switch between branches of an older edited message.Demo
https://drive.google.com/file/d/1hblBbmvyO4X7tJRNgAW2rsAG0UmINamw/view?usp=sharing
Ticket
ADFA-6276
Observation
Changes to files made by the agent in a discarded run are not automatically undone. Edit and version actions are hidden or disabled while the agent is actively generating or waiting on a tool approval.