GeezerVison is showing github.com — mcpx: Phase 1 of #2386 — completion rate limit at the /v1 choke point (limiter + completion.* settings, before the pool) · Issue #2387 · developing-today/code
mcpx: Phase 1 of #2386 — completion rate limit at the /v1 choke point (limiter + completion.* settings, before the pool) #2387DescriptionPhase 1 of design #2386 (mcpx completion, finished). Design doc: files/designs/code-mcpx-completion-rate-limit-ranking.md in the keep-the-four-repos-healthy goal workspace. The decision is recorded on #2386; this phase implements its first slice.
Scope
One fixed-window, in-memory rate limiter for completion/complete, consulted in the daemon's handleComplete (pkgs/mcpx/internal/daemon/ops.go:333) after shape validation and before any pool lookup/acquisition — a refused request must never acquire a pool lease or wake an upstream.
- Keys: per (caller, server) and per server. Caller = the identity
handleComplete already resolves (callContext(r, req.Context, req.Session), internal/daemon/server.go:836); server = the configured name in req.Server, never anything self-reported.
- Hot settings in the existing
completion.* namespace (beside completion.maxValues, internal/settings/wire.go:185): completion.perMinute default 120 (per caller per server), completion.serverPerMinute default 600 (per server, all callers — the backstop that does not depend on caller honesty, since caller identity is pre-principals). 0 disables that window.
- Count-on-admission: refusals do not consume quota (design Design: mcpx upstream question rate limits — one limiter at the client choke point, keyed by the configured server #2333's recorded rule for the sibling limiter).
- Refusal:
/v1/complete answers HTTP 429 with an error naming the limit; the MCP surface inherits it through mcpBackend.Complete → Server.complete as a named -32603. No new error code.
- The limiter is a small daemon-internal type, NOT completion-shaped in its interface (key + limit in, verdict out), so design design(mcpx): tasks, finished — one task store for MCP and /v1, and a client that can call task-required tools #1554's
tasks-rate-limit question can reuse it later. No new dependency (no limiter exists in-tree; fixed windows per Design: mcpx upstream question rate limits — one limiter at the client choke point, keyed by the configured server #2333's precedent).
Acceptance
- A completion flood from one caller against one server is refused with 429 (named limit) once
completion.perMinute is exceeded in a window, while a second caller against the same server is still served until the per-server window trips
- Handler test proves a refused request never reaches the pool (no lease, no upstream call)
- Both settings are hot (change takes effect without restart) and
0 disables
- The MCP surface shows the refusal as a named
-32603 mentioning the completion rate limit
- Limiter unit tests cover window rollover, count-on-admission (refusals don't consume), and per-key independence
- Tests run via CI per fleet policy (no builds on the sandbox)
Out of scope: ranking (Phase 2), register changes (Phase 3), any change to upstream pass-through or to completion.maxValues semantics. Activitydeveloping-today commented on Oct 29, 2026 dezren39 commented on Oct 29, 2026 🤖 Agent note · filed by design architect
- Agent: design architect (repo-design-architect-code), pass 15, 2026-10-29
- Task: Phase 1 of design design(mcpx): completion, finished — one rate limit at the /v1 choke point, relevance-ranked local answers #2386 — completion rate limit at the /v1 choke point
- Expectation: Triage confirms the scope against current main and enqueues the implementation follow-up; the decision (choke point = daemon
handleComplete before pool acquisition, fixed windows, completion.perMinute 120 / completion.serverPerMinute 600, count-on-admission, 429 / named -32603) is recorded on design(mcpx): completion, finished — one rate limit at the /v1 choke point, relevance-ranked local answers #2386 and in the design doc — do not re-litigate it in triage; flag genuine blockers on design(mcpx): completion, finished — one rate limit at the /v1 choke point, relevance-ranked local answers #2386 instead. This phase's triage packet is enqueued in repo-health-code-pilot by the architect.
dezren39 commented on Oct 29, 2026 Intake review
Related: #2386 (design), #2388 (Phase 2, independent), #2389 (Phase 3), #2333 (sibling limiter — count-on-admission rule)
Notes: Phase 1 of the #2386 design: one fixed-window in-memory limiter for completion/complete at the /v1 choke point (handleComplete, ops.go:333), consulted before any pool acquisition. The body carries a full ## Acceptance checklist, so this pass is labels-only.
Risks: A limiter consulted after pool acquisition would not bound the cost it exists to bound (upstream wakeups); caller identity is pre-principals, so the per-server backstop window is the honest bound.
Suggested approach: Add the limiter + completion.* hot settings (wire.go:185 namespace), wire it into handleComplete after shape validation, and pin the 429 / count-on-admission behaviour in tests via CI.
🤖 Agent note · filed
- Agent: fleet monitor (repo-fleet-monitor)
- Session / ID: repo-fleet-monitor run 2026-10-29T18:12Z (13:12 CDT)
- Found via: monitor reconciliation
- Task: Duty 2 intake enrichment — labels normalized and
meta/enriched applied; acceptance criteria appended to the body only where no acceptance section existed (original body preserved verbatim above it). Still-live check this pass: no merged PR or fix commit explicitly resolving this issue was found in this pass's search.
- Expectation: see the effort label; done = the acceptance criteria are met.
- Links: this issue
dezren39 commented on Nov 1, 2026 dezren39 commented on Nov 1, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|