Launch comment handler agent to make targeted improvements. Args: idea: Full idea specification with comments work_dir: Working directory (existing workspace) provider: AI provider (claude, codex, gemini) templates_dir: Path to templates directory (auto-dete
(
idea: Dict[str, Any],
work_dir: Path,
provider: str = "claude",
templates_dir: Optional[Path] = None,
timeout: int = 1800, # 30 minutes default
full_permissions: bool = True
)
| 161 | """ |
| 162 | Launch comment handler agent to make targeted improvements. |
| 163 | |
| 164 | Args: |
| 165 | idea: Full idea specification with comments |
| 166 | work_dir: Working directory (existing workspace) |
| 167 | provider: AI provider (claude, codex, gemini) |
| 168 | templates_dir: Path to templates directory (auto-detected if None) |
| 169 | timeout: Maximum execution time in seconds (default: 30 min) |
| 170 | full_permissions: Allow full permissions to CLI agents (default: True) |
| 171 | |
| 172 | Returns: |
| 173 | Dictionary with: |
| 174 | - success: Boolean indicating if task completed |
| 175 | - log_file: Path to log file |
| 176 | - transcript_file: Path to transcript file |
| 177 | - elapsed_time: Time taken in seconds |
| 178 | |
| 179 | Raises: |
| 180 | ValueError: If provider not supported or comments not found |
| 181 | """ |
| 182 | if provider not in CLI_COMMANDS: |
| 183 | raise ValueError(f"Unsupported provider: {provider}. Choose from: {list(CLI_COMMANDS.keys())}") |
| 184 | |
| 185 | # Validate that comments exist |
| 186 | idea_spec = idea.get('idea', idea) |
| 187 | comments = idea_spec.get('comments') |
| 188 | if not comments: |
| 189 | raise ValueError("No comments found in idea specification. Add 'comments:' field to the idea YAML.") |
| 190 | |
| 191 | # Auto-detect templates directory if not provided |
| 192 | if templates_dir is None: |
| 193 | templates_dir = Path(__file__).parent.parent.parent / "templates" |
| 194 | |
| 195 | title = idea_spec.get('title', 'Unknown') |
| 196 | |
| 197 | print(f"\n{'='*80}") |
| 198 | print("COMMENT MODE - Targeted Improvements") |
| 199 | print(f"{'='*80}") |
| 200 | print(f" Title: {title}") |
| 201 | print(f" Provider: {provider}") |
| 202 | print(f" Work dir: {work_dir}") |
| 203 | print(f" Timeout: {timeout}s ({timeout//60} minutes)") |
| 204 | print() |
| 205 | print("User Comments:") |
| 206 | print("-" * 40) |
| 207 | # Print first 500 chars of comments |
| 208 | preview = comments[:500] + "..." if len(comments) > 500 else comments |
| 209 | print(preview) |
| 210 | print("-" * 40) |
| 211 | print() |
| 212 | |
| 213 | from core.dsi_slurm_remote import dsi_slurm_remote_workspace |
| 214 | |
| 215 | with dsi_slurm_remote_workspace(idea, work_dir) as dsi_remote_info: |
| 216 | if dsi_remote_info is not None: |
| 217 | print(f"DSI remote workspace: {dsi_remote_info['remote_root']}") |
| 218 | return _run_comment_handler_with_remote_workspace( |
| 219 | idea=idea, |
| 220 | work_dir=work_dir, |
no test coverage detected