You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: main/agenticChat.js
+25-6Lines changed: 25 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1179,10 +1179,21 @@ function register(ctx) {
1179
1179
awaitllmEngine.resetSession(true);
1180
1180
sessionJustRotated=true;
1181
1181
constrotatedBase=buildStaticPrompt();
1182
-
currentPrompt={
1183
-
systemContext: rotatedBase,
1184
-
userMessage: buildDynamicContext()+'\n'+lastConvSummary+`\nContext was rotated. The current user request is: ${message.substring(0,300)}${message.length>300 ? '...' : ''}`
1185
-
};
1182
+
if(_pendingPartialBlock){
1183
+
// Seamless continuation in progress — KV cache flush is correct and necessary,
1184
+
// but do NOT overwrite the continuation userMessage. The model must see
1185
+
// "[Continue the tool call JSON from exactly where it was cut...]" — not a
1186
+
// generic rotation message. Overwriting it causes corrupted/unrelated output.
1187
+
currentPrompt={
1188
+
systemContext: rotatedBase,
1189
+
userMessage: currentPrompt.userMessage,
1190
+
};
1191
+
}else{
1192
+
currentPrompt={
1193
+
systemContext: rotatedBase,
1194
+
userMessage: buildDynamicContext()+'\n'+lastConvSummary+`\nContext was rotated. The current user request is: ${message.substring(0,300)}${message.length>300 ? '...' : ''}`
1195
+
};
1196
+
}
1186
1197
}
1187
1198
}
1188
1199
}catch(_){}
@@ -1388,6 +1399,14 @@ function register(ctx) {
1388
1399
// error could trigger rotation, which looked like the app was "summarizing"
0 commit comments