feat(tier4): Complete GUI integration for patch modal

- Add patch modal state to AppController instead of App
- Add show_patch_modal/hide_patch_modal action handlers
- Fix push_event to work with flat payload format
- Add patch fields to _gettable_fields
- Both GUI integration tests passing
This commit is contained in:
2026-03-07 00:55:35 -05:00
parent d520d5d6c2
commit f8e1a5b405
3 changed files with 36 additions and 42 deletions

View File

@@ -137,6 +137,10 @@ class AppController:
self.active_track: Optional[models.Track] = None
self.active_tickets: List[Dict[str, Any]] = []
self.mma_streams: Dict[str, str] = {}
self._pending_patch_text: Optional[str] = None
self._pending_patch_files: List[str] = []
self._show_patch_modal: bool = False
self._patch_error_message: Optional[str] = None
self.mma_status: str = "idle"
self._tool_log: List[Dict[str, Any]] = []
self._comms_log: List[Dict[str, Any]] = []
@@ -294,7 +298,10 @@ class AppController:
'tracks': 'tracks',
'thinking_indicator': 'thinking_indicator',
'operations_live_indicator': 'operations_live_indicator',
'prior_session_indicator': 'prior_session_indicator'
'prior_session_indicator': 'prior_session_indicator',
'_show_patch_modal': '_show_patch_modal',
'_pending_patch_text': '_pending_patch_text',
'_pending_patch_files': '_pending_patch_files'
})
self._init_actions()
@@ -518,21 +525,11 @@ class AppController:
self._ask_request_id = None
self._ask_tool_data = None
elif action == "custom_callback":
sys.stderr.write(f"[DEBUG] Processing custom_callback task\n")
sys.stderr.flush()
cb = task.get("callback")
args = task.get("args", [])
if callable(cb):
try:
sys.stderr.write(f"[DEBUG] Calling callable callback\n")
sys.stderr.flush()
cb(*args)
sys.stderr.write(f"[DEBUG] Callback completed\n")
sys.stderr.flush()
except Exception as e:
sys.stderr.write(f"[DEBUG] Error in direct custom callback: {e}\n")
sys.stderr.flush()
print(f"Error in direct custom callback: {e}")
try: cb(*args)
except Exception as e: print(f"Error in direct custom callback: {e}")
elif cb in self._predefined_callbacks:
self._predefined_callbacks[cb](*args)
elif action == "mma_step_approval":
@@ -542,6 +539,14 @@ class AppController:
task["dialog_container"][0] = dlg
elif action == 'refresh_from_project':
self._refresh_from_project()
elif action == "show_patch_modal":
self._pending_patch_text = task.get("patch_text", "")
self._pending_patch_files = task.get("file_paths", [])
self._show_patch_modal = True
elif action == "hide_patch_modal":
self._show_patch_modal = False
self._pending_patch_text = None
self._pending_patch_files = []
elif action == "mma_spawn_approval":
spawn_dlg = MMASpawnApprovalDialog(
str(task.get("ticket_id") or ""),

View File

@@ -114,11 +114,6 @@ class App:
self._tool_log_dirty: bool = True
self._last_ui_focus_agent: Optional[str] = None
self._log_registry: Optional[log_registry.LogRegistry] = None
# Patch viewer state for Tier 4 auto-patching
self._pending_patch_text: Optional[str] = None
self._pending_patch_files: list[str] = []
self._show_patch_modal: bool = False
self._patch_error_message: Optional[str] = None
def _handle_approve_tool(self, user_data=None) -> None:
"""UI-level wrapper for approving a pending tool execution ask."""