Skip to content

agents control-plane: add label/phase filters across API, CLI, UIΒ #2670

@gregkonush

Description

@gregkonush

Summary

Add first-class filtering for Agents control-plane resources (label selector + AgentRun phase/runtime) across the API, agentctl, and UI so operators can quickly slice large fleets without client-side polling or manual kubectl.

Codex Metadata (Optional)

version: 1
iterations:
  mode: fixed
  count: 1
  min: 1
  max: 5
  stop_on:
    - success
    - needs_human
  reason: "single-pass feature implementation"

Context

  • services/jangar/src/routes/api/agents/control-plane/resources.ts already supports phase/runtime filters for AgentRun, but no label selectors.
  • agentctl list commands do not expose label selector filtering.
  • Agents control-plane UI lists are static and require full scans for filtering.

Desired Outcome

  • API: /api/agents/control-plane/resources accepts labelSelector (and preserves phase/runtime for AgentRun), applying the selector server-side.
  • agentctl: every list command accepts --selector (alias -l) and passes through to gRPC list endpoints.
  • UI: Agents control-plane list pages expose a filter bar with namespace + label selector + phase/runtime (AgentRun only) and use server-side filtering.

Scope

  • In scope:
    • services/jangar/src/routes/api/agents/control-plane/resources.ts
    • services/jangar/src/server/agentctl-grpc.ts
    • services/jangar/agentctl/src/index.ts
    • services/jangar/src/data/agents-control-plane.ts
    • services/jangar/src/components/agents-control-plane-primitives.tsx
    • Route pages under services/jangar/src/routes/agents-control-plane/** for list views
    • Docs: docs/agents/agentctl.md (document selector flag)
  • Out of scope:
    • Any infra/Argo changes
    • Controller runtime logic
    • CRD schema changes

Constraints & Risks

  • No polling loops in UI; rely on existing fetch + SSE updates.
  • Preserve current output formats and defaults (namespace defaults to agents).

Rollout / Ops Notes

  • No rollout sequencing; standard Jangar image deploy.

Validation

  • bun run --filter @proompteng/jangar lint
  • bun run --filter @proompteng/agentctl lint

Codex Prompt

Implement server-side filtering for the Agents control-plane list endpoints and propagate selectors through agentctl + UI.

Requirements (must all be met):

  1. API: add labelSelector query param to /api/agents/control-plane/resources and apply it when listing from Kubernetes; preserve phase/runtime filters for AgentRun. Update any relevant types.
  2. gRPC: extend list requests to accept label_selector and pass it to the underlying list calls; update agentctl to pass --selector/-l through for all list commands.
  3. UI: add a filter bar on list views (namespace + label selector, plus phase/runtime for AgentRuns) and wire it into the data fetcher; ensure it reuses existing SSE stream updates instead of polling.
  4. Docs: update docs/agents/agentctl.md to mention --selector/-l for list commands.
  5. Keep all changes inside the repo; do not touch infra or CRDs.

Files to touch (expected):

  • services/jangar/src/routes/api/agents/control-plane/resources.ts
  • services/jangar/src/server/agentctl-grpc.ts
  • services/jangar/agentctl/src/index.ts
  • services/jangar/src/data/agents-control-plane.ts
  • services/jangar/src/components/agents-control-plane-primitives.tsx
  • services/jangar/src/routes/agents-control-plane/**/index.tsx
  • docs/agents/agentctl.md

Output:

  • Commit changes and open a PR against main with a Conventional Commit title.
  • Include a short PR summary and testing notes.

Do not stop until all requirements are satisfied.

Additional Context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions