Skip to content

HTMX partial endpoints ignore team_id filters for tools/resources/prompts #1966

@crivetimihai

Description

@crivetimihai

Problem

The admin UI supports team_id scoping via /admin?team_id=..., but the HTMX partial endpoints for tools/resources/prompts don't accept team_id, and the templates don't pass it. As a result, once the HTMX tables load or paginate, they ignore the selected team and show all accessible items (owner/team/public).

Affected Endpoints

  • GET /admin/tools/partial — no team_id param
  • GET /admin/resources/partial — no team_id param
  • GET /admin/prompts/partial — no team_id param
  • GET /admin/servers/partial — no team_id param
  • GET /admin/gateways/partial — no team_id param
  • GET /admin/a2a/partial — no team_id param

Root Cause

  1. The main admin page (/admin) accepts team_id as a query parameter and filters data on initial load using _call_list_with_team_support()
  2. selected_team_id is passed to the template context (line 3009 in admin.py)
  3. However, the HTMX hx-get requests in admin.html do NOT include team_id
  4. The partial endpoints do not accept team_id as a parameter

Steps to Reproduce

  1. Navigate to /admin?team_id=<TEAM_ID>#tools (same for resources/prompts)
  2. Observe the table after HTMX loads or after pagination
  3. Items are not restricted to the selected team (team filter is lost)

Expected Behavior

HTMX partials should respect team_id so the view stays team-scoped across load/pagination/search.

Actual Behavior

HTMX partials ignore team_id and fall back to access-control scope only (owner + team visibility + public).

Suggested Fix

  1. Add optional team_id: Optional[str] = Query(None) param to all partial endpoints
  2. Apply team filtering in the query (consistent with existing admin UI team scoping)
  3. Propagate selected_team_id in HTMX hx-get URLs and pagination controls in admin.html:
    hx-get="{{ root_path }}/admin/tools/partial?page=1&per_page=20{% if selected_team_id %}&team_id={{ selected_team_id }}{% endif %}"
  4. Include team_id in pagination link generation within the partial endpoints

Metadata

Metadata

Labels

bugSomething isn't workinguiUser Interface

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions