Skip to content

Commit 189c30d

Browse files
ashokDevsclaude
andcommitted
fix: surface terminal failure log when AI suggests no changes
When the LLM returned zero tool calls for a manual task, the UI hung on the agent's generic "Analysis complete" message while the DB job row quietly transitioned to failed. No socket event fired into the job room, no issue comment was posted (manual tasks have no issue), and the user had nothing to act on. - groq_service: tell the truth in the activity log when file_changes is empty ("no code changes suggested"), instead of the optimistic fallback - pr_service: insert a role=system, type=terminal job_log row on the no-changes failure path so the job room receives a real message and the UI can render a clear failure state Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 801e891 commit 189c30d

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

backend/services/groq_service.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,18 @@ def analyze_issue_and_plan_changes(self, issue_title, issue_body, comment_body,
342342
}
343343

344344
if job_id:
345+
if file_changes:
346+
log_content = message.content or "Analysis complete. Suggested changes prepared."
347+
else:
348+
log_content = (
349+
message.content
350+
or "Analysis complete — no code changes suggested."
351+
)
345352
db.insert_job_log({
346353
'job_id': job_id,
347354
'role': 'assistant',
348355
'type': 'message',
349-
'content': message.content or "Analysis complete. Suggested changes prepared.",
356+
'content': log_content,
350357
'metadata': {'changes_count': len(file_changes)}
351358
})
352359

backend/services/pr_service.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,27 @@ def _execute_ai_task(self, task):
207207

208208
if not file_changes:
209209
logger.warning("no_file_changes_suggested", issue_number=issue_number)
210+
analysis = ai_result.get('analysis') or 'No analysis provided.'
210211
if issue_number:
211212
self.github_service.add_issue_comment(
212213
repo,
213214
issue_number,
214-
f"ℹ️ **Analysis Complete**\n\nI analyzed the issue but couldn't determine any necessary code changes.\n\n**Analysis:**\n{ai_result.get('analysis')}"
215+
f"ℹ️ **Analysis Complete**\n\nI analyzed the issue but couldn't determine any necessary code changes.\n\n**Analysis:**\n{analysis}"
215216
)
217+
if job_id:
218+
db.insert_job_log({
219+
'job_id': job_id,
220+
'role': 'system',
221+
'type': 'terminal',
222+
'content': (
223+
"❌ **Job failed** — the AI analyzed the request but did not "
224+
"suggest any code changes. This usually means the prompt was "
225+
"too vague, the relevant files weren't in context, or the "
226+
"model decided no change was warranted.\n\n"
227+
f"**Analysis:**\n{analysis}"
228+
),
229+
'metadata': {'reason': 'no_file_changes'}
230+
})
216231
return {
217232
'success': False,
218233
'message': 'AI did not suggest any file changes',

0 commit comments

Comments
 (0)