Skip to content

Commit 203d82e

Browse files
author
Brendan Gray
committed
Remove 4000-char IPC truncation and 1000-char continuation tail limits
Bug 1: Streaming tool call params were truncated to last 4000 chars before sending to frontend via IPC, causing UI to lose top lines of code blocks. Bug 2+3: Continuation prompts only included last 1000 chars of partial content, giving model insufficient context to continue — causing it to restart the file from scratch instead of continuing where it left off.
1 parent 367436d commit 203d82e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

main/agenticChat.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ function register(ctx) {
883883
}
884884
if (_tStart !== -1 && _tName && mainWindow && !mainWindow.isDestroyed()) {
885885
const raw = _tb.slice(_tStart);
886-
const paramsText = raw.length > 4000 ? '\u2026' + raw.slice(-4000) : raw;
886+
const paramsText = raw;
887887
mainWindow.webContents.send('llm-tool-generating', {
888888
callIndex: _tIdx, functionName: _tName, paramsText, done: false,
889889
});
@@ -1172,11 +1172,9 @@ function register(ctx) {
11721172
if (_hasUnclosedToolFence) {
11731173
const partialFence = _stitchedForMcp.slice(_fenceIdx);
11741174
_pendingPartialBlock = partialFence;
1175-
const tail = partialFence.length > 1000 ? '\u2026' + partialFence.slice(-1000) : partialFence;
1176-
continuationMsg = `${taskHint}${fileManifest}[Continue the tool call JSON from exactly where it was cut. Output ONLY the JSON continuation. Do NOT restart the tool call. Continue from:\n${tail}]`;
1175+
continuationMsg = `${taskHint}${fileManifest}[Continue the tool call JSON from exactly where it was cut. Output ONLY the JSON continuation. Do NOT restart the tool call. Continue from:\n${partialFence}]`;
11771176
} else {
1178-
const tail = responseText.length > 1000 ? '\u2026' + responseText.slice(-1000) : responseText;
1179-
continuationMsg = `${taskHint}${fileManifest}[Continue your response exactly where you left off. Do not restart or repeat content. Here is the end of what you wrote:\n${tail}]`;
1177+
continuationMsg = `${taskHint}${fileManifest}[Continue your response exactly where you left off. Do not restart or repeat content. Here is the end of what you wrote:\n${responseText}]`;
11801178
}
11811179

11821180
currentPrompt = {

0 commit comments

Comments
 (0)