Skip to content

fix(desktop): regenerate after clearing the chat takes back the right reply or just re-asks - #1229

Closed
sosidudku1 wants to merge 2 commits into
fix/ato-1300-regenerate-last-replyfrom
fix/ato-1420-retry-after-clear-desktop
Closed

sosidudku1 wants to merge 2 commits into
fix/ato-1300-regenerate-last-replyfrom
fix/ato-1420-retry-after-clear-desktop

Conversation

@sosidudku1

@sosidudku1 sosidudku1 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Linear: ATO-1420 (item 1, desktop part). Stacked on #1165.

After Clear transcript the desktop's Regenerate counted questions from what's on screen, so it could ask the agent to take back the wrong turn. Now:

  • each chat keeps a count of the questions Clear hid (ROLLBACK.cleared), added to the position it sends;
  • when there's no reply under the question, it passes expectUnanswered through preload → main IPC → rollbackLastTurn, so the agent refuses instead of taking back a real answer, and the app re-asks.

Older agents ignore the new field. Edge: Clear pressed before a new chat is saved keeps no count, and Regenerate then just re-asks.

Tests: desktop/test/rollback-last-turn.test.mjs (after the build), 5 new.

Verification

  • Review found the tests called rollbackNoteCleared by hand, so removing the real Clear wiring left them green. Fixed: the Clear step and the chat-open handling of the count are now named functions (clearTranscriptNow, rollbackOnSessionOpened) that the vm tests load and call. Removing the count update, its reset on chat open, or the expectUnanswered flag now fails a test.
  • Tests renamed to what they check; one now shows that only expectUnanswered keeps the real answer. 3 new tests (Clear during a running turn, reopen resets the count, Clear while the chat was loading).
  • Still not covered by unit tests: the one-line calls from act('clear') and openSession (would need a window drive).
  • Needs a run: build, then node --test desktop/test/rollback-last-turn.test.mjs.

Checked on the second Mac on 12.11.2026 in the combined run with the other open PRs: build, lint, test types, vitest, desktop unit tests, desktop smoke and live smoke all green.

…ate takes a turn back

Clear Transcript empties the window but not the agent's chat, so the
position Regenerate and Try again sent for the question was counted from
the screen. A failed "continue" then lined up with an earlier "continue"
and its real answer was removed. The window now keeps how many questions a
clear hid in that chat, adds them to the position, and sends
expectUnanswered for a question it shows no answer to (ATO-1420).
…ck count tests

Clear Transcript's step and openSession's handling of the cleared count
move into clearTranscriptNow and rollbackOnSessionOpened, which the vm
test now loads and calls, so dropping the count update or its reset
fails a test. Behaviour is unchanged. The failed-repeat tests are
renamed to what they check, and the wrong-count one now shows that only
expectUnanswered keeps the real answer.
@sosidudku1

Copy link
Copy Markdown
Collaborator Author

Closing: this code is already merged into rel/xp-build via #1257 (and into main via #1256 where it applies). GitHub did not mark it merged because the PR targets another feature branch.

@sosidudku1 sosidudku1 closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant