From 81fdf3153e1a9b124427b73c9ad85827788f3f38 Mon Sep 17 00:00:00 2001 From: wishhyt <24300810017@m.fudan.edu.cn> Date: Wed, 18 Mar 2026 10:32:32 +0800 Subject: [PATCH] fix: raise HTTPException instead of returning it in Gerrit server In `handle_gerrit_request`, `HTTPException` was returned instead of raised when `item.msg` is empty for an ask action. FastAPI requires exceptions to be raised to produce proper HTTP error responses. Returning the exception object results in a 200 status with the exception serialized as the response body, and execution continues past the guard into `handle_request` with an empty message. Made-with: Cursor --- pr_agent/servers/gerrit_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr_agent/servers/gerrit_server.py b/pr_agent/servers/gerrit_server.py index 1783f6b994..e61220318c 100644 --- a/pr_agent/servers/gerrit_server.py +++ b/pr_agent/servers/gerrit_server.py @@ -39,7 +39,7 @@ async def handle_gerrit_request(action: Action, item: Item): if action == Action.ask: if not item.msg: - return HTTPException( + raise HTTPException( status_code=400, detail="msg is required for ask command" )