Files
alkhttp/tasks/client/review-002-fwd15-stream-timeout.md
T
glm-5.3-flash e2c255d40c docs(tasks): decompose review-002 into 24 tasks (23 implementation + 1 bracketed follow-up)
Decomposition of docs/reviews/002-post-remediation-review.md per its
5-unit remediation plan:

- Unit 1 (security-critical): gw15-publish-body-cap,
  prj16-schema-via-call (CF-004 filed alkcall-side), fwd13-dot-segments,
  fwd16-missing-capability, oai11-ref-memoization
- Unit 2 (timeout/terminality): ws13-idle-progress,
  fwd15-stream-timeout, cli01-retry-after-budget, con17-mcp-pagination,
  con18-wss-sweep-exit
- Unit 3 (projection/docs): projection-truthfulness, mcp-batch-cap,
  gw16-status-drift
- Unit 4 (spec-import): yaml-normalization, oai13-path-item-wildcards,
  import-loudness-cluster, js01-placeholder-check,
  fwd17-19-contract-decisions
- Unit 5 (WS polish + tests): con18b-ws-polish,
  client-policy-wire-tests, cov-deployment-knobs, cov13-dead-code,
  srv11-srv12-router-ordering
- review-002-bracketed-followup: tentatively planned post-bulk pass
  (stale-check, OQA-18 enforcement decision, CON-08/09 close() lever,
  cross-crate re-checks) — deliberately not serialized against the
  bulk

Also: review-002 numbering repair (CON-14 was double-booked; MCP
pagination now CON-14, from_wss monitor renumbered CON-18, missing
CON-14 section added).

taskgraph: 66 valid, no cycles; 24 pending (all review-002);
gen-1/gen-2 parallel waves identified; workflow-cost hotspots are
prj16 (12.8) and ws13 (11.1), both carrying the reviewed slicing
guidance in their Notes.
2026-08-30 10:50:34 +00:00

3.5 KiB

id, name, status, depends_on, scope, risk, impact, level, tags
id name status depends_on scope risk impact level tags
review-002-fwd15-stream-timeout Subscriptions must not inherit the 30s total request timeout (FWD-15) + stream byte cap (FWD-14) pending
moderate medium component implementation
client
review-002
adapters

Description

Review 002 FWD-15 [major] + FWD-14. Two streaming-path defects, same code region (src/adapters/forward.rs:824-934):

  1. FWD-15: forward_stream sends through the shared client whose DEFAULT_REQUEST_TIMEOUT is 30 s — verified against reqwest 0.13.4 that the total-timeout sleep rides into the response body stream. A healthy subscription dies at 30 s with SSE stream error: operation timed out — even keep-alive-emitting sources (the gateway deliberately runs subscriptions unbounded per ADR-021; dispatch.rs:28). The outbound half of the same subscription is mortally capped.
  2. FWD-14: the streaming branch has no size accounting — the 1 MiB cap bounds a single SSE line, not the stream. A hostile upstream emits well-formed 1-MiB-line events forever: 30 s of those is ~GB/s into envelope allocation (mitigated only by the timeout — which FWD-15's fix then removes, so both must land together or the fix makes FWD-14 worse).

Acceptance Criteria

  • FWD-15: HandlerKind::Stream forwards send with request_timeout: None while keeping connect + read timeouts (implementer's choice: per-request extension override verified against reqwest 0.13, or a second derived client built from the same config minus the total timeout) — a >30 s healthy subscription survives
  • FWD-15 wire test: responder trickling : keepalive comments past 30 s (scaled: use a configurable short client timeout in the test) → stream still delivering events after the old deadline
  • FWD-14: a total byte cap on the streaming path (accumulate across feed; per-subscription total, default documented) and the line-cap check moved to before extend_from_slice so the overshoot cannot exceed cap + one chunk
  • FWD-14 test: a stream exceeding the total cap terminates with a single terminal error envelope (the stream-ends semantics)
  • Cap value + no-timeout decision documented in the module doc and http-server.md (ADR-049/021 note: unbounded time by design for subscriptions, bounded bytes per subscription)
  • cargo test, cargo clippy --all-targets -- -D warnings, cargo fmt --check pass

References

  • docs/reviews/002-post-remediation-review.md (Part D', FWD-14, FWD-15; Unit 2 rationale)
  • src/adapters/forward.rs:824-934 (send + streaming branch), :969-1082 (SSE parser), http_client.rs:69-95/:149-150/:164-178 (timeout config + read-timeout doc claim)
  • docs/architecture/decisions/049-streaming-handler-for-subscriptions.md
  • tasks/client/review-001-client-timeout-retry.md (the timeout defaults this revises)

Notes

Order matters within this task: land FWD-15 with FWD-14 in the same commit-series — removing the total timeout without the byte cap opens an unbounded-memory window. The read-timeout (10/30 s stall guard) stays: it bounds upstream staleness; the doc at http_client.rs:149-150 already correctly describes read-timeout as the stall guard (the total timeout's "stalled upstream" claim there is the thing being fixed). Coordinate with review-002-cli01-retry-after-budget (same file) and review-002-client-policy-wire-tests (which should follow this to test the new behavior) — sequence those.