Repository navigation
#751 Commit staged revert before sending a prompt on v2 - #757
Merged
Merged
Conversation
On v2 servers a revert is staged and needs an explicit commit. Both apps
now call POST /api/session/{id}/revert/commit before sending the next
prompt while a revert is pending, matching the web app and TUI. v1
applies the revert itself on the next prompt, so its remote commits
nothing. A failed commit fails the send like a rejected prompt: the
draft is restored, the error shows, and the prompt is not sent.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ivanfenenko
added a commit
that referenced
this pull request
Oct 20, 2026
Resolve SessionProtocolRepositoryTest: keep #757's commitRevert tests and #758's v2 archive tests (which replace the old v2 archive 404 test). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
POST /api/session/{id}/revert/commit(no body) before sending the next prompt while a revert is pending. This matches the web app (packages/app/src/composer/submit.ts) and the TUI, which also commit only for prompts, not slash commands.SessionRepository.commitRevertdefaults to a no-op returningtruebecause v1 applies the revert itself on the next prompt.V2SessionRemotecalls the newcommitRevertV2/commitRevertV2(id:)API, andProtocolSelectedSessionRemoteandDefaultSessionRepositorydelegate to it.sendPrompttakes abeforePrompthook that runs before the prompt request. The Session Chat view model wires it tocommands.commitPendingRevert, which commits only when a revert boundary is pending.SessionErrornow maps to the same user-facing send messages asMessageError/CommandError.Checks
:app:assembleDebugand:app:assembleDebugAndroidTestpass.SessionChatViewModelTest(191) andSessionProtocolRepositoryTest(40) pass with 0 failures. Main source sets are ktlint-clean. The test source set has only existing violations, none on changed lines.SessionChatViewModelTestsandSessionProtocolRepositoryTestspass (220 tests) on a dedicated iPhone 17 / iOS 26.5 simulator. On the first run,sendPrompt_postSendReloadMatchingUser_dropsOptimisticfailed once (no revert involved) and passed unchanged on the rerun./api/session/{id}/revert/commitwithout a bodydevbc5ebf00a4), Android app on an emulator: revert "Turn 2", edit, send. Trace from/harness/history:(The missing underscore in "Turn 2edited" comes from adb text input.)
Issue
Risks / Follow-ups
session.revert.committedecho arrives, as it would in the web app.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.