@@ -94,24 +94,38 @@ def github_triage(
9494 print (f"[red]PraisonAIAgents SDK not found: { e } [/red]" )
9595 raise typer .Exit (1 )
9696
97+ import threading
9798 bus = get_default_bus ()
9899 agent_logs = []
99100 last_update_time = [time .time ()]
101+ update_timer = [None ]
100102
101- def async_update_comment ():
102- # Software debouncer to prevent GitHub API rate limit (5 second throttle)
103- if time .time () - last_update_time [0 ] < 5.0 :
104- return
105- last_update_time [0 ] = time .time ()
106-
103+ def _sync_push_comment ():
107104 md_body = f"🚀 **PraisonAI is working**...\n { run_url } \n \n "
108- for log in agent_logs [- 10 :]: # keep last 10 steps to avoid massive comment
105+ for log in agent_logs [- 15 :]: # keep last 15 steps
109106 md_body += f"- { log } \n "
110107
111108 try :
112109 fetch_github_api (f"{ api_base } /issues/comments/{ comment_id } " , token = token , method = "PATCH" , data = {"body" : md_body })
113110 except :
114111 pass
112+ finally :
113+ last_update_time [0 ] = time .time ()
114+ update_timer [0 ] = None
115+
116+ def trigger_comment_update ():
117+ if update_timer [0 ] is not None :
118+ return # already scheduled
119+
120+ elapsed = time .time () - last_update_time [0 ]
121+ if elapsed >= 3.0 :
122+ # Execute inline if throttle expired
123+ _sync_push_comment ()
124+ else :
125+ # Schedule deferred update
126+ delay = 3.0 - elapsed
127+ update_timer [0 ] = threading .Timer (delay , _sync_push_comment )
128+ update_timer [0 ].start ()
115129
116130 async def track_agent_step (event ):
117131 try :
@@ -122,8 +136,8 @@ async def track_agent_step(event):
122136 elif event .type == "agent_complete" :
123137 agent_logs .append (f"✅ Agent completed: { event .data .get ('agent_name' )} " )
124138 else :
125- agent_logs . append ( f"🔄 Executing: { event . type } " )
126- async_update_comment ()
139+ return # skip spam
140+ trigger_comment_update ()
127141 except :
128142 pass
129143
@@ -136,7 +150,7 @@ async def track_agent_step(event):
136150 import sys
137151
138152 original_argv = sys .argv
139- sys .argv = ['praisonai' , 'workflow' , 'run' , agent_file ]
153+ sys .argv = ['praisonai' , 'workflow' , 'run' , agent_file , '--var' , f'ISSUE_NUMBER= { issue } ' ]
140154 try :
141155 praison = PraisonAI ()
142156 praison .main ()
0 commit comments