Skip to content

Conversation

warpdev
Copy link
Contributor

@warpdev warpdev commented Aug 29, 2025

Fixes #2755
Replaces #2757 to fix root cause.

Summary

Replace fragile string-based detection of user messages with typed metadata and span indices for backtracking. Only User messages are typed in this PR; others remain Other.

Root cause

Backtrack relied on rendered text parsing (“user” header join/trim), which loses type info and misidentifies boundaries.

Fix

  • Add MessageKind and MessageSpan to HistoryCell (defaults keep existing cells unchanged).
  • Introduce UserHistoryCell and return it from new_user_prompt (rendering unchanged).
  • Track absolute user spans in App (user_spans: Vec<(header_abs, end_abs)>). Other spans is not necessary now.
  • Refactor backtrack helpers to use spans (no string parsing).

Before

2025-08-29.2.07.37.mov

After

2025-08-29.2.06.51.mov

@warpdev warpdev force-pushed the fix/user-message-span branch 3 times, most recently from 02f08fa to 99e320e Compare August 29, 2025 05:37
@warpdev warpdev force-pushed the fix/user-message-span branch from e7e877e to 9026a37 Compare August 31, 2025 05:50
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.

Message edit mixes last user message with "stream error … retrying…" text
1 participant