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

@@ -12,6 +12,7 @@ from unittest.mock import patch
import pytest
from tools.challenge import ChallengeRequest, ChallengeTool
from tools.shared.exceptions import ToolExecutionError
class TestChallengeTool:
@@ -110,10 +111,10 @@ class TestChallengeTool:
"""Test error handling in execute method"""
# Test with invalid arguments (non-dict)
with patch.object(self.tool, "get_request_model", side_effect=Exception("Test error")):
result = await self.tool.execute({"prompt": "test"})
with pytest.raises(ToolExecutionError) as exc_info:
await self.tool.execute({"prompt": "test"})
assert len(result) == 1
response_data = json.loads(result[0].text)
response_data = json.loads(exc_info.value.payload)
assert response_data["status"] == "error"
assert "Test error" in response_data["error"]