Skip to content

[Feature]: Filter the automation list by factory membership #822

Done

Description

@jpshackelford

Problem or Use Case

GET /v1 can list the automations in one factory with factory_id. A client cannot ask for the automations that are in no factory. To hide factory automations from an org-wide list, the Agent Canvas must list everything and drop rows itself. That leaves short pages and a total that counts rows the client then removes.

Desired Behavior

GET /v1 accepts an in_factory query parameter. false returns only automations in no factory. true returns only automations in a factory. Omitting it returns both, as today. It combines with the other filters, and total follows it.

Acceptance Criteria

  • GET /v1?in_factory=false returns only automations in no factory, and total counts only those.
  • GET /v1?in_factory=true returns only automations in a factory.
  • A request without in_factory returns the same result as before.
  • in_factory=false together with factory_id returns no rows.

Additional Context

The Agent Canvas change that uses this filter is OpenHands/OpenHands#20074.

This issue was drafted by an AI agent on behalf of the user.


OpenHands AI triage

The following comments and acceptance criteria were added by the OpenHands AI agent.

Triage

GET /v1 (openhands/automation/router.py, list_automations) already applies the caller's org-scoped filters (factory_id, tag, created_by, run_as_user_id) over visible_to, excludes soft-deleted automations, and derives total and offset paging from the same filtered query. The in_factory membership filter belongs in that existing filter chain so total and pagination follow it, as the issue describes.

Bounded scope: an optional boolean in_factory query parameter on this one endpoint, plus automated tests for it. Explicit non-goals: no schema or migration change; no new endpoint; no change to GET /v1/factories counts, visibility rules, ordering, or auth; and no Canvas UI work — the consuming UI is tracked in OpenHands/OpenHands#20074 (upstream OpenHands/OpenHands#20080).

Priority medium: the deployed Agent Canvas Automate list depends on this filter to page correctly (OpenHands/OpenHands#20074 is built against it), and the short-page/wrong-total behavior was reproduced live against a local Agent Canvas stack; however the current client-side fallback masks part of the impact and there is no direct user report, so this is not high.

Acceptance Criteria

  • GET /v1?in_factory=false returns only automations that are in no factory, and total counts only those rows.
  • GET /v1?in_factory=true returns only automations that are in a factory, and total counts only those rows.
  • A GET /v1 request without in_factory returns the same rows and total as before the change.
  • GET /v1?in_factory=false&factory_id=<id of an existing factory> responds HTTP 200 with an empty list and total 0; the same request with in_factory=true returns that factory's automations.
  • in_factory combines with the other list filters (e.g. tag, created_by, factory_id): returned rows and total reflect the combined filter.
  • With limit/offset paging, every page contains only rows matching the filter and total is the same on every page.
  • Visibility and lifecycle invariants hold for both variants: automations the caller may not see and soft-deleted automations are excluded, and on a fixed dataset total without the parameter equals the true total plus the false total.
  • A non-boolean in_factory value responds with HTTP 422 and never HTTP 500.
  • The endpoint still requires view_automations, and in_factory appears in the endpoint's OpenAPI schema as an optional boolean.
  • Automated tests in the repository's test suite cover the omitted, true, false, and false+factory_id cases and pass in CI.

Activity

  1. added
    enhancement
    on Nov 25, 2026
  2. added
    ready-for-dev
    priority:medium
    on Nov 25, 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

    Labels

    enhancementpriority:mediumready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions