File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1083,10 +1083,21 @@ export async function waitForRevertedMessage(
10831083 const threadAtom = environmentThreadDetails . stateAtom ( threadRef ) ;
10841084 const readProjection = ( ) => Option . getOrNull ( appAtomRegistry . get ( threadAtom ) . data ) ;
10851085 const initial = readProjection ( ) ;
1086- if ( ! initial ?. messages . some ( ( message ) => message . id === messageId ) ) {
1086+ // Paged prompts live in turn items without a duplicate projection message.
1087+ const messageRunId =
1088+ initial ?. messages . find ( ( message ) => message . id === messageId ) ?. runId ??
1089+ initial ?. visibleTurnItems . find (
1090+ ( { visibility, sourceThreadId, item } ) =>
1091+ visibility === "local" &&
1092+ sourceThreadId === initial . thread . id &&
1093+ item . threadId === initial . thread . id &&
1094+ item . type === "user_message" &&
1095+ item . messageId === messageId &&
1096+ initial . runs . some ( ( run ) => run . id === item . runId && run . threadId === initial . thread . id ) ,
1097+ ) ?. item . runId ;
1098+ if ( messageRunId == null ) {
10871099 throw new Error ( "The message to rewind is no longer available." ) ;
10881100 }
1089- const messageRunId = initial . messages . find ( ( message ) => message . id === messageId ) ?. runId ;
10901101 return new Promise < void > ( ( resolve , reject ) => {
10911102 let settled = false ;
10921103 let accepted = false ;
Original file line number Diff line number Diff line change @@ -1182,7 +1182,7 @@ export default function ChatView(props: ChatViewProps) {
11821182 messages : appAtomRegistry
11831183 . get ( environmentThreadDetails . visibleTurnItemsAtom ( routeThreadDetailRef ) )
11841184 . flatMap ( ( { item } ) =>
1185- item . type === "user_message"
1185+ item . type === "user_message" && ! item . messageId . startsWith ( "async-answer:" )
11861186 ? [ { id : item . messageId , role : "user" , text : item . text } ]
11871187 : [ ] ,
11881188 ) ,
@@ -5752,7 +5752,7 @@ export default function ChatView(props: ChatViewProps) {
57525752 createdAt : DateTime . formatIso ( sourceMessage . createdAt ) ,
57535753 updatedAt : DateTime . formatIso ( sourceMessage . updatedAt ) ,
57545754 }
5755- : undefined ;
5755+ : timelineMessages . find ( ( message ) => message . id === messageId ) ;
57565756 if ( ! message || message . role !== "user" ) return ;
57575757
57585758 if ( ! supportsConversationRollback ) {
You can’t perform that action at this time.
0 commit comments