Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -123,21 +123,21 @@ class WebhookHandler(BaseHTTPRequestHandler):
|
|
123 |
payload_bytes = self.rfile.read(content_length)
|
124 |
payload = json.loads(payload_bytes.decode('utf-8'))
|
125 |
except json.JSONDecodeError:
|
126 |
-
logger.error(f"Invalid JSON payload received: {payload_bytes[:500]}
|
127 |
self.send_response(400)
|
128 |
self.send_header("Content-type", "text/plain")
|
129 |
self.end_headers()
|
130 |
self.wfile.write(b"Invalid JSON payload")
|
131 |
return
|
132 |
except Exception as e:
|
133 |
-
logger.error(f"Error reading webhook payload: {e}
|
134 |
self.send_response(500)
|
135 |
self.end_headers()
|
136 |
return
|
137 |
|
138 |
event = self.headers.get('X-GitHub-Event')
|
139 |
delivery_id = self.headers.get('X-GitHub-Delivery')
|
140 |
-
logger.info(f"Received GitHub webhook event: {event}
|
141 |
|
142 |
if event == 'issues' and WebhookHandler.manager_instance and WebhookHandler.main_loop:
|
143 |
action = payload.get('action')
|
@@ -158,7 +158,7 @@ class WebhookHandler(BaseHTTPRequestHandler):
|
|
158 |
elif event == 'ping':
|
159 |
logger.info("Received GitHub webhook ping.")
|
160 |
else:
|
161 |
-
logger.warning(f"Unhandled event type: {event}
|
162 |
|
163 |
self.send_response(200)
|
164 |
self.send_header("Content-type", "text/plain")
|
@@ -597,7 +597,7 @@ class IssueManager:
|
|
597 |
if not filtered_counts:
|
598 |
fig = go.Figure()
|
599 |
fig.update_layout(title="Issue Severity Distribution", xaxis={"visible": False}, yaxis={"visible": False},
|
600 |
-
annotations=[{"text": "No issues to display.", "xref": "paper", "yref": "paper", "showarrow": False, "font": {"size": 16}
|
601 |
plot_bgcolor='rgba(0,0,0,0)', paper_bgcolor='rgba(0,0,0,0)')
|
602 |
return fig
|
603 |
|
@@ -1344,7 +1344,7 @@ Based on *all* the information provided above, outline a potential plan:
|
|
1344 |
self.stale_issues.append(issue_id)
|
1345 |
except (ValueError, TypeError) as e:
|
1346 |
logger.warning(f"Could not parse 'updated_at' ('{updated_at_str}') for issue {issue_id}: {e}")
|
1347 |
-
logger.info(f"Identified {len(self.stale_issues)}
|
1348 |
|
1349 |
def _identify_high_priority_candidates(self):
|
1350 |
"""Identifies high-priority issues (e.g., Critical/High severity)."""
|
|
|
123 |
payload_bytes = self.rfile.read(content_length)
|
124 |
payload = json.loads(payload_bytes.decode('utf-8'))
|
125 |
except json.JSONDecodeError:
|
126 |
+
logger.error(f"Invalid JSON payload received: {payload_bytes[:500]}")
|
127 |
self.send_response(400)
|
128 |
self.send_header("Content-type", "text/plain")
|
129 |
self.end_headers()
|
130 |
self.wfile.write(b"Invalid JSON payload")
|
131 |
return
|
132 |
except Exception as e:
|
133 |
+
logger.error(f"Error reading webhook payload: {e}")
|
134 |
self.send_response(500)
|
135 |
self.end_headers()
|
136 |
return
|
137 |
|
138 |
event = self.headers.get('X-GitHub-Event')
|
139 |
delivery_id = self.headers.get('X-GitHub-Delivery')
|
140 |
+
logger.info(f"Received GitHub webhook event: {event} (Delivery ID: {delivery_id})")
|
141 |
|
142 |
if event == 'issues' and WebhookHandler.manager_instance and WebhookHandler.main_loop:
|
143 |
action = payload.get('action')
|
|
|
158 |
elif event == 'ping':
|
159 |
logger.info("Received GitHub webhook ping.")
|
160 |
else:
|
161 |
+
logger.warning(f"Unhandled event type: {event} or manager/loop not initialized.")
|
162 |
|
163 |
self.send_response(200)
|
164 |
self.send_header("Content-type", "text/plain")
|
|
|
597 |
if not filtered_counts:
|
598 |
fig = go.Figure()
|
599 |
fig.update_layout(title="Issue Severity Distribution", xaxis={"visible": False}, yaxis={"visible": False},
|
600 |
+
annotations=[{"text": "No issues to display.", "xref": "paper", "yref": "paper", "showarrow": False, "font": {"size": 16}], # Removed the extra }
|
601 |
plot_bgcolor='rgba(0,0,0,0)', paper_bgcolor='rgba(0,0,0,0)')
|
602 |
return fig
|
603 |
|
|
|
1344 |
self.stale_issues.append(issue_id)
|
1345 |
except (ValueError, TypeError) as e:
|
1346 |
logger.warning(f"Could not parse 'updated_at' ('{updated_at_str}') for issue {issue_id}: {e}")
|
1347 |
+
logger.info(f"Identified {len(self.stale_issues)} potentially stale issues (updated > {self.stale_issue_threshold_days} days ago).")
|
1348 |
|
1349 |
def _identify_high_priority_candidates(self):
|
1350 |
"""Identifies high-priority issues (e.g., Critical/High severity)."""
|