Skip to content

feat(api): filter listed agents by activity state - #748

Open
mvanhorn wants to merge 4 commits into
omnara-ai:mainfrom
mvanhorn:feat/agent-activity-filter
Open

mvanhorn wants to merge 4 commits into
omnara-ai:mainfrom
mvanhorn:feat/agent-activity-filter

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 30, 2026 •

Copy link
Copy Markdown

Summary

List agents (project and organization) now accepts activity_state so callers can keep only agents whose current activity.state is running, idle, waiting_on_interaction, or archived. The filter runs in the list query, so pages and cursors stay aligned with the filtered set. Passing activity_state=archived includes archived agents even when include_archived is omitted.

The dashboard Instances filters menu adds a Status choice for the same values. omnara agents list --activity-state is generated from the query parameter, and the table includes an activity column.

Testing

  • make sqlc-check
  • make sql-rules
  • go test ./internal/httpapi ./internal/storage/executionstore
  • go test -count=1 -tags=integration -run '^TestListAgentsByActivityState$' ./internal/httpapi
  • cd frontend && pnpm run typecheck && pnpm run lint && pnpm --filter @omnara/web run test

Demo

demo

Add an activity_state query parameter to project and organization agent
lists, apply it in SQL so pagination stays correct, and expose the same
filter in the dashboard Status menu and CLI list output.
@github-actions github-actions Bot added the feat PRs of type feat (auto-applied from title) label Oct 30, 2026
Resolve the spec conflict by keeping the shared AgentActivityState schema and
moving main's note about running processes and working subagents onto it.
Keep both additions in the agents overview. Regenerate the Go server, the SDK
and the published OpenAPI copy from the merged spec.

Complete the agent-status test fixture for the activity fields main now
requires.
@mvanhorn

Copy link
Copy Markdown
Author

Merged current main in 9b248ae to clear the conflicts. They were in the OpenAPI spec and the agents overview, plus the generated files.

In the spec, main changed the state description inline while this branch had moved state to the shared AgentActivityState schema, so I kept the schema and put main's note about running processes and working subagents on it. The overview keeps both main's activity fields and the activity_state filter text. The Go server, SDK and docs copy of the spec are regenerated from the merged spec. Main's new required activity fields also needed the agent-status.test.ts fixture updated.

go build ./..., make openapi-check, make docs-openapi-check, go test on internal/httpapi and internal/storage/executionstore, the SDK generate with no diff, frontend typecheck and agent-status.test.ts pass locally. make sqlc-check passed on the merge before that fixture change. The integration tests in agents_list_route_integration_test.go compile but did not run, because they need PostgreSQL 18 and I don't have it here, so CI is the first run of those on the merged tree.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9b248ae. Configure here.

The Status filter could empty a project that still has agents, but the
list only counted name search as filtering, so it showed the empty copy
and launch action. Count a selected status as filtering too.
@mvanhorn

Copy link
Copy Markdown
Author

Fixed the Status empty state Bugbot flagged in ac7aa7b. A selected status now counts as filtering alongside name search, so a status with no matches shows "No results." instead of the empty copy and launch action. This covers both the project and org agent lists, since they share useAgentListControls. I added AgentsSection.test.tsx, which picks a status through the real filter menu against a fake API, and it fails without the fix.

format:check, lint, typecheck and the full web vitest suite pass on that commit. The suite passed with --maxWorkers=3 --testTimeout=30000. Two earlier runs at the default settings failed on a heavily loaded machine, with a different set of tests each time, none of them in the agents list. All of those tests pass at the lower concurrency.

The only conflict was in the generated internal/httpapi/openapi/api.gen.go.
Regenerate it from the merged spec instead of editing it by hand.
@mvanhorn

mvanhorn commented Nov 3, 2026

Copy link
Copy Markdown
Author

Merged current main in 97ac2e0 to clear the new conflict. The only conflict was the embedded spec in the generated api.gen.go, so I regenerated it from the merged spec rather than editing it by hand.

go build ./..., make openapi-check, make docs-openapi-check, make sqlc-check, make sql-rules, make sqlc-vet, go test on internal/httpapi/... and internal/storage/..., the SDK generate with no diff, frontend format:check, lint, typecheck and the full web vitest suite pass on the merge. The vitest run used --maxWorkers=4 --testTimeout=30000.

The integration tests compile but did not run here, because the test harness needs the compose database. The CI workflows on this head show action_required, so CI has not run them on the merged tree either.

This branch has not been deployed

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

Labels

feat PRs of type feat (auto-applied from title)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant