32 lines
2.3 KiB
Plaintext
32 lines
2.3 KiB
Plaintext
Fix two issues in ~/src/mosaic-stack related to dashboard widgets:
|
|
|
|
## Issue 1: Rate limiting on widget polling endpoints (429 errors)
|
|
The widget data endpoint POST /api/widgets/data/* is being rate-limited because the dashboard polls it frequently from the same IP. Internal dashboard polling should not be throttled like external API traffic.
|
|
|
|
Fix: Add @SkipThrottler() decorator to the widgets data controller/endpoints.
|
|
Find the controller: grep -r "widgets/data\|WidgetData\|widget.*controller" apps/api/src --include="*.ts" -l
|
|
|
|
## Issue 2: Missing /api/orchestrator/agents and /api/orchestrator/events endpoints
|
|
The AgentStatusWidget in apps/web polls GET /api/orchestrator/agents and subscribes to GET /api/orchestrator/events (SSE). These endpoints do not exist, causing "Failed to fetch agents:" errors in the UI.
|
|
|
|
Implement a minimal orchestrator controller that:
|
|
- GET /api/orchestrator/agents — returns list of active agent containers from the agents table (id, name, status, type, createdAt). Protected by AuthGuard.
|
|
- GET /api/orchestrator/events — SSE endpoint that streams agent status change events. Can be a simple implementation that polls the agents table every 5 seconds and sends updates. Protected by AuthGuard.
|
|
|
|
Reference: apps/api/src/agent-config/ for the agents table schema and existing queries.
|
|
Create: apps/api/src/orchestrator/orchestrator.controller.ts + orchestrator.module.ts
|
|
Wire into AppModule.
|
|
|
|
## Process
|
|
1. git checkout main && git pull --ff-only origin main
|
|
2. Branch: fix/orchestrator-widgets
|
|
3. Fix Issue 1 first (small change), then Issue 2
|
|
4. Run: pnpm turbo lint typecheck --filter=@mosaic/api
|
|
5. Run: pnpm --filter @mosaic/api test -- --run
|
|
6. Review: confirm @SkipThrottler only on widget endpoints, confirm orchestrator endpoints are auth-guarded
|
|
7. Commit: "fix(api): skip throttler for widget polling; add orchestrator agents/events endpoints"
|
|
8. Push + PR: ~/.config/mosaic/tools/git/pr-create.sh -t "fix(api): widget throttling and orchestrator endpoints" -b "Adds @SkipThrottler to widget data endpoints (internal polling should not be rate-limited). Implements GET /api/orchestrator/agents and GET /api/orchestrator/events SSE endpoint for AgentStatusWidget."
|
|
|
|
When completely finished:
|
|
openclaw system event --text "Done: orchestrator widgets fix PR ready" --mode now
|