Repository navigation
Description
🎯 Goal
Fix the bug where new Pull Requests and log comments show incomplete or "unknown" LLM metrics (e.g., Cost: $unknown, missing model name). All metrics should be displayed correctly, similar to how they appear in follow-up comments.
📝 Context
This task is related to #69, which ensures metrics are stored persistently. This issue focuses on displaying them in GitHub.
The claudeResult object passed to completePostProcessing in src/worker.js already contains the model, conversationId, and finalResult (with cost/turns). The functions in src/githubService.js are just not using them correctly.
We should enhance generatePRBody and generateClaudeLogsComment to be as detailed as generateCompletionComment (in src/worker.js), which already has logic for this.
🚀 Implementation Steps
-
File:
src/githubService.js- Action: Modify the
generatePRBodyfunction (around line 128). - Logic: Add the LLM Model and Conversation ID, and make cost/turn parsing more robust.
- Suggestion:
// ... inside generatePRBody ... body += `- **Execution Time**: ${executionTime}s\n`; body += `- **Generated**: ${timestamp}\n`; // ADD THIS: if (claudeResult?.model) { body += `- **LLM Model**: ${claudeResult.model}\n`; } if (claudeResult?.finalResult) { const result = claudeResult.finalResult; // Use '??' for robust fallback body += `- **Claude Turns**: ${result.num_turns ?? 'unknown'}\n`; body += `- **Cost**: $${result.cost_usd ?? 'unknown'}\n`; body += `- **Session ID**: \`${claudeResult.sessionId || 'unknown'}\`\n`; // ADD THIS: if (claudeResult.conversationId) { body += `- **Conversation ID**: \`${claudeResult.conversationId}\`\n`; } } // ...
- Action: Modify the
-
File:
src/githubService.js- Action: Modify the
generateClaudeLogsCommentfunction (around line 190). - Logic: Add the LLM Model and Conversation ID to the statistics section.
- Suggestion:
// ... inside generateClaudeLogsComment ... comment += `**Session ID**: \`${claudeResult?.sessionId || 'unknown'}\`\n`; // ADD THIS: if (claudeResult?.conversationId) { comment += `**Conversation ID**: \`${claudeResult.conversationId}\`\n`; } comment += `**Timestamp**: ${new Date().toISOString()}\n\n`; // Add execution details if (claudeResult?.finalResult) { // ... comment += `### 📊 Execution Statistics\n\n`; comment += `- **Success**: ${claudeResult.success ? 'Yes' : 'No'}\n`; // ADD THIS: if (claudeResult?.model) { comment += `- **LLM Model**: ${claudeResult.model}\n`; } comment += `- **Total Turns**: ${result.num_turns ?? 'unknown'}\n`; // ... comment += `- **Cost**: $${result.cost_usd ?? 'unknown'}\n`; // ...
- Action: Modify the
Activity
propr-dev commentedon Sep 17, 2025
🤖 AI processing has started for this issue using claude-opus-4-20250514 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claude-opus-4-20250514ai-fix/70-bug-fix-missing-llm-metri-20250917-0948-claude-opus-4-20250514-zfrmainissue-70-20250917-0948-claude-opus-4-20250514-zfrfix(ai): Resolve issue #70 - Bug: Fix Missing LLM Metrics (Model, Cos…
Merge pull request #77 from integry/ai-fix/70-bug-fix-missing-llm-met…
feat(ai): I fixed F1. When the helper decides a "blocked by" link alr…