You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(api): two more duplicate route registrations found via a real-router-object walk (#16908 follow-up) #16913
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.
Whether the shadowed side of each pair is safe to delete outright, the
way knowledge_ai_stack.py's /search was in bug(api): four endpoints are registered twice — the second registration is dead code #16908 (that one had a
concrete security reason: zero tenant filtering on the losing side).
Neither pair here has been checked for an equivalent reason one side
should not simply be revived at a new path.
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
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 firstAPIRouter(...) 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
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.
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
Activity
mrveiss commentedon Sep 17, 2026
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 twoconfirmed false positives, found by reading source directly against each
reported pair:
GET /api/cache/stats:api/cache_management.py's/statsisregistered at prefix
/cache→ serves/api/cache/stats.api/system.py's/cache/statsis registered at prefix/system→ serves/api/system/cache/stats. Different paths — the scanner mis-resolved oneof these two prefixes.
GET /api/mcp/tools:api/mcp_registry.py's/toolsis registered atprefix
/mcp→ serves/api/mcp/tools.api/redis_mcp/router.py's/mcp/toolsis registered at prefix/redis→ serves/api/redis/mcp/tools. Also different paths, also a scanner bug — and thisone is inside
api/(api/redis_mcp/router.py), not only anexternal/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 tobe a false positive — that script attributed every route in a file to the
file's first
APIRouter(...)call, mis-scoringllc/api/runs.py'sheartbeat_runs_router(its own, separately-prefixedAPIRouter) as if itshared the file's other router's
/agentsprefix. Corrected and retracted byits 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
APIRouterobjectsload_core_routers()/load_optional_routers()return viaautobot_shared.api_routing. router_routes.effective_routes(), using each registration tuple's ownprefixvalue rather than re-deriving one from source — it cannot mis-resolvea 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):
GET/api/llc/agent/context/{item_id}llc/api/agent_api.py,llc/api/context.pyPOST/api/voice/realtime/tools/callapi/realtime_session.py,api/voice.pyThe voice pair is corroborated by two independent methods (this object walk,
and the corrected by-hand sweep) —
api/voice.py's side is registered viafrom api.voice import realtime_router as voice_realtime_router(
core_routers.py:113), an import-alias form that a plainrouter_prefixes.py-based tool would miss entirely (#16917) but that bothmethods here resolve correctly.
Updated acceptance criteria
GET /api/llc/agent/context/{item_id}traced through actualregistration order (
llc/api/__init__.py's own include order) andresolved: one registration removed, or the paths made distinct, with
the reason recorded
POST /api/voice/realtime/tools/calltraced and resolved the same wayKNOWN_DUPLICATE_BASELINE) shrinks by oneentry per pair resolved here, down to empty —
test_the_baseline_has_ no_stale_entriesin that guard fails automatically if a baseline entrystops matching a real duplicate, so this is self-enforcing once fixed
The 4-row table and itscache/stats/mcp/toolsrows above this edit aresuperseded by this correction, not deleted, so the false-positive story stays
readable in the issue's history.
[-]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)[/+]fix(backend): dedupe 4 duplicate route registrations, add a guard (#1…
fix(backend): rebuild #16908's guard on real router objects, not text (…
fix(backend): dedupe 4 duplicate route registrations, add a guard (#1…
fix(backend): rebuild #16908's guard on real router objects, not text (…
github-actions commentedon Nov 1, 2026
needs-structurecleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).