Skip to content

Commit fb0a4d2

Browse files
author
Brendan Gray
committed
v1.7.10: Raise seamless continuation cap to 50; fix rotation overwriting continuation prompt
1 parent ea10b80 commit fb0a4d2

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

main/agenticChat.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,10 +1179,21 @@ function register(ctx) {
11791179
await llmEngine.resetSession(true);
11801180
sessionJustRotated = true;
11811181
const rotatedBase = 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+
}
11861197
}
11871198
}
11881199
} catch (_) {}
@@ -1388,6 +1399,14 @@ function register(ctx) {
13881399
// error could trigger rotation, which looked like the app was "summarizing"
13891400
// on the very first turn.
13901401
if (isContextOverflow && contextRotations < MAX_CONTEXT_ROTATIONS) {
1402+
// If the model overflowed mid-generation during a seamless continuation pass,
1403+
// the _pendingPartialBlock is unusable (generation ended in error, not valid EOS).
1404+
// Clear it so the rotation produces a clean fresh prompt instead of injecting
1405+
// a stale partial block into the rotation hint.
1406+
if (_pendingPartialBlock) {
1407+
console.log('[AI Chat] In-generation overflow during continuation — clearing stale partial block, retrying clean');
1408+
_pendingPartialBlock = null;
1409+
}
13911410
// ── FIRST-TURN OVERFLOW DETECTION ──
13921411
// If no tool calls have been made (completedSteps === 0), there's nothing to
13931412
// summarize. Rotation is pointless — the rebuilt prompt will be the same size.
@@ -1707,10 +1726,10 @@ function register(ctx) {
17071726
&& nativeFunctionCalls.length === 0
17081727
&& !_timedOut
17091728
&& !isStale();
1710-
if (_wasTruncated && continuationCount < 3) {
1729+
if (_wasTruncated && continuationCount < 50) {
17111730
continuationCount++;
17121731
const _truncReason = _hasUnclosedToolFence ? 'unclosed tool fence (EOS mid-block)' : 'maxTokens';
1713-
console.log(`[AI Chat] Seamless continuation ${continuationCount}/3${_truncReason}, continuing in same bubble`);
1732+
console.log(`[AI Chat] Seamless continuation ${continuationCount}/50${_truncReason}, continuing in same bubble`);
17141733
iteration--; // Continuation is not a new agentic step
17151734
let _continuationUserMsg;
17161735
if (_hasUnclosedToolFence) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "guide-ide",
3-
"version": "1.7.9",
3+
"version": "1.7.10",
44
"description": "guIDE - AI-Powered Offline IDE with local LLM, RAG, MCP tools, browser automation, and integrated terminal",
55
"author": {
66
"name": "Brendan Gray",

0 commit comments

Comments
 (0)