fix(desktop,cli): stop rejecting legal edit-and-resend / rewind on structured history - #5118
Open
ggbdpq wants to merge 5 commits into
Open
fix(desktop,cli): stop rejecting legal edit-and-resend / rewind on structured history#5118ggbdpq wants to merge 5 commits into
ggbdpq wants to merge 5 commits into
Conversation
A quote-bearing user message — including the automatic large-paste quote — was permanently ineligible for Edit & resend, and an edit was refused whenever any earlier retained turn carried an attachment, even though the Host revision copier already preserves referenced artifacts and rewrites their Session refs losslessly (apache#5109). Quotes are self-contained snapshot content, so the revision draft now carries them: beginEditUserMessage stages the source message's quotes into the composer (cleared back to the pre-edit set on cancel) and records them on the draft; the unchanged-send guard compares the staged quotes against the source's instead of the text alone, so a quote-only edit counts as a real edit. The stale retained-attachment history scan is dropped; a source message that itself carries attachments is still rejected explicitly because its rewritten target-owned refs are not exposed to clients yet. The renderer now stages and submits quotes on the revision send, so the replacement turn keeps its structured context. Part of apache#5109 Generated-by: GLM-5.3-Flash (ZCode)
…d content TUI /rewind refilled only userFacingText(promptMessage) and its replacement submit carried only text, so rewinding a turn with quotes or attachments silently degraded it to a display string (apache#5109). Until the TUI can stage structured context, rewind now fails closed with a precise notice instead of dropping the content silently. Part of apache#5109 Generated-by: GLM-5.3-Flash (ZCode)
Generated-by: GLM-5.3-Flash (ZCode)
An edit was refused whenever any earlier retained turn carried an attachment, even though the Runtime Host revision copier already preserves referenced user-upload artifacts and rewrites their Session refs losslessly (integration coverage in session-revision-two-client-uds.test). A plain-text message edited over such history is now editable; a source message that itself carries attachments stays explicitly rejected, because its rewritten target-owned refs are not exposed to clients yet (apache#5109). The renderer-architecture ledger's token figure for app-shell-revision-actions.ts follows the deletion down. The larger half of apache#5109 — staging a selected message's quotes/attachments into the revision draft — grows these debt-ratcheted files, so it is left out of this slice and noted as follow-up on the PR. Part of apache#5109 Generated-by: GLM-5.3-Flash (ZCode)
…ed slice The first commit carried the quote-staging wiring through the debt-ratcheted shell files; with the staging slice moved to follow-up those files return to their upstream content, keeping the renderer token ledger untouched. Generated-by: GLM-5.3-Flash (ZCode)
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
Part of #5109 — the two behaviors that can be fixed without growing the debt-ratcheted renderer shell files:
Desktop: an edit was refused whenever any earlier retained turn carried an attachment, even though the Runtime Host revision copier already preserves referenced user-upload artifacts and rewrites their Session refs losslessly (integration coverage in
session-revision-two-client-uds.test). That stale history scan is gone: a plain-text message edited over attachment-bearing history is now editable. A source message that itself carries attachments (and folder references) stays explicitly rejected, because its rewritten target-owned refs are not exposed to clients yet.TUI:
/rewindrefilled onlyuserFacingText(promptMessage)and the replacement submit carried only text — silently degrading a selected turn that carried quotes or attachments. Until the TUI can stage structured context, rewind now refuses with a precise notice instead of dropping content silently (the issue's explicit fail-closed allowance).Deliberately out of this slice: staging a selected message's quotes into the Desktop revision draft (issue behavior A). A working prototype grew
app-shell.tsx/app-shell-revision-actions.ts/use-app-shell-composer-quotes.ts, which are monotonic token-debt files underrenderer-architecture.json; whether to spend that budget (or re-home the staging logic in a non-ratcheted module) is a maintainer call, so it is noted as follow-up instead of smuggled in. Same for editing a selected message's attachments (needs the Host to expose rewritten target-owned refs) and TUI quote staging.Verification
app-shell-revision-actions.test2/2: editing a later plain-text message over attachment-bearing history opens the draft; a source message with attachments is still refused explicitlysession.revision.createcheck-renderer-architecture --base <merge-base>: no debt increase (revision-actions file shrinks; ledger figure follows down); TUI rewind suites 8/8build:test, ui, maka-agent exit 0; biome clean; ASF headers intactKnown-local-environment notes: the CI check script segfaults in the base-worktree derivation on this Windows machine, so the architecture gate was verified by metric comparison against the ledger (all touched files at or below base) — CI runs it for real.
AI use
Implemented with ZCode (GLM-5.3-Flash): traced the issue's verified implementation boundaries, red-green per slice, narrowed the slice when the renderer token ratchet refused the larger shape,
Generated-bytrailer in commits.Checklist