-
Notifications
You must be signed in to change notification settings - Fork 553
[Bug]: Oversized search limits return HTTP 500 instead of validation errors #5041
Copy link
Copy link
Closed
Closed
Copy link
Labels
api-compliance-testTriggers an API compliance test on the labeled PRTriggers an API compliance test on the labeled PRbugSomething isn't workingSomething isn't workingpriority:mediumFor bugs, a serious source of annoyance, but not blocking a large number of users.For bugs, a serious source of annoyance, but not blocking a large number of users.ready-for-devIssue meets development readiness criteriaIssue meets development readiness criteriarelease-note-requiredPR requires explicit release-note coverage for behavioral or default changesPR requires explicit release-note coverage for behavioral or default changes
Description
Activity
Metadata
Metadata
Assignees
Labels
api-compliance-testTriggers an API compliance test on the labeled PRTriggers an API compliance test on the labeled PRbugSomething isn't workingSomething isn't workingpriority:mediumFor bugs, a serious source of annoyance, but not blocking a large number of users.For bugs, a serious source of annoyance, but not blocking a large number of users.ready-for-devIssue meets development readiness criteriaIssue meets development readiness criteriarelease-note-requiredPR requires explicit release-note coverage for behavioral or default changesPR requires explicit release-note coverage for behavioral or default changes
Bug Description
Four Agent Server search endpoints declare
Query(gt=0, lte=100)for theirlimitparameter. The supported upper-bound keyword isle, so FastAPI does not enforce the intended maximum. A request withlimit=101reachesassert limit <= 100and returns HTTP 500. The generated OpenAPI schema also omitsmaximum: 100.Affected endpoints:
GET /api/conversations/searchGET /api/conversations/{conversation_id}/events/searchGET /api/bash/bash_events/searchGET /api/file/search_subdirsActual Behavior
On upstream main at
b5c8ab950401996f171b29c076900fa22fc80e21, runmake build, then reproduce without an LLM or a running server:Observed status codes:
The limit schema contains
lte: 100instead ofmaximum: 100. The other three handlers use the same misspelled constraint and upper-bound assertion. Oversized page requests therefore appear to clients and monitoring as server failures.Expected Behavior
Requests outside the existing range of 1 through 100 return HTTP 422 with a validation error for the
limitquery parameter. Valid requests keep working, and OpenAPI publishes the maximum of 100.Acceptance Criteria
maximum: 100and an exclusive minimum of 0 for thelimitquery parameter.limit=0orlimit=101return HTTP 422 instead of reaching an assertion in the handler.limit=100remain valid.Installation Method
Source checkout with
make build/uv sync --dev.SDK Version
Upstream main at
b5c8ab950401996f171b29c076900fa22fc80e21(1.47.0).Python Version
3.13.11.
Screenshots and Additional Context
PR #4991 implements this fix. PR #5032 adds the narrowly scoped REST compatibility-check exception for publishing the already enforced upper bound.