[PR #367] [MERGED] Add aggregated /api/agents/huddle/feed endpoint with incremental cursors #676

Closed
opened 2026-03-13 21:03:11 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/367
Author: @AJaySi
Created: 3/2/2026
Status: Merged
Merged: 3/3/2026
Merged by: @AJaySi

Base: mainHead: codex/add-get-/api/agents/huddle/feed-endpoint


📝 Commits (1)

  • 92b0255 Add aggregated agent huddle feed endpoint

📊 Changes

2 files changed (+241 additions, -0 deletions)

View changed files

📝 backend/api/agents_api.py (+33 -0)
📝 backend/services/agent_activity_service.py (+208 -0)

📄 Description

Motivation

  • Reduce frontend N+1 request patterns by returning a single aggregated huddle feed with agent activity instead of multiple round-trips.
  • Provide an incremental refresh API surface (since/cursor) and per-section pagination so the UI can efficiently sync new data.

Description

  • Added a new endpoint GET /api/agents/huddle/feed in backend/api/agents_api.py that accepts since, cursor, and per-section limit query params and returns one unified feed payload.
  • Implemented AgentActivityService.get_huddle_feed(...) in backend/services/agent_activity_service.py which aggregates statuses, runs, events, alerts, approvals, unread_alerts, pending_approvals, cursors, and server_timestamp.
  • Implemented feed helpers in the service: _parse_datetime, _get_active_statuses (uses sqlalchemy.func.max to pick latest run per agent), _list_*_for_feed for runs/events/alerts/approvals, _next_cursor, section serializers (_serialize_run/_serialize_event/_serialize_alert/_serialize_approval), and count helpers _count_unread_alerts/_count_pending_approvals to return aggregate counts.
  • Queries are filtered and ordered to support since and cursor semantics and per-section limits to enable efficient incremental pagination.

Testing

  • Compiled the modified modules with python -m compileall backend/api/agents_api.py backend/services/agent_activity_service.py and the files compiled successfully.
  • Re-ran python -m compileall backend/services/agent_activity_service.py to validate the service file and it also compiled successfully.

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/367 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/2/2026 **Status:** ✅ Merged **Merged:** 3/3/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/add-get-/api/agents/huddle/feed-endpoint` --- ### 📝 Commits (1) - [`92b0255`](https://github.com/AJaySi/ALwrity/commit/92b025502860988b3ac21d2bab773534ed89b5b1) Add aggregated agent huddle feed endpoint ### 📊 Changes **2 files changed** (+241 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/api/agents_api.py` (+33 -0) 📝 `backend/services/agent_activity_service.py` (+208 -0) </details> ### 📄 Description ### Motivation - Reduce frontend N+1 request patterns by returning a single aggregated huddle feed with agent activity instead of multiple round-trips. - Provide an incremental refresh API surface (`since`/`cursor`) and per-section pagination so the UI can efficiently sync new data. ### Description - Added a new endpoint `GET /api/agents/huddle/feed` in `backend/api/agents_api.py` that accepts `since`, `cursor`, and per-section limit query params and returns one unified feed payload. - Implemented `AgentActivityService.get_huddle_feed(...)` in `backend/services/agent_activity_service.py` which aggregates `statuses`, `runs`, `events`, `alerts`, `approvals`, `unread_alerts`, `pending_approvals`, `cursors`, and `server_timestamp`. - Implemented feed helpers in the service: ` _parse_datetime`, `_get_active_statuses` (uses `sqlalchemy.func.max` to pick latest run per agent), `_list_*_for_feed` for `runs/events/alerts/approvals`, `_next_cursor`, section serializers (`_serialize_run/_serialize_event/_serialize_alert/_serialize_approval`), and count helpers `_count_unread_alerts/_count_pending_approvals` to return aggregate counts. - Queries are filtered and ordered to support `since` and `cursor` semantics and per-section limits to enable efficient incremental pagination. ### Testing - Compiled the modified modules with `python -m compileall backend/api/agents_api.py backend/services/agent_activity_service.py` and the files compiled successfully. - Re-ran `python -m compileall backend/services/agent_activity_service.py` to validate the service file and it also compiled successfully. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69a5b38d901083288a919b20a77f4c25) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:03:11 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#676
No description provided.