Skip to content

Commit 65b9c89

Browse files
author
Brendan Gray
committed
feat: remove tool display strip + extend seamless continuation for EOS fence truncation (v1.7.5)
1 parent 9cffc69 commit 65b9c89

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/copilot-instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ After EVERY build, test run, or iteration where the user is about to test the ap
6262
- Run: `Clear-Content "C:\Users\brend\AppData\Roaming\guide-ide\logs\guide-main.log"`
6363
- Do this WITHOUT being asked. Every single time. No exceptions.
6464
- If you're about to say "ready to build" or "test it" — clear the logs first.
65+
- **ALSO clear immediately after a build/deployment sequence completes** — the user will test next. Do not wait to be asked.
6566
- The log file fills with stale entries from previous runs. Stale logs cause misdiagnosis.
6667
- Read log: `Get-Content "C:\Users\brend\AppData\Roaming\guide-ide\logs\guide-main.log"`
6768

@@ -225,6 +226,9 @@ Do NOT stop at any step. Do NOT report success until step 10 is verified. If the
225226
- Do NOT run `npm run build`, `electron-builder`, or any build/package/installer command locally.
226227
- Building = triggering GitHub Actions via a version tag push, as described above.
227228

229+
### GREEN LIGHT TO IMPLEMENT = GREEN LIGHT TO BUILD — NO EXCEPTIONS
230+
When the user approves a plan and says to proceed with implementation, that approval covers the FULL sequence: implement the changes AND run the complete 10-step build sequence defined above. Do NOT stop after writing code and wait for a second "build it" command. The build sequence is part of implementation. The task is not complete until step 10 is verified (graysoft.dev/download shows the new version and download URLs return HTTP 200).
231+
228232
### Plan before writing ANY code
229233
- Describe exactly what will change, in which files, and what the result will be.
230234
- Wait for explicit approval. Execute EXACTLY what was described — no more, no less.

main/agenticChat.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,23 +1693,32 @@ function register(ctx) {
16931693
// fullResponseText (fed back to the model for context) keeps the raw text.
16941694
// displayResponseText (committed to the chat message) should only have natural language.
16951695
// Targets: ```tool_call```, ```tool```, and ```json``` whose root object is a tool call.
1696+
// Tool-call fenced blocks are left in displayChunk so they appear as formatted code
1697+
// blocks in the chat bubble rather than being silently stripped to nothing.
16961698
const displayChunk = responseText
1697-
.replace(/```(?:tool_call|tool)[^\n]*\n[\s\S]*?```/g, '')
1698-
.replace(/```json[^\n]*\n\s*(?:\[\s*)?\{\s*"(?:tool|name)"\s*:[\s\S]*?```/g, '')
16991699
.replace(/\n{3,}/g, '\n\n');
17001700
displayResponseText += displayChunk;
17011701

17021702
// ── SEAMLESS CONTINUATION ──
17031703
// If generation stopped because maxTokens was hit (not a natural EOS), and no tool
17041704
// calls were returned, loop back and continue generating into the SAME open bubble.
17051705
// The UI sees one uninterrupted stream throughout. Guard: max 3 continuations.
1706-
const _wasTruncated = (result?.stopReason === 'maxTokens' || result?.stopReason === 'max-tokens')
1706+
// Also trigger seamless continuation when EOS fires mid-tool-call (unclosed fenced block).
1707+
// This happens with small models (e.g. Qwen3-0.6B) that emit the EOS token before
1708+
// closing the ```json block — stopReason comes back as 'eogToken', not 'maxTokens'.
1709+
const _fenceIdx = responseText.search(/```(?:json|tool_call|tool)\b/);
1710+
const _hasUnclosedToolFence = _fenceIdx !== -1 && !responseText.slice(_fenceIdx).includes('\n```');
1711+
const _wasTruncated = (
1712+
(result?.stopReason === 'maxTokens' || result?.stopReason === 'max-tokens') ||
1713+
_hasUnclosedToolFence
1714+
)
17071715
&& nativeFunctionCalls.length === 0
17081716
&& !_timedOut
17091717
&& !isStale();
17101718
if (_wasTruncated && continuationCount < 3) {
17111719
continuationCount++;
1712-
console.log(`[AI Chat] Seamless continuation ${continuationCount}/3 — response hit maxTokens, continuing in same bubble`);
1720+
const _truncReason = _hasUnclosedToolFence ? 'unclosed tool fence (EOS mid-block)' : 'maxTokens';
1721+
console.log(`[AI Chat] Seamless continuation ${continuationCount}/3 — ${_truncReason}, continuing in same bubble`);
17131722
iteration--; // Continuation is not a new agentic step
17141723
currentPrompt = {
17151724
systemContext: currentPrompt.systemContext, // Unchanged — KV cache preserved

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.4",
3+
"version": "1.7.5",
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)