Skip to content

fleet-dispatch response-head read is bounded by bytes but not repetition; timeouts set with .ok() #13466

Closed

Description

@dezren39

Found by the #6583 Phase 4 read-site inventory.

Sites: pkgs/fleet/crates/fleet-dispatch/src/lib.rs

Ask: bound header-line repetition in the dispatch head read to match the http.rs contract, and surface timeout-set failures as errors instead of .ok(). Test both with a stalled and a header-flooding peer.

Refs #6583, #6582.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T16:36:53Z",
    "session_id": "ses_e5df6cae2e7ffeIJl8FJcbzlxP",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/code",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/code",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "f34172d98c395c4de18e9364a8a2c329224264d4"
    },
    "auth_subject": "oc-code-02",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — confirmed live, fix enqueued

    • Agent: fleet queue worker, lane oc-code-08 (repo-worker-code)
    • Task: 21381 · queue repo-health-code-pilot · kind triage
    • Verdict: CONFIRMED at main f3e19dcf747 (clean checkout, 2026-11-23). Both gaps are live:
      1. read_response head loop (pkgs/fleet/crates/fleet-dispatch/src/lib.rs ~234-250) breaks only on \r\n\r\n or the 1 MiB byte cap — no header-line count, so a peer of small lines floods freely. The framing validation that follows only inspects Content-Length/Transfer-Encoding lines, so flood lines pass through silently.
      2. open_stream direct path (~201-202) sets both socket timeouts with .ok() — a failed set is swallowed and the 300s/60s deadlines silently vanish.
    • No open PR covers it (fresh gh pr list search for 13466/fleet-dispatch: only an unrelated dependabot bump). Baseline cargo test -p fleet-dispatch --lib is 16/16 green.
    • Routing: fix packet enqueued as task 21386 (queue repo-health-code-pilot, kind small_fix, canonical key repo-health:v1:fix:developing-today/code:issue:13466): named MAX_HEADER_LINES bound (256, matching fleet-proxy/src/http.rs :88) in the head loop + transport errors from timeout-set failures, with flood/stalled/timeout-failure tests. Scope keeps http.rs and fleet-dispatch accepts invalid or truncated HTTP response framing #8433 framing untouched.
  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · claimed — lane AAR

    • Agent: Muse lane AAR (sandbox fix lane, coordinated by Archer)
    • Premise: CONFIRMED first-hand at current main. pkgs/fleet/crates/fleet-dispatch/src/lib.rs: open_stream sets read/write timeouts with .ok() (~lines 201-202), and the read_response head loop is bounded only by the 1 MiB byte cap — no header-line count. The fleet-proxy http.rs contract caps repetition at MAX_HEADER_LINES = 256 (fleet-proxy(http): response reader caps every line but nothing caps repetition — endless 1xx heads, header lines, or trailer lines hang an exchange (and its pooled tunnel) forever #6509).
    • Scope: bound header-line repetition in the dispatch head read to match the http.rs contract (256 lines); surface timeout-set failures as errors instead of .ok(); add tests with a header-flooding peer and a timeout-set failure path where reachable.
    • Ownership check: body + all comments read (2 comments, count-confirmed): one Kaneo link, one triage note (oc-code-08, task 21381) confirming the premise and enqueueing the fix — no lane claim, no open PR covering this issue.

    agent-note:v1

  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — lane AAR

    • Agent: Muse lane AAR (sandbox fix lane, coordinated by Archer)
    • Landed: PR fix(fleet-dispatch): bound response-head repetition, surface timeout-set failures #13514, merged as 5f2cc825bcb142a3621944b0b098e989a9eaf4b5 (branch head cd739b5b408).
    • What changed (pkgs/fleet/crates/fleet-dispatch/src/lib.rs only):
      1. The read_response head loop now counts complete lines as they arrive and refuses past the fleet-proxy http.rs contract — fleet_proxy::http::MAX_HEADER_LINES (256), referenced directly from fleet-proxy so the two readers share one constant and cannot drift. Header lines are counted after the status line, excluding the blank terminator line.
      2. open_stream's .ok() timeout sets are gone: both go through a new apply_timeouts helper that maps a failed set_read_timeout/set_write_timeout to a transport error naming the failed deadline.
    • Tests added (oracle: the crate's loopback serve harness + socket-level tests):
      • header_flooding_peer_is_refused — 257 header lines refused ("head exceeds 256 header lines") though far under the 1 MiB byte cap; a control head at exactly 256 header lines is accepted.
      • stalled_peer_times_out_instead_of_hanging — a peer that accepts and never sends fails the read at its 200 ms deadline.
      • timeout_set_failures_surface_as_errors — a zero duration (refused by the OS layer) surfaces as a transport error; the success path reads back the timeouts it set.
    • Verification: cargo test -p fleet-dispatch on the laptop (sccache disabled per sccache daemon wedges specific in-flight Rust compiles on the laptop (clients park at 0% CPU; daemon stays responsive) #13367, private target dir): 19 passed / 0 failed, both at the branch head and again at the merge commit on main. cargo fmt --check clean. Clippy under the rustup 1.99.1 toolchain (the repo pin; the laptop's default clippy/rustc pair is version-split and cannot build this workspace — pre-existing environment state): no new warnings in the touched crate.
    • Issue criteria: both asks implemented and tested as specified. Closing.

    agent-note:v1

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions