Skip to content

mcpx: Phase 2 of #2386 — relevance-ranked local completion (exact → prefix → substring tiers; upstream order untouched) #2388

Closed

Description

@dezren39

Phase 2 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. Independent of Phase 1.

Scope

Relevance ranking inside localCompletion (pkgs/mcpx/internal/daemon/ops.go:402) — the cached-names fallback used when an upstream never declared completions. Today it returns hasPrefixFold prefix matches over the pool's name-sorted cache (internal/pool/pool.go:915): alphabetical, prefix-only.

Ranking (deterministic), applied to prompt names for ref/prompt and template URIs for ref/resource:

  1. Exact case-folded match first
  2. Prefix matches next — shorter name first, alphabetical tiebreak
  3. Substring (non-prefix) matches last — by first-match position, then alphabetical (the spec's "fuzzy matching where appropriate" slice; a value typed mid-name currently finds nothing)

The completion.maxValues cap (spec max 100) applies after ranking; total/hasMore keep their current meaning.

Upstream answers are not touched: when the upstream declares completions, its values pass through in its order with its total — the upstream ranks with knowledge mcpx does not have.

Acceptance

  • localCompletion tests demonstrate the three tiers in order for both ref types, including a mid-name substring hit that previously returned nothing
  • Cap is applied after ranking (the best matches survive truncation, not the alphabetically first)
  • total/hasMore unchanged in meaning; the source: "cache" / because response fields are unchanged
  • A test pins that an upstream-declared server's answer order is passed through unranked
  • Tests run via CI per fleet policy (no builds on the sandbox)

Out of scope: rate limiting (Phase 1), register changes (Phase 3), changing what the fallback can complete (still only cached prompt names / template URIs — mcpx cannot invent argument values).

Activity

  1. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed by design architect

  4. added
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 29, 2026
  5. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: #2386 (design), #2387 (Phase 1, independent), #2389 (Phase 3 register truth-up)

    Notes: Phase 2 of the #2386 design: relevance-ranked local completion (exact → prefix → substring) in localCompletion, upstream answers untouched. The body carries a full ## Acceptance checklist with file:line scope (ops.go:402, pool.go:915), so this pass is labels-only.

    Risks: Ranking must apply before the completion.maxValues cap or the best matches get truncated away; upstream-order passthrough is the regression to pin hardest.

    Suggested approach: Implement the three tiers in localCompletion with the tier-order tests for both ref types, plus the upstream-passthrough pin; verify via CI per fleet policy.

    🤖 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
  6. added
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Oct 30, 2026
  7. 25 remaining items

  8. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Oct 30, 2026
  9. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Resumed by repo queue worker (lane E) as queue task 3974 — picking up from the awaiting_ci checkpoint on PR #2857: fresh check of PR checks and Codex findings, merge if green and dispositioned.

  10. added a commit that references this issue on Oct 30, 2026
  11. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    Done — PR #2857 merged (merge commit de59b34). Resumed from the awaiting_ci checkpoint: all checks green on head 00a88b7 (lint, plugin tests, docs build, stress PR-changed-tests, CI budget) and the Codex review completed with zero findings, so the merge gate was clear.

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

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/enhancementmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)source/design-architectFiled by the repo design architect jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions