CaroFernando commented on code in PR #8753:
URL: https://github.com/apache/texera/pull/8753#discussion_r4590932543


##########
agent-service/src/server.ts:
##########
@@ -482,7 +482,8 @@ export function buildApp() {
         switch (msg.type) {
           case "WsClientStopCommand":
             agent.stop();
-            broadcastToAgentClients(agentId, new 
WsServerStatusEvent(AgentState.STOPPING));
+            // Broadcast the resulting state: STOPPING mid-run, unchanged when 
idle.
+            broadcastToAgentClients(agentId, new 
WsServerStatusEvent(agent.getState()));

Review Comment:
   Fixed in 37e4a3a. `POST /agents/:id/stop` now returns `{ status: 
agent.getState() }`, same as the WS handler. I split the old spec into two: a 
mid-run stop returns `STOPPING`, and an idle stop returns `AVAILABLE`. bun test 
passes 348 tests after rebasing on main.



##########
frontend/src/app/workspace/service/agent/agent.service.ts:
##########
@@ -960,6 +960,13 @@ export class AgentService {
     });
   }
 
+  /**
+   * Get the latest known state of an agent synchronously, without creating 
tracking.
+   */
+  public getAgentStateSnapshot(agentId: string): AgentState {

Review Comment:
   Agreed, done in 37e4a3a. `getAgentState` is now `defer(() => 
of(this.getAgentStateSnapshot(agentId)))`, so the rule lives only in the 
snapshot method. The existing `getAgentState` specs still pass unchanged.



##########
frontend/src/app/workspace/component/agent/agent-interaction/agent-interaction.component.ts:
##########
@@ -172,8 +180,13 @@ export class AgentInteractionComponent implements OnInit, 
OnChanges {
     }
   }
 
+  public isSelectedAgentAvailable(): boolean {
+    if (!this.selectedAgentId) return false;
+    return this.agentService.getAgentStateSnapshot(this.selectedAgentId) === 
AgentState.AVAILABLE;
+  }
+
   public canSend(): boolean {
-    return !!this.selectedAgentId && !!this.feedbackMessage.trim();
+    return !!this.selectedAgentId && !!this.feedbackMessage.trim() && 
this.isSelectedAgentAvailable();

Review Comment:
   Updated the description. It now covers the feedback-panel gate, 
`getAgentStateSnapshot`, the idle `stop()` no-op, both stop paths reporting the 
real state, and the current test counts. I also added before/after screenshots 
of the feedback panel mid-run.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to