fix: prevent approval button showing while agent is working (#117)

This commit is contained in:
João Salavisa
2026-01-28 22:14:00 +00:00
committed by GitHub
parent d6efffd29d
commit 83e3429089
2 changed files with 13 additions and 3 deletions
@@ -892,14 +892,22 @@ func (s *Service) updateTaskSessionState(ctx context.Context, taskID, sessionID
zap.String("old_state", string(oldState)),
zap.String("new_state", string(nextState)))
if s.eventBus != nil {
_ = s.eventBus.Publish(ctx, events.TaskSessionStateChanged, bus.NewEvent(events.TaskSessionStateChanged, "task-session", map[string]interface{}{
eventData := map[string]interface{}{
"task_id": taskID,
"session_id": sessionID,
"old_state": string(oldState),
"new_state": string(nextState),
"agent_profile_id": session.AgentProfileID,
"agent_profile_snapshot": session.AgentProfileSnapshot,
}))
}
// Include review_status and workflow_step_id if present to ensure frontend state consistency
if session.ReviewStatus != nil {
eventData["review_status"] = *session.ReviewStatus
}
if session.WorkflowStepID != nil {
eventData["workflow_step_id"] = *session.WorkflowStepID
}
_ = s.eventBus.Publish(ctx, events.TaskSessionStateChanged, bus.NewEvent(events.TaskSessionStateChanged, "task-session", eventData))
}
}
+3 -1
View File
@@ -131,7 +131,9 @@ export function TaskChatPanel({
// Check if we should show the approve button
// Show when session has a review_status that is not approved (meaning it's in a review step)
const showApproveButton = session?.review_status != null && session.review_status !== 'approved';
// Also hide while agent is working to prevent premature approval
const showApproveButton =
session?.review_status != null && session.review_status !== 'approved' && !isWorking;
const handleSubmit = async (event?: FormEvent) => {
event?.preventDefault();