Skip to content

mcpx(daemon): handleAskAbandon reads r.Body unbounded — TestNoUnboundedBodyReaders red on main, blocks amd toplevel #11306

Closed

Description

@dezren39

Found during the 2026-11-17 amd toplevel build for the Dot SSH activation: mcpx-0.1.0.drv fails its check phase on current main —

--- FAIL: TestNoUnboundedBodyReaders (0.01s)
    body_limits_test.go:114: routes_proto.go:909: r.Body read without a size ceiling: if r.Body != nil {
    body_limits_test.go:114: routes_proto.go:910: r.Body read without a size ceiling: _ = json.NewDecoder(r.Body).Decode(&body)
FAIL github.com/developing-today/code/pkgs/mcpx/internal/daemon

Reproduced deterministically outside nix: go test ./internal/daemon/ -run TestNoUnboundedBodyReaders -count=1 fails at main 8fef1ad.

Cause: handleAskAbandon in pkgs/mcpx/internal/daemon/routes_proto.go decodes its optional {taskCancelled} body with a bare json.NewDecoder(r.Body) — the one daemon handler that missed the #2082 rule (every body read goes through http.MaxBytesReader at the route class's configured limit). The guard test is doing exactly its job; the handler is a real unbounded read (small struct today, but the ceiling is the contract).

Fix: wrap the decode in http.MaxBytesReader(w, r.Body, s.bodyBytes("http.controlBodyLimit", defaults.HTTPControlBodyLimit)), matching the control-class idiom (cf. upgrade.go). The existing error tolerance stays: an absent/empty body still decodes to the zero value.

Also seen in the same nix check run, not reproduced locally yet and possibly load-related: TestDefaultConfigStdioRunsSupervised (internal/pool) — "supervised child still alive after the reap" at its 10s bound under heavy parallel build load. Noted here for now; if it reproduces on a quiet run it deserves its own issue.

Impact: mcpx is in the amd system closure, so this blocks the amd switch (and any main-based toplevel build) until fixed.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions