Skip to content

mcpx(daemon): six handlers silently discard invalid numeric query params — ?limit=banana returns 200 with the default-sized result, indistinguishable from a valid request #3485

Closed

Description

@dezren39

mcpx(daemon): six handlers silently discard invalid numeric query params — ?limit=banana returns 200 with the default-sized result, indistinguishable from a valid request

Evidence (verified this run, main 69632f23)

Six /v1 handlers parse a numeric query parameter with strconv.Atoi and discard the error (limit, _ := / top, _ := / budget, _ :=). A parse failure yields 0, which each handler then replaces with its configured default — so a present-but-invalid value is silently treated as absent:

Route Param Site
GET /v1/log limit pkgs/mcpx/internal/daemon/ops.go:131
GET /v1/stats top pkgs/mcpx/internal/daemon/ops.go:203
GET /v1/registry/search limit pkgs/mcpx/internal/daemon/ops.go:278
GET /v1/recipes?q=… limit pkgs/mcpx/internal/daemon/routes_consumer.go:157
GET /v1/search limit pkgs/mcpx/internal/daemon/server.go:941
GET /v1/catalog budget pkgs/mcpx/internal/daemon/server.go:988

Verified with a probe on the laptop (test file pkgs/mcpx/internal/daemon/probe_laneA_test.go in worktree ~/git/fleet/probe-2026-11-01-laneA-mcpxlimit/; ops.go/server.go/routes_consumer.go md5-identical to this main — 187cd534/d1d900c9/f1b056c6; real handlers via httptest, empty store; go test PASS, log in the probe dir):

  • GET /v1/log?limit=5 (control) → 200 {"records":[]}
  • GET /v1/log?limit=banana → 200 {"records":[]} — identical to the control
  • GET /v1/log?limit=2.7 → 200; ?limit=1e3 → 200
  • GET /v1/log?since=banana (same handler, contrast) → 400 naming the bad value — the handler already rejects one invalid parameter and silently defaults another
  • GET /v1/stats?top=5 (control) → 200; ?top=banana → 200; ?top=2.7 → 200

Why it matters

This is the exact silent-drop shape the daemon has already ruled against twice: #1679 made a malformed since/Last-Event-ID on /v1/events a 400 naming the parameter, and #2223 (closed) did the same for minScore/maxScore/limit/offset on /v1/interactions, with the comment in routes_feedback.go recording the rule: "silently dropping a bound made a typo'd minScore return the unfiltered list with 200 … both read as real answers." A caller who typos limit/top/budget on these six routes still gets a real-looking 200 answer computed with a different bound than the one they asked for — a truncated-looking result set, a stats table aggregated over the default top-N, or a catalog built to the default budget — with no signal anything was ignored.

Negative values have the same fate today (limit=-5 on /v1/log reaches logstore as a non-positive limit and becomes the default there), so the fix should state the rule for them rather than leaving a second silent path.

Acceptance criteria

  • A present-but-unparseable numeric parameter on all six routes above is a 400 naming the parameter and the bad value (the parseIntParam shape already in routes_feedback.go, ideally factored so the handlers share one helper).
  • Absent parameter behaviour is unchanged: the configured default applies, exactly as today.
  • Valid values behave exactly as today, including the existing clamping/defaulting for 0 and negative values — or, if a negative is also made a 400, that is stated in the PR and pinned by a test (no silent change either way).
  • Regression tests per route (handler-level, following events_cursor_test.go / routes_feedback_test.go): invalid spellings (banana, 2.7, 1e3) → 400; absent → 200 with default; valid → 200.
  • No other query parameters or routes change behaviour.

Distinct from: #2223 (closed; /v1/interactions only — its fix did not touch these six handlers), #1679 (closed; /v1/events cursors), #2878 (/v1/complete value cap, different mechanism).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 1, 2026
  2. developing-today commented on Nov 1, 2026

    @developing-today
    Contributor
  3. added
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  4. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  6. 22 remaining items

  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked awaiting CI

  8. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    {"schema":"agent-note:v1","type":"status","stage":"done","task_id":6124,"lane":"code-d","worker":"repo-worker-code","note":"Merged on resume: PR #4429 (squash a3a15ba) - invalid numeric query params now return 400 naming parameter/value on all six mcpx daemon routes, with the registry-driven guard test. Codex: the one P1 finding was fixed in head 0652386 and replied on-thread; the Codex re-review of that head completed with no issues. The manual mcpx-test run 41494828805 was still queued on the known runner backlog at merge time; merge proceeded per standing merge authority (diff verified, Codex clean, prior local daemon tests passed per task 6124 checkpoint)."}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions