crackerjack 0.31.10__py3-none-any.whl → 0.31.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of crackerjack might be problematic. Click here for more details.

Files changed (155) hide show
  1. crackerjack/CLAUDE.md +288 -705
  2. crackerjack/__main__.py +22 -8
  3. crackerjack/agents/__init__.py +0 -3
  4. crackerjack/agents/architect_agent.py +0 -43
  5. crackerjack/agents/base.py +1 -9
  6. crackerjack/agents/coordinator.py +2 -148
  7. crackerjack/agents/documentation_agent.py +109 -81
  8. crackerjack/agents/dry_agent.py +122 -97
  9. crackerjack/agents/formatting_agent.py +3 -16
  10. crackerjack/agents/import_optimization_agent.py +1174 -130
  11. crackerjack/agents/performance_agent.py +956 -188
  12. crackerjack/agents/performance_helpers.py +229 -0
  13. crackerjack/agents/proactive_agent.py +1 -48
  14. crackerjack/agents/refactoring_agent.py +516 -246
  15. crackerjack/agents/refactoring_helpers.py +282 -0
  16. crackerjack/agents/security_agent.py +393 -90
  17. crackerjack/agents/test_creation_agent.py +1776 -120
  18. crackerjack/agents/test_specialist_agent.py +59 -15
  19. crackerjack/agents/tracker.py +0 -102
  20. crackerjack/api.py +145 -37
  21. crackerjack/cli/handlers.py +48 -30
  22. crackerjack/cli/interactive.py +11 -11
  23. crackerjack/cli/options.py +66 -4
  24. crackerjack/code_cleaner.py +808 -148
  25. crackerjack/config/global_lock_config.py +110 -0
  26. crackerjack/config/hooks.py +43 -64
  27. crackerjack/core/async_workflow_orchestrator.py +247 -97
  28. crackerjack/core/autofix_coordinator.py +192 -109
  29. crackerjack/core/enhanced_container.py +46 -63
  30. crackerjack/core/file_lifecycle.py +549 -0
  31. crackerjack/core/performance.py +9 -8
  32. crackerjack/core/performance_monitor.py +395 -0
  33. crackerjack/core/phase_coordinator.py +281 -94
  34. crackerjack/core/proactive_workflow.py +9 -58
  35. crackerjack/core/resource_manager.py +501 -0
  36. crackerjack/core/service_watchdog.py +490 -0
  37. crackerjack/core/session_coordinator.py +4 -8
  38. crackerjack/core/timeout_manager.py +504 -0
  39. crackerjack/core/websocket_lifecycle.py +475 -0
  40. crackerjack/core/workflow_orchestrator.py +343 -209
  41. crackerjack/dynamic_config.py +50 -9
  42. crackerjack/errors.py +3 -4
  43. crackerjack/executors/async_hook_executor.py +63 -13
  44. crackerjack/executors/cached_hook_executor.py +14 -14
  45. crackerjack/executors/hook_executor.py +100 -37
  46. crackerjack/executors/hook_lock_manager.py +856 -0
  47. crackerjack/executors/individual_hook_executor.py +120 -86
  48. crackerjack/intelligence/__init__.py +0 -7
  49. crackerjack/intelligence/adaptive_learning.py +13 -86
  50. crackerjack/intelligence/agent_orchestrator.py +15 -78
  51. crackerjack/intelligence/agent_registry.py +12 -59
  52. crackerjack/intelligence/agent_selector.py +31 -92
  53. crackerjack/intelligence/integration.py +1 -41
  54. crackerjack/interactive.py +9 -9
  55. crackerjack/managers/async_hook_manager.py +25 -8
  56. crackerjack/managers/hook_manager.py +9 -9
  57. crackerjack/managers/publish_manager.py +57 -59
  58. crackerjack/managers/test_command_builder.py +6 -36
  59. crackerjack/managers/test_executor.py +9 -61
  60. crackerjack/managers/test_manager.py +17 -63
  61. crackerjack/managers/test_manager_backup.py +77 -127
  62. crackerjack/managers/test_progress.py +4 -23
  63. crackerjack/mcp/cache.py +5 -12
  64. crackerjack/mcp/client_runner.py +10 -10
  65. crackerjack/mcp/context.py +64 -6
  66. crackerjack/mcp/dashboard.py +14 -11
  67. crackerjack/mcp/enhanced_progress_monitor.py +55 -55
  68. crackerjack/mcp/file_monitor.py +72 -42
  69. crackerjack/mcp/progress_components.py +103 -84
  70. crackerjack/mcp/progress_monitor.py +122 -49
  71. crackerjack/mcp/rate_limiter.py +12 -12
  72. crackerjack/mcp/server_core.py +16 -22
  73. crackerjack/mcp/service_watchdog.py +26 -26
  74. crackerjack/mcp/state.py +15 -0
  75. crackerjack/mcp/tools/core_tools.py +95 -39
  76. crackerjack/mcp/tools/error_analyzer.py +6 -32
  77. crackerjack/mcp/tools/execution_tools.py +1 -56
  78. crackerjack/mcp/tools/execution_tools_backup.py +35 -131
  79. crackerjack/mcp/tools/intelligence_tool_registry.py +0 -36
  80. crackerjack/mcp/tools/intelligence_tools.py +2 -55
  81. crackerjack/mcp/tools/monitoring_tools.py +308 -145
  82. crackerjack/mcp/tools/proactive_tools.py +12 -42
  83. crackerjack/mcp/tools/progress_tools.py +23 -15
  84. crackerjack/mcp/tools/utility_tools.py +3 -40
  85. crackerjack/mcp/tools/workflow_executor.py +40 -60
  86. crackerjack/mcp/websocket/app.py +0 -3
  87. crackerjack/mcp/websocket/endpoints.py +206 -268
  88. crackerjack/mcp/websocket/jobs.py +213 -66
  89. crackerjack/mcp/websocket/server.py +84 -6
  90. crackerjack/mcp/websocket/websocket_handler.py +137 -29
  91. crackerjack/models/config_adapter.py +3 -16
  92. crackerjack/models/protocols.py +162 -3
  93. crackerjack/models/resource_protocols.py +454 -0
  94. crackerjack/models/task.py +3 -3
  95. crackerjack/monitoring/__init__.py +0 -0
  96. crackerjack/monitoring/ai_agent_watchdog.py +25 -71
  97. crackerjack/monitoring/regression_prevention.py +28 -87
  98. crackerjack/orchestration/advanced_orchestrator.py +44 -78
  99. crackerjack/orchestration/coverage_improvement.py +10 -60
  100. crackerjack/orchestration/execution_strategies.py +16 -16
  101. crackerjack/orchestration/test_progress_streamer.py +61 -53
  102. crackerjack/plugins/base.py +1 -1
  103. crackerjack/plugins/managers.py +22 -20
  104. crackerjack/py313.py +65 -21
  105. crackerjack/services/backup_service.py +467 -0
  106. crackerjack/services/bounded_status_operations.py +627 -0
  107. crackerjack/services/cache.py +7 -9
  108. crackerjack/services/config.py +35 -52
  109. crackerjack/services/config_integrity.py +5 -16
  110. crackerjack/services/config_merge.py +542 -0
  111. crackerjack/services/contextual_ai_assistant.py +17 -19
  112. crackerjack/services/coverage_ratchet.py +44 -73
  113. crackerjack/services/debug.py +25 -39
  114. crackerjack/services/dependency_monitor.py +52 -50
  115. crackerjack/services/enhanced_filesystem.py +14 -11
  116. crackerjack/services/file_hasher.py +1 -1
  117. crackerjack/services/filesystem.py +1 -12
  118. crackerjack/services/git.py +71 -47
  119. crackerjack/services/health_metrics.py +31 -27
  120. crackerjack/services/initialization.py +276 -428
  121. crackerjack/services/input_validator.py +760 -0
  122. crackerjack/services/log_manager.py +16 -16
  123. crackerjack/services/logging.py +7 -6
  124. crackerjack/services/metrics.py +43 -43
  125. crackerjack/services/pattern_cache.py +2 -31
  126. crackerjack/services/pattern_detector.py +26 -63
  127. crackerjack/services/performance_benchmarks.py +20 -45
  128. crackerjack/services/regex_patterns.py +2887 -0
  129. crackerjack/services/regex_utils.py +537 -0
  130. crackerjack/services/secure_path_utils.py +683 -0
  131. crackerjack/services/secure_status_formatter.py +534 -0
  132. crackerjack/services/secure_subprocess.py +605 -0
  133. crackerjack/services/security.py +47 -10
  134. crackerjack/services/security_logger.py +492 -0
  135. crackerjack/services/server_manager.py +109 -50
  136. crackerjack/services/smart_scheduling.py +8 -25
  137. crackerjack/services/status_authentication.py +603 -0
  138. crackerjack/services/status_security_manager.py +442 -0
  139. crackerjack/services/thread_safe_status_collector.py +546 -0
  140. crackerjack/services/tool_version_service.py +1 -23
  141. crackerjack/services/unified_config.py +36 -58
  142. crackerjack/services/validation_rate_limiter.py +269 -0
  143. crackerjack/services/version_checker.py +9 -40
  144. crackerjack/services/websocket_resource_limiter.py +572 -0
  145. crackerjack/slash_commands/__init__.py +52 -2
  146. crackerjack/tools/__init__.py +0 -0
  147. crackerjack/tools/validate_input_validator_patterns.py +262 -0
  148. crackerjack/tools/validate_regex_patterns.py +198 -0
  149. {crackerjack-0.31.10.dist-info → crackerjack-0.31.13.dist-info}/METADATA +197 -12
  150. crackerjack-0.31.13.dist-info/RECORD +178 -0
  151. crackerjack/cli/facade.py +0 -104
  152. crackerjack-0.31.10.dist-info/RECORD +0 -149
  153. {crackerjack-0.31.10.dist-info → crackerjack-0.31.13.dist-info}/WHEEL +0 -0
  154. {crackerjack-0.31.10.dist-info → crackerjack-0.31.13.dist-info}/entry_points.txt +0 -0
  155. {crackerjack-0.31.10.dist-info → crackerjack-0.31.13.dist-info}/licenses/LICENSE +0 -0
@@ -1,10 +1,3 @@
1
- """
2
- AI Agent Watchdog System
3
-
4
- Monitors AI agent execution for failures, performance issues, and regression patterns.
5
- Provides real-time oversight to prevent surprise failures and ensure reliable auto-fixing.
6
- """
7
-
8
1
  import asyncio
9
2
  import json
10
3
  import typing as t
@@ -12,17 +5,16 @@ from dataclasses import dataclass, field
12
5
  from datetime import datetime, timedelta
13
6
  from pathlib import Path
14
7
 
15
- from crackerjack.agents.base import FixResult, Issue, IssueType, Priority
16
- from crackerjack.agents.coordinator import AgentCoordinator
17
8
  from rich.console import Console
18
9
  from rich.live import Live
19
10
  from rich.table import Table
20
11
 
12
+ from crackerjack.agents.base import FixResult, Issue, IssueType, Priority
13
+ from crackerjack.agents.coordinator import AgentCoordinator
14
+
21
15
 
22
16
  @dataclass
23
17
  class AgentPerformanceMetrics:
24
- """Track agent performance over time."""
25
-
26
18
  agent_name: str
27
19
  total_issues_handled: int = 0
28
20
  successful_fixes: int = 0
@@ -37,9 +29,7 @@ class AgentPerformanceMetrics:
37
29
 
38
30
  @dataclass
39
31
  class WatchdogAlert:
40
- """Watchdog alert for monitoring issues."""
41
-
42
- level: str # "warning", "error", "critical"
32
+ level: str
43
33
  message: str
44
34
  agent_name: str | None = None
45
35
  issue_id: str | None = None
@@ -48,8 +38,6 @@ class WatchdogAlert:
48
38
 
49
39
 
50
40
  class AIAgentWatchdog:
51
- """Monitors AI agent execution and prevents regression failures."""
52
-
53
41
  def __init__(self, console: Console | None = None):
54
42
  self.console = console or Console()
55
43
  self.performance_metrics: dict[str, AgentPerformanceMetrics] = {}
@@ -62,17 +50,14 @@ class AIAgentWatchdog:
62
50
  self.monitoring_active = False
63
51
  self.execution_history: list[dict[str, t.Any]] = []
64
52
 
65
- # Performance thresholds
66
- self.max_execution_time = 30.0 # seconds
67
- self.min_success_rate = 0.6 # 60%
53
+ self.max_execution_time = 30.0
54
+ self.min_success_rate = 0.6
68
55
  self.max_recent_failures = 3
69
56
 
70
57
  async def start_monitoring(self, coordinator: AgentCoordinator):
71
- """Start monitoring agent coordinator."""
72
58
  self.monitoring_active = True
73
59
  self.console.print("🔍 [bold green]AI Agent Watchdog Started[/bold green]")
74
60
 
75
- # Initialize metrics for all agents
76
61
  coordinator.initialize_agents()
77
62
  for agent in coordinator.agents:
78
63
  agent_name = agent.__class__.__name__
@@ -86,7 +71,6 @@ class AIAgentWatchdog:
86
71
  )
87
72
 
88
73
  def stop_monitoring(self):
89
- """Stop monitoring and generate final report."""
90
74
  self.monitoring_active = False
91
75
  self.console.print("🔍 [bold yellow]AI Agent Watchdog Stopped[/bold yellow]")
92
76
  self._generate_final_report()
@@ -94,7 +78,6 @@ class AIAgentWatchdog:
94
78
  async def monitor_issue_handling(
95
79
  self, agent_name: str, issue: Issue, result: FixResult, execution_time: float
96
80
  ):
97
- """Monitor individual issue handling by agents."""
98
81
  if not self.monitoring_active:
99
82
  return
100
83
 
@@ -103,7 +86,6 @@ class AIAgentWatchdog:
103
86
  metrics = AgentPerformanceMetrics(agent_name=agent_name)
104
87
  self.performance_metrics[agent_name] = metrics
105
88
 
106
- # Update metrics
107
89
  metrics.total_issues_handled += 1
108
90
  if result.success:
109
91
  metrics.successful_fixes += 1
@@ -113,11 +95,9 @@ class AIAgentWatchdog:
113
95
  failure_key = f"{issue.type.value}_{issue.message[:50]}"
114
96
  metrics.recent_failures.append(failure_key)
115
97
 
116
- # Keep only recent failures
117
98
  if len(metrics.recent_failures) > self.max_recent_failures:
118
99
  metrics.recent_failures.pop(0)
119
100
 
120
- # Update averages
121
101
  total_fixes = metrics.successful_fixes + metrics.failed_fixes
122
102
  metrics.average_confidence = (
123
103
  metrics.average_confidence * (total_fixes - 1) + result.confidence
@@ -126,15 +106,12 @@ class AIAgentWatchdog:
126
106
  metrics.average_execution_time * (total_fixes - 1) + execution_time
127
107
  ) / total_fixes
128
108
 
129
- # Track issue types
130
109
  metrics.issue_types_handled[issue.type] = (
131
110
  metrics.issue_types_handled.get(issue.type, 0) + 1
132
111
  )
133
112
 
134
- # Check for alerts
135
113
  await self._check_for_alerts(agent_name, issue, result, execution_time, metrics)
136
114
 
137
- # Store execution history
138
115
  self.execution_history.append(
139
116
  {
140
117
  "timestamp": datetime.now().isoformat(),
@@ -147,7 +124,6 @@ class AIAgentWatchdog:
147
124
  }
148
125
  )
149
126
 
150
- # Keep history manageable
151
127
  if len(self.execution_history) > 1000:
152
128
  self.execution_history = self.execution_history[-500:]
153
129
 
@@ -159,15 +135,13 @@ class AIAgentWatchdog:
159
135
  execution_time: float,
160
136
  metrics: AgentPerformanceMetrics,
161
137
  ):
162
- """Check for alert conditions."""
163
138
  alerts = []
164
139
 
165
- # Performance alerts
166
140
  if execution_time > self.max_execution_time:
167
141
  alerts.append(
168
142
  WatchdogAlert(
169
143
  level="warning",
170
- message=f"Agent took {execution_time:.1f}s (>{self.max_execution_time}s threshold)",
144
+ message=f"Agent took {execution_time: .1f}s (>{self.max_execution_time}s threshold)",
171
145
  agent_name=agent_name,
172
146
  issue_id=issue.id,
173
147
  details={
@@ -177,14 +151,13 @@ class AIAgentWatchdog:
177
151
  )
178
152
  )
179
153
 
180
- # Success rate alerts
181
- if metrics.total_issues_handled >= 5: # Only after handling multiple issues
154
+ if metrics.total_issues_handled >= 5:
182
155
  success_rate = metrics.successful_fixes / metrics.total_issues_handled
183
156
  if success_rate < self.min_success_rate:
184
157
  alerts.append(
185
158
  WatchdogAlert(
186
159
  level="error",
187
- message=f"Agent success rate {success_rate:.1%} below {self.min_success_rate:.1%} threshold",
160
+ message=f"Agent success rate {success_rate: .1 %} below {self.min_success_rate: .1 %} threshold",
188
161
  agent_name=agent_name,
189
162
  details={
190
163
  "success_rate": success_rate,
@@ -193,7 +166,6 @@ class AIAgentWatchdog:
193
166
  )
194
167
  )
195
168
 
196
- # Regression pattern alerts
197
169
  failure_signature = f"{agent_name}_{issue.type.value}_{issue.message[:30]}"
198
170
  if failure_signature in self.known_regressions and not result.success:
199
171
  alerts.append(
@@ -206,10 +178,9 @@ class AIAgentWatchdog:
206
178
  )
207
179
  )
208
180
 
209
- # Repeated failure alerts
210
181
  if len(metrics.recent_failures) >= self.max_recent_failures:
211
182
  unique_failures = set(metrics.recent_failures)
212
- if len(unique_failures) == 1: # Same failure repeated
183
+ if len(unique_failures) == 1:
213
184
  alerts.append(
214
185
  WatchdogAlert(
215
186
  level="error",
@@ -219,13 +190,11 @@ class AIAgentWatchdog:
219
190
  )
220
191
  )
221
192
 
222
- # Add alerts
223
193
  for alert in alerts:
224
194
  self.alerts.append(alert)
225
195
  await self._handle_alert(alert)
226
196
 
227
197
  async def _handle_alert(self, alert: WatchdogAlert):
228
- """Handle watchdog alert."""
229
198
  colors = {"warning": "yellow", "error": "red", "critical": "bold red"}
230
199
  color = colors.get(alert.level) or "white"
231
200
 
@@ -235,19 +204,17 @@ class AIAgentWatchdog:
235
204
  f"{icon} [bold {color}]{alert.level.upper()}[/bold {color}]: {alert.message}"
236
205
  )
237
206
  if alert.agent_name:
238
- self.console.print(f" Agent: {alert.agent_name}")
207
+ self.console.print(f" Agent: {alert.agent_name}")
239
208
  if alert.issue_id:
240
- self.console.print(f" Issue: {alert.issue_id}")
209
+ self.console.print(f" Issue: {alert.issue_id}")
241
210
 
242
- # For critical alerts, suggest immediate actions
243
211
  if alert.level == "critical":
244
- self.console.print(" [bold red]IMMEDIATE ACTION REQUIRED[/bold red]")
212
+ self.console.print(" [bold red]IMMEDIATE ACTION REQUIRED[/bold red]")
245
213
  if "regression" in alert.message.lower():
246
- self.console.print(" → Run regression tests immediately")
247
- self.console.print(" → Check agent implementation for recent changes")
214
+ self.console.print(" → Run regression tests immediately")
215
+ self.console.print(" → Check agent implementation for recent changes")
248
216
 
249
217
  def create_monitoring_dashboard(self) -> Table:
250
- """Create real-time monitoring dashboard."""
251
218
  table = Table(
252
219
  title="AI Agent Watchdog Dashboard",
253
220
  header_style="bold magenta",
@@ -267,7 +234,6 @@ class AIAgentWatchdog:
267
234
 
268
235
  success_rate = metrics.successful_fixes / metrics.total_issues_handled
269
236
 
270
- # Status determination
271
237
  status_color = "green"
272
238
  status_text = "✅ OK"
273
239
 
@@ -284,16 +250,16 @@ class AIAgentWatchdog:
284
250
  if delta.days > 0:
285
251
  last_success = f"{delta.days}d ago"
286
252
  elif delta.seconds > 3600:
287
- last_success = f"{delta.seconds // 3600}h ago"
253
+ last_success = f"{delta.seconds / 3600}h ago"
288
254
  else:
289
- last_success = f"{delta.seconds // 60}m ago"
255
+ last_success = f"{delta.seconds / 60}m ago"
290
256
 
291
257
  table.add_row(
292
258
  agent_name,
293
259
  str(metrics.total_issues_handled),
294
- f"{success_rate:.1%}",
295
- f"{metrics.average_confidence:.2f}",
296
- f"{metrics.average_execution_time:.1f}",
260
+ f"{success_rate: .1 %}",
261
+ f"{metrics.average_confidence: .2f}",
262
+ f"{metrics.average_execution_time: .1f}",
297
263
  last_success,
298
264
  f"[{status_color}]{status_text}[/{status_color}]",
299
265
  )
@@ -301,15 +267,12 @@ class AIAgentWatchdog:
301
267
  return table
302
268
 
303
269
  def get_recent_alerts(self, hours: int = 1) -> list[WatchdogAlert]:
304
- """Get alerts from the last N hours."""
305
270
  cutoff = datetime.now() - timedelta(hours=hours)
306
271
  return [alert for alert in self.alerts if alert.timestamp > cutoff]
307
272
 
308
273
  def _generate_final_report(self):
309
- """Generate final monitoring report."""
310
274
  self.console.print("\n📊 [bold]AI Agent Watchdog Final Report[/bold]")
311
275
 
312
- # Summary statistics
313
276
  total_issues = sum(
314
277
  m.total_issues_handled for m in self.performance_metrics.values()
315
278
  )
@@ -320,10 +283,9 @@ class AIAgentWatchdog:
320
283
  if total_issues > 0:
321
284
  overall_success_rate = total_successes / total_issues
322
285
  self.console.print(
323
- f"Overall Success Rate: {overall_success_rate:.1%} ({total_successes}/{total_issues})"
286
+ f"Overall Success Rate: {overall_success_rate: .1 %} ({total_successes}/{total_issues})"
324
287
  )
325
288
 
326
- # Alert summary
327
289
  alert_counts = {"warning": 0, "error": 0, "critical": 0}
328
290
  for alert in self.alerts:
329
291
  alert_counts[alert.level] += 1
@@ -332,7 +294,6 @@ class AIAgentWatchdog:
332
294
  f"Alerts: {alert_counts['critical']} Critical, {alert_counts['error']} Errors, {alert_counts['warning']} Warnings"
333
295
  )
334
296
 
335
- # Top performing agents
336
297
  if self.performance_metrics:
337
298
  best_agent = max(
338
299
  (
@@ -348,14 +309,12 @@ class AIAgentWatchdog:
348
309
  best_agent.successful_fixes / best_agent.total_issues_handled
349
310
  )
350
311
  self.console.print(
351
- f"Top Performer: {best_agent.agent_name} ({success_rate:.1%} success rate)"
312
+ f"Top Performer: {best_agent.agent_name} ({success_rate: .1 %} success rate)"
352
313
  )
353
314
 
354
- # Save detailed report
355
315
  self._save_monitoring_report()
356
316
 
357
317
  def _save_monitoring_report(self):
358
- """Save detailed monitoring report to file."""
359
318
  report_data = {
360
319
  "timestamp": datetime.now().isoformat(),
361
320
  "metrics": {
@@ -399,11 +358,9 @@ class AIAgentWatchdog:
399
358
 
400
359
 
401
360
  async def run_agent_monitoring_demo():
402
- """Demo of the AI agent monitoring system."""
403
361
  console = Console()
404
362
  watchdog = AIAgentWatchdog(console)
405
363
 
406
- # Simulate agent context and coordinator
407
364
  from crackerjack.agents.base import AgentContext
408
365
 
409
366
  context = AgentContext(project_path=Path.cwd())
@@ -411,12 +368,10 @@ async def run_agent_monitoring_demo():
411
368
 
412
369
  await watchdog.start_monitoring(coordinator)
413
370
 
414
- # Simulate some agent executions with monitoring
415
371
  with Live(
416
372
  watchdog.create_monitoring_dashboard(), refresh_per_second=1, console=console
417
373
  ) as live:
418
374
  for i in range(10):
419
- # Simulate issue handling
420
375
  issue = Issue(
421
376
  id=f"demo_{i}",
422
377
  type=IssueType.COMPLEXITY if i % 2 == 0 else IssueType.FORMATTING,
@@ -425,8 +380,7 @@ async def run_agent_monitoring_demo():
425
380
  file_path="demo.py",
426
381
  )
427
382
 
428
- # Simulate varying results
429
- success = i % 3 != 0 # Fail every 3rd attempt
383
+ success = i % 3 != 0
430
384
  result = FixResult(
431
385
  success=success,
432
386
  confidence=0.8 if success else 0.3,
@@ -434,14 +388,14 @@ async def run_agent_monitoring_demo():
434
388
  remaining_issues=[] if success else ["Demo failure"],
435
389
  )
436
390
 
437
- execution_time = 2.0 + (i % 5) * 0.5 # Varying execution times
391
+ execution_time = 2.0 + (i % 5) * 0.5
438
392
 
439
393
  await watchdog.monitor_issue_handling(
440
394
  "DemoAgent", issue, result, execution_time
441
395
  )
442
396
  live.update(watchdog.create_monitoring_dashboard())
443
397
 
444
- await asyncio.sleep(0.5) # Simulate work
398
+ await asyncio.sleep(0.5)
445
399
 
446
400
  watchdog.stop_monitoring()
447
401