[P1] Synchronous command dispatch to all agents #116

Closed
opened 2026-04-02 18:49:03 +02:00 by claude · 1 comment
Owner

Parent Epic

#100

Problem

Commands (log levels, tracing, taps, start/stop/resume/suspend) currently fire-and-forget to a single agent. They should broadcast to all live agents for an application and collect responses with a timeout. Only replay should remain per-instance.

Proposed Solution

  • Change command dispatch to target all live agents for an application
  • Collect responses from all agents (we know how many are live)
  • Wait for all responses or timeout
  • Return aggregated result: { success, responses: [{ agentId, status, error? }], timedOut: string[] }

Acceptance Criteria

  • Log level, tracing, tap, and route control commands broadcast to all live agents
  • Server collects responses from all agents with configurable timeout
  • API returns aggregated success/failure per agent
  • Replay command remains per-instance
  • Timed-out agents listed in response
## Parent Epic #100 ## Problem Commands (log levels, tracing, taps, start/stop/resume/suspend) currently fire-and-forget to a single agent. They should broadcast to all live agents for an application and collect responses with a timeout. Only replay should remain per-instance. ## Proposed Solution - Change command dispatch to target all live agents for an application - Collect responses from all agents (we know how many are live) - Wait for all responses or timeout - Return aggregated result: `{ success, responses: [{ agentId, status, error? }], timedOut: string[] }` ## Acceptance Criteria - [ ] Log level, tracing, tap, and route control commands broadcast to all live agents - [ ] Server collects responses from all agents with configurable timeout - [ ] API returns aggregated success/failure per agent - [ ] Replay command remains per-instance - [ ] Timed-out agents listed in response
Author
Owner

Implemented in 027e45a (backend) and c3b4f70 (frontend).

Backend:

  • AgentRegistryService.addGroupCommandWithReplies() — sends command to all LIVE agents, returns Map<agentId, CompletableFuture<CommandReply>>
  • AgentCommandController.sendGroupCommand() — now waits for all agent responses with a shared 10-second deadline, returns CommandGroupResponse with per-agent status
  • ApplicationConfigController.updateConfig() — now returns ConfigUpdateResponse wrapping the config + CommandGroupResponse from the synchronous push
  • New DTOs: CommandGroupResponse, ConfigUpdateResponse

Frontend:

  • CommandGroupResponse and ConfigUpdateResponse types added
  • useSendRouteCommand() and useSendGroupCommand() return CommandGroupResponse
  • useUpdateApplicationConfig() returns ConfigUpdateResponse, consumers updated to access result.config.version

Response shape:

{
  "success": true,
  "total": 3,
  "responded": 3,
  "responses": [
    { "agentId": "agent-1", "status": "SUCCESS", "message": "Route stopped" },
    { "agentId": "agent-2", "status": "SUCCESS", "message": "Route stopped" }
  ],
  "timedOut": []
}
Implemented in `027e45a` (backend) and `c3b4f70` (frontend). **Backend:** - `AgentRegistryService.addGroupCommandWithReplies()` — sends command to all LIVE agents, returns `Map<agentId, CompletableFuture<CommandReply>>` - `AgentCommandController.sendGroupCommand()` — now waits for all agent responses with a shared 10-second deadline, returns `CommandGroupResponse` with per-agent status - `ApplicationConfigController.updateConfig()` — now returns `ConfigUpdateResponse` wrapping the config + `CommandGroupResponse` from the synchronous push - New DTOs: `CommandGroupResponse`, `ConfigUpdateResponse` **Frontend:** - `CommandGroupResponse` and `ConfigUpdateResponse` types added - `useSendRouteCommand()` and `useSendGroupCommand()` return `CommandGroupResponse` - `useUpdateApplicationConfig()` returns `ConfigUpdateResponse`, consumers updated to access `result.config.version` **Response shape:** ```json { "success": true, "total": 3, "responded": 3, "responses": [ { "agentId": "agent-1", "status": "SUCCESS", "message": "Route stopped" }, { "agentId": "agent-2", "status": "SUCCESS", "message": "Route stopped" } ], "timedOut": [] } ```
Sign in to join this conversation.