fix: improved error reporting; codex cli would at times fail to figure out how to handle plain-text / JSON errors

fix: working directory should exist, raise error and not try and create one
docs: improved API Lookup instructions
* test added to confirm failures
* chat schema more explicit about file paths
This commit is contained in:
Fahad
2025-10-17 23:42:32 +04:00
parent 71796c0c70
commit 95e69a7cb2
24 changed files with 569 additions and 337 deletions

View File

@@ -17,6 +17,7 @@ if TYPE_CHECKING:
from config import TEMPERATURE_ANALYTICAL
from tools.shared.base_models import ToolRequest
from tools.shared.exceptions import ToolExecutionError
from .simple.base import SimpleTool
@@ -138,6 +139,8 @@ class ChallengeTool(SimpleTool):
return [TextContent(type="text", text=json.dumps(response_data, indent=2, ensure_ascii=False))]
except ToolExecutionError:
raise
except Exception as e:
import logging
@@ -150,7 +153,7 @@ class ChallengeTool(SimpleTool):
"content": f"Failed to create challenge prompt: {str(e)}",
}
return [TextContent(type="text", text=json.dumps(error_data, ensure_ascii=False))]
raise ToolExecutionError(json.dumps(error_data, ensure_ascii=False)) from e
def _wrap_prompt_for_challenge(self, prompt: str) -> str:
"""