From cbe951dd8f3e65bb9c6cc8765ac666745871676e Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 1 Jan 2026 20:03:15 +0100 Subject: [PATCH] fix(suggestions): extract result text from Cursor provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add handler for type=result messages in Cursor stream processing - Cursor provider sends final accumulated text in msg.result - Suggestions was only handling assistant messages for Cursor - Add detailed logging for result extraction (like backlog plan) - Matches pattern used by github validation and backlog plan This fixes potential parsing issues when using Cursor models for feature suggestions, ensuring the complete response text is captured before JSON parsing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../src/routes/suggestions/generate-suggestions.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/server/src/routes/suggestions/generate-suggestions.ts b/apps/server/src/routes/suggestions/generate-suggestions.ts index fefcea61..fb4371ba 100644 --- a/apps/server/src/routes/suggestions/generate-suggestions.ts +++ b/apps/server/src/routes/suggestions/generate-suggestions.ts @@ -226,6 +226,16 @@ Your entire response should be valid JSON starting with { and ending with }. No }); } } + } else if (msg.type === 'result' && msg.subtype === 'success' && msg.result) { + // Use result if it's a final accumulated message (from Cursor provider) + logger.info('[Suggestions] Received result from Cursor, length:', msg.result.length); + logger.info('[Suggestions] Previous responseText length:', responseText.length); + if (msg.result.length > responseText.length) { + logger.info('[Suggestions] Using Cursor result (longer than accumulated text)'); + responseText = msg.result; + } else { + logger.info('[Suggestions] Keeping accumulated text (longer than Cursor result)'); + } } } } else {