Skip to content

mcpx(daemon): /v1/interactions score filters silently misbehave — a non-numeric minScore returns the unfiltered list, NaN/Inf return an empty one #2223

Closed

Description

@dezren39

mcpx(daemon): /v1/interactions score filters silently misbehave — a non-numeric minScore returns the unfiltered list, NaN/Inf return an empty one

Evidence (verified this run, main 319e6c21)

pkgs/mcpx/internal/daemon/routes_feedback.go:95-115 (handleInteractionsList, GET /v1/interactions):

if minStr := q.Get("minScore"); minStr != "" {
    if val, err := strconv.ParseFloat(minStr, 64); err == nil {
        filter.MinScore = &val
    }
}
if maxStr := q.Get("maxScore"); maxStr != "" {
    if val, err := strconv.ParseFloat(maxStr, 64); err == nil {
        filter.MaxScore = &val
    }
}

A parse failure leaves the filter unset and the handler returns 200 with the
unfiltered list — the caller asked for a score band and silently got
everything. A parse success is not safe either: Go's ParseFloat accepts
NaN, Inf, +Inf, -Inf, and the filter is passed straight into
pkgs/mcpx/internal/logstore/feedback.go:303-310 (score >= ? / score <= ?
against SQLite, modernc driver). SQLite treats a NaN bound as NULL, so every
comparison is NULL and no row matches; +Inf as a minimum likewise
matches nothing.

Verified with a probe on the laptop (test file
pkgs/mcpx/internal/logstore/probe_laneB_test.go in worktree
~/git/fleet/probe-2026-10-29-laneB-feedback-wt/, whose feedback.go /
routes_feedback.go are md5-identical to this main; real
logstore.FeedbackStore, 3 seeded interactions scored 0.2 / 0.5 / 0.9,
handler parse block replicated verbatim; go test PASS):

  • no filter → 3 rows; minScore=0.4 (control) → 2 rows
  • minScore=abc → filter never set → 3 rows (unfiltered)
  • minScore=1e999 → ParseFloat range error → filter never set → 3 rows (unfiltered)
  • minScore=NaN → filter set to NaN → 0 rows
  • minScore=Inf → 0 rows
  • maxScore=xyz → filter never set → 3 rows (unfiltered)
  • maxScore=NaN → 0 rows

limit/offset in the same handler (lines 107-115) have the same
silent-drop shape, but the store neutralizes them (feedback.go List:
limit <= 0 falls back to the default page size, offset only applied when
> 0), so they are cosmetic; the score filters are the correctness bug
because both failure directions reach the caller as a plausible 200 result.

No test covers this: no test in internal/logstore/feedback_test.go or the
daemon tests references MinScore/minScore.

Why it matters

/v1/interactions is the feedback-review surface: a reviewer (or a script)
asking "show me interactions scored below X" to find bad responses gets
either everything (typo'd / out-of-range bound) or nothing (NaN/Inf), with a
200 and no hint the band was not applied. Both directions look like real
answers — the unfiltered direction reads as "all interactions pass", the
empty direction as "no interactions in band".

Acceptance criteria

  • A non-numeric, NaN, or infinite minScore/maxScore on GET /v1/interactions is rejected with 400 naming the parameter (the handler already 400s on other bad input, e.g. handleInteractionGet's missing id), OR is otherwise surfaced — never silently dropped.
  • Valid finite bounds behave exactly as today (minScore=0.4 over scores 0.2/0.5/0.9 returns the 0.5 and 0.9 rows).
  • Handler/store tests cover: abc, NaN, Inf, 1e999 for both bounds, plus the finite control case.
  • Triage pins whether the same 400 rule should extend to this handler's limit/offset (store-neutralized today) — recorded on the issue; not required for the score fix itself.

Activity

  1. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  2. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/lowNice to have; do when convenient
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 29, 2026
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-b
    • Session / ID: new-issue-creator-code-b cron run 2026-10-29 04:50 CDT
    • Found via: filed this run
    • Task: Filed: GET /v1/interactions score filters silently misbehave — routes_feedback.go:95-106 drops minScore/maxScore on ParseFloat error (abc/1e999 → unfiltered 200) and passes NaN/Inf into the store's SQLite score comparison (→ empty 200). Verified this run (main 319e6c2) with a laptop probe against the real logstore.FeedbackStore: control minScore=0.4 → 2 rows; abc/1e999/xyz → 3 unfiltered; NaN/Inf → 0.
    • Expectation: effort xs; done when triage pins the invalid-bound rule (expected: 400 naming the parameter) and routes a small_fix with regression tests for abc/NaN/Inf/1e999 on both bounds plus the finite control.
    • Links: probe ~/git/fleet/probe-2026-10-29-laneB-feedback-wt/ (laptop) · packet queue-pilot/packet-2223-triage.json
  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 31, 2026
  5. 22 remaining items

  6. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Oct 31, 2026
  7. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — task 4284 resumed by lane F: PR #3081 @e5804657 rechecked fresh — all substantive checks SUCCESS (build, lint, plugin tests, stress changed-tests), Codex review clean on the head (has_unresolved_findings: false, 0 unresolved threads). Only final: CI time budget remains QUEUED (fleet runner backlog); waited ~4 min per the 5-minute rule, still queued. Task parked 1h; resume: budget check completes green -> merge PR #3081 -> close this issue -> complete task 4284 fixed_merged.

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

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  10. added a commit that references this issue on Oct 31, 2026
  11. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane C
    • Session / ID: queue task 4284, repo-queue-worker-shift-c 2026-10-31 11:14 CDT
    • Found via: queue claim (resume from checkpoint awaiting_ci)
    • Task: Complete. PR 3081 merged as d20ccd6 at 2026-10-31T16:35:37Z; this issue auto-closed on merge.
    • Evidence: All checks on head e580465 pass (lint, plugin tests, stress changed tests, mcpx-docs build, final: CI time budget); Codex review completed on e580465 with has_any_findings=false / has_unresolved_findings=false (verified fresh this shift).
    • Links: PR fix(mcpx): reject invalid /v1/interactions score bounds with 400 (#2223) #3081
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/xsTrivial: expected under 30 minutes 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