From 0fae341d2f9f4c20d689eb8119defc3fb3d5e2e9 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 7 Mar 2026 01:28:07 -0500 Subject: [PATCH] fix(ai_client): add patch_callback param to _send_gemini_cli signature --- conductor/tracks.md | 2 +- .../tracks/tier4_auto_patching_20260306/plan.md | 12 ++++++------ project_history.toml | 2 +- src/ai_client.py | 3 ++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/conductor/tracks.md b/conductor/tracks.md index 615d218..f60137d 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -26,7 +26,7 @@ This file tracks all major tracks for the project. Each track has its own detail 3. [x] **Track: Visual DAG & Interactive Ticket Editing** *Link: [./tracks/visual_dag_ticket_editing_20260306/](./tracks/visual_dag_ticket_editing_20260306/)* -4. [~] **Track: Advanced Tier 4 QA Auto-Patching** +4. [x] **Track: Advanced Tier 4 QA Auto-Patching** *Link: [./tracks/tier4_auto_patching_20260306/](./tracks/tier4_auto_patching_20260306/)* 5. [ ] **Track: Transitioning to Native Orchestrator** diff --git a/conductor/tracks/tier4_auto_patching_20260306/plan.md b/conductor/tracks/tier4_auto_patching_20260306/plan.md index c6beb0a..43bad61 100644 --- a/conductor/tracks/tier4_auto_patching_20260306/plan.md +++ b/conductor/tracks/tier4_auto_patching_20260306/plan.md @@ -37,7 +37,7 @@ Focus: Generate unified diff on test failure ## Phase 2: Diff Viewer UI Focus: Display side-by-side diff -- [ ] Task 2.1: Parse unified diff +- [x] Task 2.1: Parse unified diff - WHERE: `src/gui_2.py` or new `src/diff_viewer.py` - WHAT: Parse diff into hunks - HOW: @@ -55,7 +55,7 @@ Focus: Display side-by-side diff return hunks ``` -- [ ] Task 2.2: Render diff viewer +- [x] Task 2.2: Render diff viewer - WHERE: `src/gui_2.py` - WHAT: Color-coded diff display - HOW: @@ -73,7 +73,7 @@ Focus: Display side-by-side diff ## Phase 3: Patch Application Focus: Apply patch with backup -- [ ] Task 3.1: Create backup before apply +- [x] Task 3.1: Create backup before apply - WHERE: `src/gui_2.py` or `src/mcp_client.py` - WHAT: Backup file to .backup - HOW: @@ -83,7 +83,7 @@ Focus: Apply patch with backup shutil.copy(file_path, backup_path) ``` -- [ ] Task 3.2: Apply patch +- [x] Task 3.2: Apply patch - WHERE: `src/gui_2.py` - WHAT: Use patch command or difflib - HOW: @@ -92,7 +92,7 @@ Focus: Apply patch with backup result = subprocess.run(["patch", "-p1"], input=diff_text, capture_output=True, text=True) ``` -- [ ] Task 3.3: Restore on failure +- [x] Task 3.3: Restore on failure - WHERE: `src/gui_2.py` - WHAT: Restore from backup if patch fails - HOW: `shutil.copy(backup_path, file_path)` @@ -100,7 +100,7 @@ Focus: Apply patch with backup ## Phase 4: Modal UI Focus: Approval modal for patches -- [ ] Task 4.1: Create patch approval modal +- [x] Task 4.1: Create patch approval modal - WHERE: `src/gui_2.py` - WHAT: Modal with diff preview and Apply/Reject buttons - HOW: diff --git a/project_history.toml b/project_history.toml index 94a6d0e..66bce8d 100644 --- a/project_history.toml +++ b/project_history.toml @@ -8,5 +8,5 @@ active = "main" [discussions.main] git_commit = "" -last_updated = "2026-03-06T23:54:22" +last_updated = "2026-03-07T01:19:03" history = [] diff --git a/src/ai_client.py b/src/ai_client.py index e3320db..c081a74 100644 --- a/src/ai_client.py +++ b/src/ai_client.py @@ -1019,7 +1019,8 @@ def _send_gemini_cli(md_content: str, user_message: str, base_dir: str, discussion_history: str = "", pre_tool_callback: Optional[Callable[[str, str, Optional[Callable[[str], str]]], Optional[str]]] = None, qa_callback: Optional[Callable[[str], str]] = None, - stream_callback: Optional[Callable[[str], None]] = None) -> str: + stream_callback: Optional[Callable[[str], None]] = None, + patch_callback: Optional[Callable[[str, str], Optional[str]]] = None) -> str: global _gemini_cli_adapter sys.stderr.write(f"[DEBUG] _send_gemini_cli running in module {__name__}, adapter is {_gemini_cli_adapter}\n") sys.stderr.flush()