Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ’„ fix(goal): open a delivered Task node on its result surface (#21866)

Arvin Xu50e4260819a7
diff --git a/src/features/AgentGoals/ProcessControl/useGoalProcessActions.test.ts b/src/features/AgentGoals/ProcessControl/useGoalProcessActions.test.ts
index 4aaf6546578..4f6f7cdeb45 100644
--- a/src/features/AgentGoals/ProcessControl/useGoalProcessActions.test.ts
+++ b/src/features/AgentGoals/ProcessControl/useGoalProcessActions.test.ts
@@ -52,19 +52,33 @@ describe('useGoalNodeSelect', () => {
portal.openTaskResult.mockClear();
});
- // Regression: a settled or running Task opened its result surface, but a
- // Task link is read as "show me the Task" β€” the original Task detail.
- it('opens the original Task detail for a settled or running Task', () => {
+ // Regression: a resolved Task opened the original Task detail, which leads
+ // with the instruction contract and buries the delivery under the acceptance
+ // and the activity feed. A finished Task is read for its result.
+ it('opens the result surface for a Task that has delivered', () => {
const graph = graphOf([
node('done', { resolvedAt: T0, status: 'resolved', taskId: 'task-done' }),
- node('running', { status: 'active', taskId: 'task-running', updatedAt: new Date() }),
]);
const { result } = renderHook(() => useGoalNodeSelect('goal-1', graph));
result.current('done');
+
+ expect(portal.openTaskResult.mock.calls).toEqual([['task-done']]);
+ expect(portal.openTaskDetail).not.toHaveBeenCalled();
+ expect(portal.openGoalNode).not.toHaveBeenCalled();
+ });
+
+ it('opens the original Task detail for a Task still waiting or running', () => {
+ const graph = graphOf([
+ node('waiting', { status: 'proposed', taskId: 'task-waiting' }),
+ node('running', { status: 'active', taskId: 'task-running', updatedAt: new Date() }),
+ ]);
+ const { result } = renderHook(() => useGoalNodeSelect('goal-1', graph));
+
+ result.current('waiting');
result.current('running');
- expect(portal.openTaskDetail.mock.calls).toEqual([['task-done'], ['task-running']]);
+ expect(portal.openTaskDetail.mock.calls).toEqual([['task-waiting'], ['task-running']]);
expect(portal.openTaskResult).not.toHaveBeenCalled();
expect(portal.openGoalNode).not.toHaveBeenCalled();
});
diff --git a/src/features/AgentGoals/ProcessControl/useGoalProcessActions.ts b/src/features/AgentGoals/ProcessControl/useGoalProcessActions.ts
index 98430c6e33c..0145b94f848 100644
--- a/src/features/AgentGoals/ProcessControl/useGoalProcessActions.ts
+++ b/src/features/AgentGoals/ProcessControl/useGoalProcessActions.ts
@@ -6,18 +6,20 @@ import { useGoalStore } from '@/store/goal';
import { isExperiment } from '../Experiments/model';
import type { FrontierActions } from './Frontier';
-import { type GoalGraphView } from './goalGraphViewModel';
+import { type GoalGraphView, hasReviewableResult } from './goalGraphViewModel';
/**
* Where a click on a goal graph node lands, shared by every host of the
* process-control sections (goal page, conversation portal) and every link to
- * a node. A node with a Task behind it shows the original Task detail β€”
- * configuration, runs and deliveries all live there β€” so a Task link never
- * lands on a node drill-down or a partial view of the Task. Everything else
- * opens the node drill-down.
+ * a node. A Task that has delivered β€” resolved, or done and under verification
+ * β€” opens its result surface: the report, the verdict on it and the artifacts,
+ * which is what the reader of a finished Task came for. A Task still waiting,
+ * running or in trouble opens the original Task detail, where configuration,
+ * runs and failure context live. Everything else opens the node drill-down.
*/
export const useGoalNodeSelect = (goalId: string, graph?: GoalGraphView) => {
const openTaskDetail = useChatStore((s) => s.openTaskDetail);
+ const openTaskResult = useChatStore((s) => s.openTaskResult);
const openGoalNode = useChatStore((s) => s.openGoalNode);
return useCallback(
@@ -28,9 +30,10 @@ export const useGoalNodeSelect = (goalId: string, graph?: GoalGraphView) => {
openGoalNode(goalId, nodeId);
return;
}
- openTaskDetail(taskId);
+ if (view && hasReviewableResult(view)) openTaskResult(taskId);
+ else openTaskDetail(taskId);
},
- [goalId, graph, openGoalNode, openTaskDetail],
+ [goalId, graph, openGoalNode, openTaskDetail, openTaskResult],
);
};