Intent: an agent that sends a bad limit is told so, the way pageParams and keyedWindow in src/http/api.ts already do.
Today: GET /api/v1/repos?limit=abc and ?limit=-1 answer 200 with a default page, because listQuery (src/http/api.ts:822) and repoQuery (:921) and GET /api/v1/fleet/ops (:3025) pass Number(q.get("limit")) to pageLimit (src/core/issues.ts:426), which clamps NaN, 0, negatives and 9999 without a word.
Done looks like:
[ ] GET /api/v1/repos, /api/v1/users/:username/repos, /api/v1/repos/:owner/:name/pulls (and every other caller of listQuery/repoQuery) and /api/v1/fleet/ops answer 422 {"error":"invalid_limit","message":"limit is a whole number from 1 to 200"} for limit=abc, limit=0, limit=-1, limit=1.5, limit=201.
[ ] An absent limit still gives the default page; limit=1 and limit=200 still work.
[ ] One shared reader of ?limit= in src/http/api.ts, the one pageParams already uses, not a fourth copy.
[ ] The OpenAPI contract names the 422 on these routes if it lists responses per route.
[ ] Tests in the existing API test file for repos list: each bad value is 422, the bounds pass.
Files: src/http/api.ts, its test. Do not touch /api/v1/search (#8485 owns it) or the MCP tools that call pageLimit.
Risk: a caller in the repo sending limit=500 today gets clamped; grep src/web and scripts for such calls and fix them in the same pull.
Intent: an agent that sends a bad
limitis told so, the waypageParamsandkeyedWindowin src/http/api.ts already do.Today: GET /api/v1/repos?limit=abc and ?limit=-1 answer 200 with a default page, because
listQuery(src/http/api.ts:822) andrepoQuery(:921) and GET /api/v1/fleet/ops (:3025) passNumber(q.get("limit"))topageLimit(src/core/issues.ts:426), which clamps NaN, 0, negatives and 9999 without a word.Done looks like:
listQuery/repoQuery) and /api/v1/fleet/ops answer 422{"error":"invalid_limit","message":"limit is a whole number from 1 to 200"}forlimit=abc,limit=0,limit=-1,limit=1.5,limit=201.limitstill gives the default page;limit=1andlimit=200still work.?limit=in src/http/api.ts, the onepageParamsalready uses, not a fourth copy.Files: src/http/api.ts, its test. Do not touch /api/v1/search (#8485 owns it) or the MCP tools that call
pageLimit. Risk: a caller in the repo sending limit=500 today gets clamped; grep src/web and scripts for such calls and fix them in the same pull.