Skip to content

fix(tui): make try again on the last question a real retry - #1164

Draft
sosidudku1 wants to merge 2 commits into
fix/ato-1298-rollback-last-turnfrom
fix/ato-1302-terminal-real-retry
Draft

sosidudku1 wants to merge 2 commits into
fix/ato-1298-rollback-last-turnfrom
fix/ato-1302-terminal-real-retry

Conversation

@sosidudku1

@sosidudku1 sosidudku1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

What

[try again] on the chat's last question is now a real retry. When that turn was a plain question and answer and nothing is running or queued, ChatOrchestrator.rollbackLastTurn takes the turn back out of the session. It uses planLastTurnRollback, with the same rules as POST /api/sessions/{id}/rollback-last-turn, and passes the clicked text and its position as expectText / expectPriorQuestions. The pair leaves the screen through a new chat_messages_truncated action, and the question is sent again through the normal submit path. The saved session, and so /resume, shows one question and one answer.

Every other case keeps the old behaviour and sends the question again as a new turn: an earlier question, a turn that ran tools, a stopped turn, a steered or compacted turn, a busy chat, and the "stopped" and "Turn failed" notices.

Why

Before, the model read its first answer before answering again, and the saved chat kept both answers.

Stacked on #1162 (the rollback function and route). Merge that first; this PR's base is its branch.

How it was verified

  • New src/tui/chat-orchestrator-rollback.test.ts, plus additions to chat-try-again-button.test.tsx and reduce-ui-actions.test.ts.
  • Lint, tsc, vitest and a live PTY run have not been done yet.

Refs ATO-1302

Not yet checked on the second Mac.

[try again] on the chat's last question used to send the question as a
new turn, so the model read its first answer before answering again and
the saved chat kept both answers. Now, when the last turn was a plain
question and answer and nothing is running or queued, the orchestrator
takes that turn back out of the session (planLastTurnRollback, the same
rules as POST /api/sessions/{id}/rollback-last-turn: cancel a background
compaction, save the cut state, clear the turn-progress marker), the pair
leaves the screen (new chat_messages_truncated action), and the question
is sent again through the normal submit path. The saved session, and so
/resume, shows one question and one answer.

Every other case keeps the old behaviour and resends as a new turn: an
earlier question, a turn that ran tools, a steered or compacted turn, a
busy chat, and the stopped/failed notices.

Refs ATO-1302
[try again] now sends the clicked question's position (the questions
before it, steers left out) along with its text, so a failed copy of a
question that never reached the store cannot take back an earlier
question with the same text. A stopped turn is refused by the planner
(turn_stopped), and the button then sends the question again as a new
turn, as it did before.

Refs ATO-1302
@sosidudku1
sosidudku1 force-pushed the fix/ato-1302-terminal-real-retry branch from 2a26256 to 0433513 Compare November 10, 2026 23:51

This branch has not been deployed

No deployments
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