Skip to content

bug(api): two more duplicate route registrations found via a real-router-object walk (#16908 follow-up) #16913

Open

Description

@mrveiss

Corrected below (see the correction comment for the full story):
the count is 2, not the original 4. cache_management/system and
mcp_registry/redis_mcp were confirmed false positives from a
text-based scanner mis-resolving a registration prefix — see the
corrected content below and the comment thread for detail.

What

Two (method, path) pairs are registered by two different modules each,
found by walking the real APIRouter objects
load_core_routers()/load_optional_routers() return (via
autobot_shared.api_routing.router_routes.effective_routes()) rather than
re-parsing source — the method #16908's own guard
(repo_tests/duplicate_route_registration_16908_test.py) now uses, after
two independent text-based approaches each produced a confirmed false
positive on a different pair.

Method Path Modules
GET /api/llc/agent/context/{item_id} llc/api/agent_api.py, llc/api/context.py
POST /api/voice/realtime/tools/call api/realtime_session.py, api/voice.py

#16908 itself fixed the other 4 originally reported here that turned out to
be real (/api/admin/schedulers, /api/capabilities,
/api/knowledge_base/stats, /api/knowledge_base/search); this issue is
only these 2 remaining.

Not determined

Acceptance criteria

  • GET /api/llc/agent/context/{item_id}: winner and loser traced
    through actual registration order, then resolved — one registration
    removed, or the paths made distinct, with the reason recorded
  • POST /api/voice/realtime/tools/call: same
  • bug(api): four endpoints are registered twice — the second registration is dead code #16908's guard baseline (KNOWN_DUPLICATE_BASELINE in
    repo_tests/duplicate_route_registration_16908_test.py) shrinks by
    one entry per pair resolved here, down to empty

Refs

Discovered while implementing #16908; that issue's own guard now covers
these two as a documented, tested baseline pending this issue's fixes.

Activity

  1. mrveiss commented on Sep 17, 2026

    @mrveiss
    OwnerAuthor

    Correction: the count is 2, not 4 — two of the original four were false positives

    The BackendEndpointScanner-based sweep this issue was filed from produced two
    confirmed false positives, found by reading source directly against each
    reported pair:

    • GET /api/cache/stats: api/cache_management.py's /stats is
      registered at prefix /cache → serves /api/cache/stats.
      api/system.py's /cache/stats is registered at prefix /system → serves
      /api/system/cache/stats. Different paths — the scanner mis-resolved one
      of these two prefixes.
    • GET /api/mcp/tools: api/mcp_registry.py's /tools is registered at
      prefix /mcp → serves /api/mcp/tools. api/redis_mcp/router.py's
      /mcp/tools is registered at prefix /redis → serves
      /api/redis/mcp/tools. Also different paths, also a scanner bug — and this
      one is inside api/ (api/redis_mcp/router.py), not only an
      external/registry-mounted file, so the bug isn't confined to that class.

    A second, independent by-hand sweep (run by a peer session)
    initially added a THIRD pair (GET /api/llc/agents) that also turned out to
    be a false positive — that script attributed every route in a file to the
    file's first APIRouter(...) call, mis-scoring llc/api/runs.py's
    heartbeat_runs_router (its own, separately-prefixed APIRouter) as if it
    shared the file's other router's /agents prefix. Corrected and retracted by
    its own author before this issue closed.

    Both text-based approaches produced confirmed false positives on different
    pairs.
    #16908's guard (repo_tests/duplicate_route_registration_16908_test.py)
    now walks the real APIRouter objects load_core_routers()/
    load_optional_routers() return via autobot_shared.api_routing. router_routes.effective_routes(), using each registration tuple's own
    prefix value rather than re-deriving one from source — it cannot mis-resolve
    a prefix it never re-parses. That walk reports exactly 2 duplicates,
    confirmed against 273 total registrations (matching the peer session's
    independent by-hand count of 273/273 exactly):

    Method Path Modules
    GET /api/llc/agent/context/{item_id} llc/api/agent_api.py, llc/api/context.py
    POST /api/voice/realtime/tools/call api/realtime_session.py, api/voice.py

    The voice pair is corroborated by two independent methods (this object walk,
    and the corrected by-hand sweep) — api/voice.py's side is registered via
    from api.voice import realtime_router as voice_realtime_router
    (core_routers.py:113), an import-alias form that a plain
    router_prefixes.py-based tool would miss entirely (#16917) but that both
    methods here resolve correctly.

    Updated acceptance criteria

    • GET /api/llc/agent/context/{item_id} traced through actual
      registration order (llc/api/__init__.py's own include order) and
      resolved: one registration removed, or the paths made distinct, with
      the reason recorded
    • POST /api/voice/realtime/tools/call traced and resolved the same way
    • bug(api): four endpoints are registered twice — the second registration is dead code #16908's guard baseline (KNOWN_DUPLICATE_BASELINE) shrinks by one
      entry per pair resolved here, down to empty — test_the_baseline_has_ no_stale_entries in that guard fails automatically if a baseline entry
      stops matching a real duplicate, so this is self-enforcing once fixed

    The 4-row table and its cache/stats/mcp/tools rows above this edit are
    superseded by this correction, not deleted, so the false-positive story stays
    readable in the issue's history.

  2. changed the title [-]bug(api): four more duplicate route registrations found running the codebase's own endpoint scanner (#16908 follow-up)[/-] [+]bug(api): two more duplicate route registrations found via a real-router-object walk (#16908 follow-up)[/+] on Sep 17, 2026
  3. added
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 1, 2026
  4. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    needs-structure cleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).

  5. removed
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions