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.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
---
|
||||
id: review-002-con17-mcp-pagination
|
||||
name: Bound MCP tools/list pagination (max pages + deadline) (CON-14)
|
||||
status: pending
|
||||
depends_on: []
|
||||
scope: narrow
|
||||
risk: low
|
||||
impact: component
|
||||
level: implementation
|
||||
tags: [adapters, review-002, mcp]
|
||||
---
|
||||
|
||||
## Description
|
||||
|
||||
Review 002 CON-14 [major]. `from_mcp/mod.rs:114-119` delegates to
|
||||
rmcp 1.8.0's `Peer::list_all_tools`, which loops `while
|
||||
cursor.is_some()` with **no page cap and no timeout** (verified against
|
||||
rmcp source `service/client.rs:390-407`). A malicious or buggy server
|
||||
that always returns `next_cursor: Some(...)` (cycling or ignoring the
|
||||
cursor) hangs `import()` indefinitely while appending every page's
|
||||
tools → unbounded memory growth alongside the hang. Tools from
|
||||
completed pages are not lost (extend per page), but nothing in alkhttp
|
||||
bounds the loop. The paging test that exists (from_mcp_integration.rs)
|
||||
terminates after 3 pages — the cycling shape is untested.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Replace `list_all_tools` with a bounded loop over `list_tools`:
|
||||
hard page-count cap + overall deadline (constants or config;
|
||||
pick generous defaults — e.g. 100 pages / 60 s — and note them
|
||||
in the module doc)
|
||||
- [ ] Budget trips → `AdapterError::DiscoveryFailed`-family error
|
||||
naming the budget (pages seen, tools accumulated), no partial
|
||||
import left behind (the existing import-fails-closed behavior
|
||||
holds)
|
||||
- [ ] Integration test: a paging server that cycles its cursor
|
||||
(always `next_cursor: Some("a")`) → import terminates with the
|
||||
clean error, bounded time (no hang)
|
||||
- [ ] Existing 3-page pagination test unchanged and passing
|
||||
(well-formed pagination still imports all pages)
|
||||
- [ ] `cargo test --features mcp`, `cargo clippy --all-features --all-targets -- -D warnings`,
|
||||
`cargo fmt --check` pass
|
||||
|
||||
## References
|
||||
|
||||
- docs/reviews/002-post-remediation-review.md (Part F', CON-14)
|
||||
- src/adapters/from_mcp/mod.rs:114-119 (the delegation), rmcp 1.8.0 src/service/client.rs:390-407 (the unbounded loop)
|
||||
- tests/from_mcp_integration.rs:302-317 (the existing paging server)
|
||||
- tasks/adapters/review-001-consumer-adapter-hygiene.md (CON-01's pagination work this bounds)
|
||||
|
||||
## Notes
|
||||
|
||||
Small, self-contained, feature-gated (`mcp`). Consider (optional) a
|
||||
`max_tools` sanity cap as well — same budget family, one more guard
|
||||
against a hostile server — but do not let scope creep: the page cap +
|
||||
deadline closes the hang, which is the finding.
|
||||
Reference in New Issue
Block a user