Skip to content

Commit aa5f04f

Browse files
Merge pull request #3086 from stbenjam/test-details-prompt
TRT-2393: fix(chat): prevent LLM from modifying test_details URL parameters
2 parents f78f207 + f34a5cb commit aa5f04f

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

chat/sippy_agent/tools/sippy_test_details.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SippyTestDetailsTool(SippyBaseTool):
1919

2020
name: str = "get_test_details_report"
2121
description: str = """Get a test details report from Sippy API including regression analysis and statistics.
22-
22+
2323
This tool provides:
2424
- Regression status and history
2525
- Sample vs base statistics comparison
@@ -31,13 +31,13 @@ class SippyTestDetailsTool(SippyBaseTool):
3131
- Triage information
3232
- Pass rate changes
3333
34-
Input: query_params (the query parameters for the test details endpoint, e.g., testId=12345&component=...&baseRelease=...)"""
34+
Input: url (the test details URL, passed verbatim without modification)"""
3535

3636
# Add sippy_api_url as a proper field
3737
sippy_api_url: Optional[str] = Field(default=None, description="Sippy API base URL")
3838

3939
class TestDetailsInput(SippyToolInput):
40-
query_params: str = Field(description="Query parameters for the test details endpoint. Can be either just the query params (e.g., testId=12345&component=foo) or a full URL (the query params will be extracted)")
40+
url: str = Field(description="The test details URL. Pass the URL exactly as provided without any modifications.")
4141

4242
args_schema: Type[SippyToolInput] = TestDetailsInput
4343

@@ -60,17 +60,20 @@ def _run(self, *args, **kwargs: Any) -> Dict[str, Any]:
6060
"error": "No Sippy API URL configured. Please set SIPPY_API_URL environment variable."
6161
}
6262

63-
# Build the full URL from query params
64-
query_params = args.query_params.strip()
65-
66-
# If query_params is a full URL, extract just the query string
67-
if query_params.startswith('http') or query_params.startswith('/'):
63+
# Build the full URL from the provided URL/query params
64+
url_input = args.url.strip()
65+
66+
# If url_input is a full URL, extract just the query string
67+
if url_input.startswith('http') or url_input.startswith('/'):
6868
# Extract query params from URL
69-
if '?' in query_params:
70-
query_params = query_params.split('?', 1)[1]
69+
if '?' in url_input:
70+
query_params = url_input.split('?', 1)[1]
7171
else:
72-
return {"error": f"No query parameters found in URL: {query_params}"}
73-
72+
return {"error": f"No query parameters found in URL: {url_input}"}
73+
else:
74+
# It's just query params
75+
query_params = url_input
76+
7477
# Ensure query params don't start with ? or &
7578
if query_params.startswith('?') or query_params.startswith('&'):
7679
query_params = query_params[1:]

0 commit comments

Comments
 (0)