@@ -135,18 +135,20 @@ def _send_bot_alerts(self, diff, config: CliConfig):
135135 if not bot_token:
136136 logger.error("SOCKET_SLACK_BOT_TOKEN environment variable not set for bot mode.")
137137 return
138-
138+
139139 if not bot_token.startswith("xoxb-"):
140140 logger.error("SOCKET_SLACK_BOT_TOKEN must start with 'xoxb-' (Bot User OAuth Token).")
141141 return
142-
142+
143+ logger.debug("SOCKET_SLACK_BOT_TOKEN: Set (valid xoxb- format)")
144+
143145 # Get bot_configs from configuration
144146 bot_configs = self.config.get("bot_configs", [])
145-
147+
146148 if not bot_configs:
147149 logger.warning("No bot_configs configured for bot mode.")
148150 return
149-
151+
150152 logger.debug("Slack Plugin Enabled (bot mode)")
151153 logger.debug("Alert levels: %s", self.config.get("levels"))
152154 logger.debug(f"Number of bot_configs: {len(bot_configs)}")
@@ -212,29 +214,35 @@ def _send_bot_reachability_alerts(self, bot_configs: list, bot_token: str, repo_
212214 """Send reachability alerts using bot mode with Slack API."""
213215 # Construct path to socket facts file
214216 facts_file_path = os.path.join(config.target_path or ".", f"{config.reach_output_file}")
215- logger.debug(f"Loading reachability data from {facts_file_path}")
216-
217+ facts_file_exists = os.path.exists(facts_file_path)
218+ logger.debug(f"Loading reachability data from {facts_file_path} (exists: {facts_file_exists})")
219+
220+ if not facts_file_exists:
221+ logger.error(f"Reachability facts file not found: {facts_file_path} — was --reach run successfully?")
222+ return
223+
217224 # Load socket facts file
218225 facts_data = load_socket_facts(facts_file_path)
219-
226+
220227 if not facts_data:
221- logger.debug("No .socket.facts.json file found or failed to load ")
228+ logger.error(f"Failed to load or parse reachability facts file: {facts_file_path} ")
222229 return
223-
230+
224231 # Get components with vulnerabilities
225232 components_with_vulns = get_components_with_vulnerabilities(facts_data)
226-
233+ logger.debug(f"Components with vulnerabilities in facts file: {len(components_with_vulns) if components_with_vulns else 0}")
234+
227235 if not components_with_vulns:
228236 logger.debug("No components with vulnerabilities found in .socket.facts.json")
229237 return
230-
238+
231239 # Convert to alerts format
232240 components_with_alerts = convert_to_alerts(components_with_vulns)
233-
241+
234242 if not components_with_alerts:
235243 logger.debug("No alerts generated from .socket.facts.json")
236244 return
237-
245+
238246 logger.debug(f"Found {len(components_with_alerts)} components with reachability alerts")
239247
240248 # Send to each configured bot_config with filtering
@@ -265,10 +273,12 @@ def _send_bot_reachability_alerts(self, bot_configs: list, bot_token: str, repo_
265273 filtered_component['alerts'] = filtered_component_alerts
266274 filtered_components.append(filtered_component)
267275
276+ logger.debug(f"Bot config '{name}': {len(filtered_components)} components after severity filter {bot_config.get('severities', '(all)')}")
277+
268278 if not filtered_components:
269279 logger.debug(f"No reachability alerts match filter criteria for bot_config '{name}'. Skipping.")
270280 continue
271-
281+
272282 # Format for Slack using the formatter (max 45 blocks for findings + 5 for header/footer)
273283 slack_notifications = format_socket_facts_for_slack(
274284 filtered_components,
0 commit comments