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): literal routes declared after a {param} route never run — the anonymous embed widget gets 401, plugin audit and SLM node conflicts 404 #18720
Verified on origin/main 0196c7c234 (umbrella #18717). Starlette matches in registration order; a {param} route registered earlier captures a later literal.
Literal (dead)
Captured by
Effect today
POST /api/chats/embed/message (api/chat_embed.py:172)
POST /api/chats/{chat_id}/message (api/chat.py:1529); chat is registered before chat_embed (core_routers.py:164 vs :166), both at prefix ""
the anonymous embed widget (autobot-frontend/src/embed/AutobotWidget.ts:186) hits the authenticated handler: 401 (GH#9047 broken). chat_embed_test.py mounts only the embed router, so it can't see this
GET /api/plugins/audit (plugin_manager.py:632)
/api/plugins/{plugin_name} (:408)
the capability-audit panel (usePlugins.ts:288) gets "plugin 'audit' not found"
SLM GET /api/nodes/a2a-cards (api/nodes.py:2839)
GET /api/nodes/{node_id} (:532), same router
404 node-not-found
SLM GET /api/nodes/conflicts (api/services.py:778)
the same, nodes_router is included first (main.py:652 vs :654)
404
GET /api/batch-jobs/status, GET /api/batch-jobs/chat-init (batch_jobs.py:766, :838)
GET /api/batch-jobs/{job_id} (:210)
the SLM batch health check (useAutobotApi.ts:1480) gets 404; these also have no auth (#18718)
Not affected: /batch-jobs/templates/ and /schedules/. The FE sends the trailing slash, which {job_id} ([^/]+) does not match.
Acceptance criteria
Each literal is reachable: declared before its {param} sibling, or its router registered first (embed: register chat_embed before chat, or give it a non-colliding path). A test per route goes through the full app router order, not a single-router app (each fails on main).
A guard over the real registration order fails when a literal route is fully matched by an earlier param route of the same method, in both apps; it lists today's set (empty after the fix) and has a planted-conflict control.
The external report's complete shadowing set (api-route-duplicates-groups.csv, type b) has 3 more that the verification pass didn't cover; include them, confirming each first:
B001 GET /api/vnc-proxy/{vnc_type}/status (api/vnc_proxy.py:500) shadowed by /api/vnc-proxy/{vnc_type}/{path:path} (:367); 2 backend callers.
B005 GET /api/permissions/memory/stats (api/permissions.py:495) shadowed by /api/permissions/memory/{project_path:path} (:366).
B006 GET /api/a2a/trust/{peer_id:path}/audit (api/a2a_trust.py:107) shadowed by /api/a2a/trust/{peer_id:path} (:86); a :path converter swallows the /audit suffix.
That makes 9 distinct literals (B007/B008 are the same embed route, registered twice).
Closed by #18743 (train 31, merged as fb45ae4). The AC evidence, checked against origin/mainfb45ae4:
AC2 ticked.repo_tests/shadowed_literal_routes_18720_test.py covers both apps:
test_no_literal_route_sits_behind_a_param_route is parametrised over the backend and the SLM. It reads the real registration order through autobot_shared/api_routing/route_order.py, and fails on unresolved routers rather than reading them as clean.
The planted controls are test_planted_param_before_literal_is_reported, test_planted_path_converter_swallows_a_suffix and test_a_param_route_behind_an_earlier_param_route_is_reported. Negatives cover param-first and other shapes.
AC1 left unticked, with the reason._LITERALS in that test lists all 9 literals. That includes the 3 added in the comment above: vnc-proxy status, permissions memory stats and a2a trust audit. test_literal_is_the_route_the_app_picks asserts each one is answered by its own template under the full registration order. That order is rebuilt statically from source, not a live app. "Each fails on main" can't be checked from the merged code; showing it needs a run against the pre-fix tree, and I didn't do that. Reopen if that proof is required.
Activity
mrveiss commentedon Oct 17, 2026
The external report's complete shadowing set (
api-route-duplicates-groups.csv, type b) has 3 more that the verification pass didn't cover; include them, confirming each first:GET /api/vnc-proxy/{vnc_type}/status(api/vnc_proxy.py:500) shadowed by/api/vnc-proxy/{vnc_type}/{path:path}(:367); 2 backend callers.GET /api/permissions/memory/stats(api/permissions.py:495) shadowed by/api/permissions/memory/{project_path:path}(:366).GET /api/a2a/trust/{peer_id:path}/audit(api/a2a_trust.py:107) shadowed by/api/a2a/trust/{peer_id:path}(:86); a:pathconverter swallows the/auditsuffix.That makes 9 distinct literals (B007/B008 are the same embed route, registered twice).
fix(api): the batch-jobs literals made reachable stay authenticated, …
test(reach): re-pin the response-model secret-scan floor mid-window f…
fix(api): POST /batch-jobs/load requires an authenticated user like t…
mrveiss commentedon Oct 18, 2026
Closed by #18743 (train 31, merged as fb45ae4). The AC evidence, checked against
origin/mainfb45ae4:repo_tests/shadowed_literal_routes_18720_test.pycovers both apps:test_no_literal_route_sits_behind_a_param_routeis parametrised over the backend and the SLM. It reads the real registration order throughautobot_shared/api_routing/route_order.py, and fails on unresolved routers rather than reading them as clean.test_planted_param_before_literal_is_reported,test_planted_path_converter_swallows_a_suffixandtest_a_param_route_behind_an_earlier_param_route_is_reported. Negatives cover param-first and other shapes.api/nodes.py:532@router.get("/a2a-cards")precedes:558@router.get("/{node_id}")._LITERALSin that test lists all 9 literals. That includes the 3 added in the comment above: vnc-proxy status, permissions memory stats and a2a trust audit.test_literal_is_the_route_the_app_picksasserts each one is answered by its own template under the full registration order. That order is rebuilt statically from source, not a live app. "Each fails on main" can't be checked from the merged code; showing it needs a run against the pre-fix tree, and I didn't do that. Reopen if that proof is required.