@@ -73,7 +73,11 @@ def _display_review_request(data: Dict[str, Any]) -> None:
7373
7474 # Task information
7575 console .print (f"[bold]Task ID:[/bold] { task_id } " )
76- console .print (f"[bold]Description:[/bold] { task_desc } " )
76+ # Show task description as rendered markdown in a panel for better readability
77+ if task_desc :
78+ # Truncate description for display but show more than before
79+ desc_display = task_desc [:1500 ] if len (task_desc ) > 1500 else task_desc
80+ console .print (Panel (Markdown (desc_display ), title = "Task Description" , border_style = "blue" ))
7781 console .print ()
7882
7983 # Execution result
@@ -90,6 +94,17 @@ def _display_review_request(data: Dict[str, Any]) -> None:
9094 console .print (f"[red]Error:[/red] { execution_result ['error' ][:200 ]} " )
9195 console .print ()
9296
97+ # Agent output (what the agent actually did/found)
98+ agent_output = execution_result .get ("output" , "" )
99+ if agent_output :
100+ console .print ("[bold cyan]═══ Agent Output ═══[/bold cyan]" )
101+ console .print ()
102+ # Show full output - user can scroll
103+ console .print (Markdown (agent_output ))
104+ console .print ()
105+ console .print ("[bold cyan]═══ End of Agent Output ═══[/bold cyan]" )
106+ console .print ()
107+
93108 # Files changed
94109 if files_changed :
95110 console .print (f"[bold]Files Changed ({ len (files_changed )} ):[/bold]" )
@@ -218,46 +233,105 @@ def collect_response(interrupt_data: Dict[str, Any]) -> Dict[str, Any]:
218233 interrupt_type = interrupt_data .get ("type" , "unknown" )
219234
220235 if interrupt_type == "review" :
221- return _collect_review_response ()
236+ return _collect_review_response (interrupt_data )
222237 elif interrupt_type == "question" :
223238 return _collect_question_response (interrupt_data )
224239 else :
225240 console .print (f"[red]Unknown interrupt type: { interrupt_type } [/red]" )
226241 return {"error" : f"Unknown interrupt type: { interrupt_type } " }
227242
228243
229- def _collect_review_response () -> Dict [str , Any ]:
244+ def _collect_review_response (data : Dict [ str , Any ] ) -> Dict [str , Any ]:
230245 """
231246 Collect user's review decision.
232247
233248 Returns:
234249 Dictionary with approved, retry, feedback fields
235250 """
251+ # Check if there are actual code changes
252+ files_changed = data .get ("files_changed" , [])
253+ diff_content = data .get ("diff_content" , "" )
254+ has_code_changes = bool (files_changed ) or bool (diff_content )
255+
256+ # Check if agent is asking a follow-up question
257+ agent_output = data .get ("execution_result" , {}).get ("output" , "" )
258+ asking_followup = any (phrase in agent_output .lower () for phrase in [
259+ "would you like me to" ,
260+ "shall i" ,
261+ "do you want me to" ,
262+ "next steps:" ,
263+ "what would you like" ,
264+ ])
265+
236266 console .print ("[bold yellow]What would you like to do?[/bold yellow]" )
237- console .print (" 1. Approve - Accept the implementation and commit" )
238- console .print (" 2. Retry - Request changes and re-run implementation" )
239- console .print (" 3. Skip - Skip this task and move on" )
240- console .print ()
241267
242- choice = Prompt .ask (
243- "Enter your choice" ,
244- choices = ["1" , "2" , "3" , "approve" , "retry" , "skip" ],
245- default = "1" ,
246- )
268+ if has_code_changes :
269+ console .print (" 1. Approve - Accept the changes and commit" )
270+ console .print (" 2. Retry - Request changes and re-run" )
271+ console .print (" 3. Skip - Skip this task and move on" )
272+ console .print (" 4. Continue - Mark complete and move to next task (no commit)" )
273+ else :
274+ # No code changes - likely an investigation or analysis task
275+ console .print (" 1. Continue - Mark task complete and move to next task" )
276+ console .print (" 2. Retry - Re-run with different instructions" )
277+ console .print (" 3. Skip - Skip this task" )
278+ if asking_followup :
279+ console .print (" 4. Respond - Answer the agent's question" )
280+ console .print ()
247281
248- # Normalize choice
249- if choice in ["1" , "approve" ]:
250- approved = True
251- retry = False
252- action = "approved"
253- elif choice in ["2" , "retry" ]:
254- approved = False
255- retry = True
256- action = "retry requested"
257- else : # 3 or skip
258- approved = False
259- retry = False
260- action = "skipped"
282+ if has_code_changes :
283+ choices = ["1" , "2" , "3" , "4" , "approve" , "retry" , "skip" , "continue" ]
284+ default = "1"
285+ else :
286+ choices = ["1" , "2" , "3" , "continue" , "retry" , "skip" ]
287+ if asking_followup :
288+ choices .extend (["4" , "respond" ])
289+ default = "1"
290+
291+ choice = Prompt .ask ("Enter your choice" , choices = choices , default = default )
292+
293+ # Normalize choice based on context
294+ if has_code_changes :
295+ if choice in ["1" , "approve" ]:
296+ approved = True
297+ retry = False
298+ action = "approved"
299+ elif choice in ["2" , "retry" ]:
300+ approved = False
301+ retry = True
302+ action = "retry requested"
303+ elif choice in ["4" , "continue" ]:
304+ approved = True # Mark as complete
305+ retry = False
306+ action = "continued (no commit)"
307+ else : # 3 or skip
308+ approved = False
309+ retry = False
310+ action = "skipped"
311+ else :
312+ if choice in ["1" , "continue" ]:
313+ approved = True
314+ retry = False
315+ action = "completed"
316+ elif choice in ["2" , "retry" ]:
317+ approved = False
318+ retry = True
319+ action = "retry requested"
320+ elif choice in ["4" , "respond" ] and asking_followup :
321+ # User wants to respond to agent's question
322+ console .print ()
323+ console .print ("[bold]Enter your response to the agent:[/bold]" )
324+ response_text = Prompt .ask ("Response" )
325+ return {
326+ "approved" : False ,
327+ "retry" : True ,
328+ "feedback" : response_text ,
329+ "modified_value" : None ,
330+ }
331+ else : # 3 or skip
332+ approved = False
333+ retry = False
334+ action = "skipped"
261335
262336 # Collect optional feedback
263337 console .print ()
0 commit comments