fix: intercept non-cli errors and allow agent to continue

This commit is contained in:
Fahad
2025-10-05 11:38:59 +04:00
parent 15ae3f24ba
commit a150e1c312
4 changed files with 190 additions and 8 deletions

View File

@@ -258,11 +258,6 @@ class CLinkTool(SimpleTool):
finally:
self._active_system_prompt = ""
def _merge_metadata(self, base: dict[str, Any] | None, extra: dict[str, Any]) -> dict[str, Any]:
merged = dict(base or {})
merged.update(extra)
return merged
def _build_success_metadata(
self,
client: ResolvedCLIClient,
@@ -286,6 +281,11 @@ class CLinkTool(SimpleTool):
metadata["raw_output_file"] = result.output_file_content
return metadata
def _merge_metadata(self, base: dict[str, Any] | None, extra: dict[str, Any]) -> dict[str, Any]:
merged = dict(base or {})
merged.update(extra)
return merged
def _build_error_metadata(self, client: ResolvedCLIClient, exc: CLIAgentError) -> dict[str, Any]:
"""Assemble metadata for failed CLI calls."""
metadata: dict[str, Any] = {