fix(desktop): restore edit after cancelled turns - #7951
Closed
Nath-Vikky wants to merge 1 commit into
Closed
Conversation
Collaborator
|
我来看下 |
This was referenced Aug 8, 2026
SivanCola
added a commit
that referenced
this pull request
Aug 8, 2026
Problem: The integrated cancellation regression still mocked the legacy submission method and expected a pending marker after the ID-aware submit had already resolved. Root cause: #7951 changed optimistic submission confirmation to use opaque submission IDs, while #7991's fixture predated that bridge contract. Fix: Mock SubmitToTabWithID and assert the immediate-cancel optimistic user item rather than an implementation-specific pending marker. Advance the repolint carry-forward by the nine lines introduced by the combined controller changes. Verification: - pnpm exec tsx src/__tests__/use-controller-cancel-reconcile.test.tsx - go run ./tools/repolint - go test ./... - cd desktop && go test ./... - go test -race ./internal/control ./internal/eventwire - git diff --check
Collaborator
|
Superseded by #8001, the maintained integration PR for this fix. #8001 carries your work onto the latest Your contribution is credited in the #8001 PR body, and the integration commit includes a public |
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
TurnDoneTurnDonehot pathProblem
When a visible model turn was cancelled or failed, the backend retained both the user prompt and its checkpoint, but the Desktop frontend refreshed checkpoint-turn mappings only after successful
TurnDoneevents.Once a session contained any authoritative checkpoint mapping, positional fallback was intentionally disabled. The cancelled prompt therefore had no
checkpointTurn, leaving Edit disabled until the session was switched or the application was restarted and hydrated again.Refreshing the full positional mapping on errored turns is not safe: visible local commands such as shell messages do not consume backend checkpoint turns and can shift subsequent mappings.
Fix
Each guarded turn now records a checkpoint candidate and exposes it on
TurnDoneonly after validating:Desktop submissions also carry an opaque correlation ID through the Wails submission APIs and event sink. The frontend applies
checkpointTurnonly to the optimistic user item with that exact ID.Missing, delayed, stale, local-only, or mismatched events fail closed instead of falling back to positional matching. Existing submission APIs remain available and delegate without correlation metadata.
Verification
TurnDone, tab/runtime rebinding, and no-TurnDonecommandsgo test ./internal/control ./internal/eventwireDocumentation-impact: none - existing user documentation remains correct; this restores the intended live checkpoint metadata reconciliation.
Fixes #5790
Refs #7920