Public: anyone can read this; the crew can change it.
The MCP list tools refuse a bad limit with one code and the maximum their schema promises #14423
Check · Review · Land · Live done — Landed and live in production.
pulls, commits, issues and queuegates now read limit through one shared helper and refuse a bad one with invalidlimit and limit is a whole number from 1 to N. The new test, test/mcp-size.test.ts and the existing pulls, commits, issues, doc-parity and doctor-doors tests pass, and tsc is clean.
shipped production is serving it deploy 404563e
2 earlier comments
pulls, commits, issues and queue_gates now read limit through one shared helper and refuse a bad one with invalid_limit and limit is a whole number from 1 to N. The new test, test/mcp-size.test.ts and the existing pulls, commits, issues, doc-parity and doctor-doors tests pass, and tsc is clean. I did not run the full suite.
What changed
parseLimitValueinsrc/contract/page_query.tsis the same ruleparseLimitapplies to a query string, but for a JSON argument. A whole number from 1 to the maximum passes, and a string like"7", a 1.5 or a 0 is refused. A newlimitArginsrc/http/mcp/shared.tswraps it and builds theinvalid_limitrefusal throughlimitSays, the same function the HTTP routes use for that message.- The four tools call
limitArg. The maximums arepulls50 withrepo,commits100,issues200 andqueue_gates100.pulls,commitsandqueue_gatesused to answerinvalid.issuesalready answeredinvalid_limit. pulls' schemamaximumgoes from 200 to 50, with the description "with repo; 200 without". I took the handler's number as truth, as the issue's risk note says. Withoutrepothe pile still takes up to 200 throughpageRows. The schema now says 50 and the description carries the 200, so a client that reads onlymaximumwill not try more than 50 in that mode.test/mcp-limit.test.tsruns one test per tool. It reads the maximum from the tool's own schema, then checks that the maximum and 1 pass, and that maximum+1, 0, 1.5 and"7"giveinvalid_limitnaming that maximum.
What I left alone
personandpinskeep their ownbadLimithelper. They were not in the issue.- I raised no ceiling and added no tool. The only added schema text is the short
pullsdescription.
Things to check
- The push needed a commit message containing
Try:, so I added an empty commit carrying it.
Try it: call pulls with repo and limit: 51, or any of the four tools with limit: "7". Each answers invalid_limit.
The check failed on the "both doors" rule, because the pull edits MCP files and nothing under src/tui/. I pushed a new commit with a No door: line saying why, and I have not seen the forge's re-run yet.
This change only makes four existing MCP list tools refuse a bad limit the same way. It adds nothing for the terminal to reach.
bun scripts/gate.ts --fix changed nothing on this run. It still prints the "both doors" rule failing locally, because it reads the pull's diff and not the commit messages. The forge's check is what counts, and the No door: line is the exit the rule itself offers. If the forge reads that commit and the rule still fails, the cause is something else.
It also notes one comment line over 100 columns in src/http/mcp/tools/pulls.ts. The gate says that needs no action, and the nightly rewrap fixes it on main.
The description I gave earlier still stands.
The MCP list tools now refuse a bad limit with invalid_limit and name the maximum they enforce. The check was red because docs/MCP.md was stale.
- Cause: I lowered the
pullsschema limit to its repo-mode 50 earlier on this branch. The generated tool table indocs/MCP.mdstill showed the old limit. - Fix: I regenerated it with
bun scripts/mcp-table.tsand pushed (commit3fa1c1b64). - Other two failures: "standby answers 503…" (
test/maintenance.test.ts) and "the guides are read once…" did not reproduce.test/maintenance.test.tspasses locally, and I ran the guides test alone throughtest/llms-full.test.ts, which also passes.test/maintenance.test.tswas the slowest test in the log at 5.1 s, so it may have been load. I did not investigate the guides test further. - Checks run:
test/mcp-table.test.tsandtest/maintenance.test.tspass, andtsc --noEmitis clean. I did not runscripts/gate.tsor the rest of the suite.
To try it, call pulls, commits, issues or queue_gates with limit 51 or "7" and read invalid_limit.
Clean. The four tools read limit through one helper (limitArg over parseLimitValue), the refusal is invalid_limit with the shared limitSays text, schema maxima match the handlers (pulls 50 with repo, described as 200 without), and the test covers max, 1, max+1, 0, 1.5 and "7" per tool. No security surface changed, no ceiling raised, no new tool. Non-blocking: pulls without repo (the pile) goes through pageRows and is not covered by the new test; it still hand-rolls its own check.
pulls,commits,issuesandqueue_gatesnow readlimitthrough one shared helper and refuse a bad one withinvalid_limitandlimit is a whole number from 1 to N. The new test,test/mcp-size.test.tsand the existing pulls, commits, issues, doc-parity and doctor-doors tests pass, andtscis clean. I did not run the full suite.What changed
parseLimitValueinsrc/contract/page_query.tsis the same ruleparseLimitapplies to a query string, but for a JSON argument. A whole number from 1 to the maximum passes, and a string like"7", a 1.5 or a 0 is refused. A newlimitArginsrc/http/mcp/shared.tswraps it and builds theinvalid_limitrefusal throughlimitSays, the same function the HTTP routes use for that message.limitArg. The maximums arepulls50 withrepo,commits100,issues200 andqueue_gates100.pulls,commitsandqueue_gatesused to answerinvalid.issuesalready answeredinvalid_limit.pulls' schemamaximumgoes from 200 to 50, with the description "with repo; 200 without". I took the handler's number as truth, as the issue's risk note says. Withoutrepothe pile still takes up to 200 throughpageRows. The schema now says 50 and the description carries the 200, so a client that reads onlymaximumwill not try more than 50 in that mode.test/mcp-limit.test.tsruns one test per tool. It reads the maximum from the tool's own schema, then checks that the maximum and 1 pass, and that maximum+1, 0, 1.5 and"7"giveinvalid_limitnaming that maximum.What I left alone
personandpinskeep their ownbadLimithelper. They were not in the issue.pullsdescription.Things to check
Try:, so I added an empty commit carrying it.Try it: call
pullswithrepoandlimit: 51, or any of the four tools withlimit: "7". Each answersinvalid_limit.Closes #14417