Skip to content

Keep TUI replay aligned with the first orchestrator QUERY marker - #341

Merged
tylerreckart merged 4 commits into
mainfrom
fix/replay-echo-first-query
Sep 21, 2026
Merged

tylerreckart merged 4 commits into
mainfrom
fix/replay-echo-first-query

Conversation

@cursor

@cursor cursor Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Index turns persist global_status() (always starts with AGENTS) plus a single \n\nQUERY: wrapper around the raw user line. replay_user_echo_text required AGENTS in the prefix, then used rfind("\n\nQUERY: ") to recover the echo.

Live scrollback shows the full user line. After a conversation switch, a user turn that embeds that same delimiter (for example quoting docs: compare\n\nQUERY: docs vs the README) replayed as only the suffix after the last marker.

Compaction already treats this as a first-marker strip (#335). Replay documented the no-AGENTS case but still took the last marker when the roster was present.

Fix

Use find so the boundary is the first \n\nQUERY: after the AGENTS roster. Keep the AGENTS guard so a user-only \n\nQUERY: line is not stripped.

Tests

unit_transcript_replay_predicates — embedded QUERY after a roster line, and the same case under an [OPEN TODOS] + QUERY: \n multipart prefix. 6/6 passed locally (+ ASan/UBSan).

Independently mergeable against main (0456350). Code hunks (transcript_replay_predicates.cpp, test_transcript_replay_predicates.cpp) do not overlap #321–#340. CHANGELOG [Unreleased] will need a rebase after whichever sibling merges first.

Open in Web View Automation 

Note

Low Risk
Narrow change to TUI replay string parsing with new unit tests; no auth, persistence, or API behavior changes.

Overview
Fixes TUI transcript replay so user-echo text matches live scrollback when the user's message contains \n\nQUERY: after the orchestrator strips the master preamble.

replay_user_echo_text now uses find (first \n\nQUERY: after the AGENTS block) instead of rfind, so embedded markers in the real user line are not mistaken for the orchestrator boundary. The existing AGENTS guard is unchanged—user-only messages with that substring are still left intact.

Unit tests cover embedded QUERY after a roster and under an [OPEN TODOS] multipart prefix; CHANGELOG documents the fix under [Unreleased].

Reviewed by Cursor Bugbot for commit 4fe3b04. Bugbot is set up for automated code reviews on this repo. Configure here.

replay_user_echo_text used rfind("\n\nQUERY: ") after requiring AGENTS
in the head. Index turns always wrap once (global_status + QUERY +
user text), so a user line that embeds that delimiter replayed as only
the suffix after the last marker. Live echo showed the full line.

Use find so the boundary matches the single orchestrator wrapper, same
class as the compaction preamble strip.

Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
Keep both Unreleased changelog entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_f9efd9f5-99d1-41e2-a829-bee7ad9577c3)

Keep both Unreleased changelog entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep both Unreleased changelog entries.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tylerreckart
tylerreckart merged commit 24e1866 into main Sep 21, 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.

3 participants