Skip to content

fix(agents): add include_disabled query to GET /api/agents#467

Open
szafranski wants to merge 1 commit into
iOfficeAI:mainfrom
szafranski:fix/agents-list-include-disabled
Open

fix(agents): add include_disabled query to GET /api/agents#467
szafranski wants to merge 1 commit into
iOfficeAI:mainfrom
szafranski:fix/agents-list-include-disabled

Conversation

@szafranski

Copy link
Copy Markdown

What

Add an opt-in include_disabled query parameter to GET /api/agents.

By default the endpoint is unchanged: it returns only enabled && available rows, so
pickers keep showing only spawnable agents. With ?include_disabled=true the response
additionally includes rows hidden solely because the user disabled them
(enabled = false) whose spawn command still resolves on $PATH. Rows hidden because the
binary is missing stay hidden in both modes.

Why

Disabling a custom agent currently removes it from every UI surface, including the AionUi
settings screen that hosts the re-enable toggle — leaving no way to turn it back on from the
GUI. The root cause is backend-side: GET /api/agents filters out every non-visible row.
This adds the management view the settings screen needs while keeping the picker contract
intact.

See the AionUi issue for the end-to-end report: iOfficeAI/AionUi#3318

How

  • aionui-api-types: new ListAgentsQuery { include_disabled: bool }.
  • routes/agent.rs: list_agents now extracts Query<ListAgentsQuery> and threads the flag.
  • services/agent.rs: list_agents(include_disabled) forwards to the registry.
  • registry.rs:
    • new list_for_view(include_disabled) whose predicate is
      is_visible(m) || (include_disabled && is_disabled_but_installed(m));
    • probe_resolved_command is refactored to split the disabled guard out into a new
      probe_command helper, so a disabled-but-installed row can be told apart from a
      disabled-and-missing one without changing the available field. Disabled rows keep
      available = false; the renderer greys them off enabled, not available.
  • refresh_agents (POST /api/agents/refresh) intentionally stays on the default filtered
    view — the settings screen drives the list endpoint, not refresh, so there is no need to
    surface disabled rows there.

Tests

cargo test -p aionui-ai-agent — added registry tests:

  • a disabled-but-installed custom row is absent from the default view, present with
    include_disabled=true;
  • a CLI-missing row stays absent in both views (no over-relaxing);
  • an enabled+installed row is present in both views.

Coupling

This is the backend half of a cross-repo fix. The renderer half is a separate PR in
iOfficeAI/AionUi (which uses the new parameter from the settings screen only). Both PRs must
be bundled together for the fix to function in a release.

Disabling a custom agent removed it from every UI surface, including the
settings screen that hosts the re-enable toggle, because GET /api/agents
only returns rows where enabled && available.

Add an opt-in include_disabled query parameter (default false) that also
re-surfaces rows hidden solely because the user disabled them while their
spawn command still resolves on PATH. CLI-missing rows stay hidden in
both modes. The default view is unchanged, so pickers keep showing only
spawnable agents.

Separate the disabled guard out of probe_resolved_command into a new
probe_command helper so a disabled-but-installed row can be told apart
from a disabled-and-missing one without changing the available field.
@szafranski

Copy link
Copy Markdown
Author

Small release-coordination bump: AionUi v2.1.19 already includes the renderer half in iOfficeAI/AionUi#3319 (fix(agents): keep disabled custom agents visible in settings), but the bundled AionCore v0.1.30 does not include this backend half yet.

That means users on the latest release can still see the old behavior, because the settings UI now calls /api/agents?include_disabled=true and needs this endpoint support to make the promised fix actually work. Could we please make sure this lands and is bundled in the next AionCore/AionUi release? Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant