fix(engine): scale DM inbox reads beyond D1 limit
Merged
KH
4mo ago+530+530+012345678901234567890123456789-50-50-01234567890123456789
Summary
- batch DM conversation and inbox enrichment lookups in D1-safe groups of 90 instead of emitting an unbounded
IN (...)parameter list - thread the existing
message.dm.listlimit through MCP, TypeScript SDK, andGET /v1/dm/conversations, applying it before enrichment - add a 151-conversation regression harness that rejects statements above D1's real 100-bound-parameter ceiling
Fixes the Relaycast-side root cause documented in AgentWorkforce/relay#1471.
Validation
- red regression before fix: list generated 151 bound parameters; inbox generated 152; both returned 500
- scale regression after fix: 2/2 passed with 151 conversations and a strict 100-parameter guard
- focused engine/SDK/MCP tests: 89/89 passed
- full engine suite (serial): 567/567 passed
- full TypeScript SDK suite (serial): 420/420 passed
- full MCP suite (serial): 221/221 passed
- monorepo build: 9/9 packages passed
- monorepo lint: 13/13 tasks passed
- engine typecheck and
git diff --check: passed - TruffleHog verified-secret scan: zero findings
Gate notes
- An initial maximally parallel monorepo test run exposed existing cross-file SDK mock interference/timeouts; every affected file and the complete SDK suite passed serially.
npm audit --omit=devreports the existing Next.js/PostCSS backlog (2 high package findings); this PR changes no dependencies.- Veto MCP tools are not exposed in this lane, so repository-native test, lint, build, type, diff, audit, and secret checks were used.
Draft only; do not merge without Khaliq's decision.