(description: string, abortSignal: AbortSignal)
| 448 | return baseUrl + encodedPrefix + truncatedEncodedErrors + ellipsis + encodedSuffix + encodedNote; |
| 449 | } |
| 450 | async function generateTitle(description: string, abortSignal: AbortSignal): Promise<string> { |
| 451 | try { |
| 452 | const response = await queryHaiku({ |
| 453 | systemPrompt: asSystemPrompt(['Generate a concise, technical issue title (max 80 chars) for a public GitHub issue based on this bug report for NCode.', 'NCode is an agentic coding CLI by Noumena.', 'The title should:', '- Include the type of issue [Bug] or [Feature Request] as the first thing in the title', '- Be concise, specific and descriptive of the actual problem', '- Use technical terminology appropriate for a software issue', '- For error messages, extract the key error (e.g., "Missing Tool Result Block" rather than the full message)', '- Be direct and clear for developers to understand the problem', '- If you cannot determine a clear issue, use "Bug Report: [brief description]"', 'Your response will be directly used as the title of the Github issue, and as such should not contain any other commentary or explaination', 'Examples of good titles include: "[Bug] Auto-Compact triggers to soon", "[Bug] Anthropic API Error: Missing Tool Result Block", "[Bug] Error: Invalid Model Name for Opus"']), |
| 454 | userPrompt: description, |
| 455 | signal: abortSignal, |
| 456 | options: { |
| 457 | hasAppendSystemPrompt: false, |
| 458 | toolChoice: undefined, |
| 459 | isNonInteractiveSession: false, |
| 460 | agents: [], |
| 461 | querySource: 'feedback', |
| 462 | mcpTools: [] |
| 463 | } |
| 464 | }); |
| 465 | const title = response.message.content[0]?.type === 'text' ? response.message.content[0].text : 'Bug Report'; |
| 466 | |
| 467 | // Check if the title contains an API error message |
| 468 | if (startsWithApiErrorPrefix(title)) { |
| 469 | return createFallbackTitle(description); |
| 470 | } |
| 471 | return title; |
| 472 | } catch (error) { |
| 473 | // If there's any error in title generation, use a fallback title |
| 474 | logError(error); |
| 475 | return createFallbackTitle(description); |
| 476 | } |
| 477 | } |
| 478 | function createFallbackTitle(description: string): string { |
| 479 | // Create a safe fallback title based on the bug description |
| 480 |
no test coverage detected