Skip to content

fix(http): don't take back a real answer when the screen shows the question unanswered - #1227

Closed
sosidudku1 wants to merge 1 commit into
fix/ato-1298-rollback-last-turnfrom
fix/ato-1420-retry-after-clear
Closed

sosidudku1 wants to merge 1 commit into
fix/ato-1298-rollback-last-turnfrom
fix/ato-1420-retry-after-clear

Conversation

@sosidudku1

@sosidudku1 sosidudku1 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Linear: ATO-1420 (item 1, agent part). Stacked on #1162. Client parts: the TUI PR on #1164 and the desktop PR on #1165.

Problem. Try again finds the question to take back by its position on screen. After Clear transcript (desktop) or /clear (terminal) the screen is empty but the session keeps its history, so the position is off. In a rare case (one question before the clear, then the same text twice, the second failed and was never saved) Try again took back an earlier real answer.

Change. New optional body field expectUnanswered: true on the rollback endpoint. Clients send it when the screen shows no answer to the question. If the stored last question does have a real reply (stop markers and progress notes don't count), the agent refuses with 409 turn_mismatch, and the client falls back to a plain re-ask. So a failed question on screen can never take back a stored real answer, whatever the count. Agents that don't know the field ignore it. A non-boolean value gets a 400. src/http/README.md updated.

Tests: src/session/session-truncate.test.ts (3 new, including clear, "continue" twice, failed and unsaved) and src/http/route-rollback-last-turn.test.ts (rb-8).

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.

After a cleared transcript the client counts the question's position from
what it shows, so a failed "continue" the agent never stored could line up
with an earlier "continue" and remove its real answer. expectUnanswered:
true says the client saw no answer, and a stored reply then refuses with
turn_mismatch (ATO-1420).
@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
sheepdogs pushed a commit to sheepdogs/atomic-agent that referenced this pull request 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