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): show a gate-held batch round as waiting for release, not in progress (#22750)

Arvin Xu2e8ad9ff70e8
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index 4c03d5ef0b0..c221cbd5b30 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -604,6 +604,7 @@
"goalBatch.skill.forked": "Plan skill v{{revision}} · new class",
"goalBatch.skill.title": "Plan skill v{{revision}}",
"goalBatch.status.done": "All done",
+ "goalBatch.status.held": "Waiting for your release",
"goalBatch.status.human": "{{count}} need you",
"goalBatch.status.pending": "Not started",
"goalBatch.status.running": "In progress",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index cbb2e080ce6..533efe7f25b 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -604,6 +604,7 @@
"goalBatch.skill.forked": "方案技能 v{{revision}} · 新类型",
"goalBatch.skill.title": "方案技能 v{{revision}}",
"goalBatch.status.done": "全部完成",
+ "goalBatch.status.held": "等你放行",
"goalBatch.status.human": "{{count}} 项需要介入",
"goalBatch.status.pending": "待开始",
"goalBatch.status.running": "进行中",
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 1f7ba152971..3bb4304e5ad 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -196,6 +196,7 @@ export default {
'goalBatch.round.reviseEdge': 'Sent back · revise',
'goalBatch.round.title': 'Round {{revision}}',
'goalBatch.status.done': 'All done',
+ 'goalBatch.status.held': 'Waiting for your release',
'goalBatch.status.human': '{{count}} need you',
'goalBatch.status.pending': 'Not started',
'goalBatch.status.running': 'In progress',
diff --git a/src/features/AgentGoals/ProcessControl/Graph/BatchGroups.tsx b/src/features/AgentGoals/ProcessControl/Graph/BatchGroups.tsx
index 4e9438f842e..9b0ab55091d 100644
--- a/src/features/AgentGoals/ProcessControl/Graph/BatchGroups.tsx
+++ b/src/features/AgentGoals/ProcessControl/Graph/BatchGroups.tsx
@@ -51,6 +51,7 @@ import {
type BatchUnitOrigin,
countCells,
reopenedRows,
+ unitsPhase,
} from './batchModel';
/**
@@ -501,20 +502,33 @@ const useUnitsStatus = () => {
cells: { state: BatchCellState }[],
copy: { done: string; pending: string; running: string },
started: boolean,
+ held?: boolean,
): GroupStatus => {
const counts = countCells(cells);
- if (counts.human)
- return { ...CELL_VISUAL.human, text: t('goalBatch.status.human', { count: counts.human }) };
- if (counts.stale && counts.stale + counts.done < cells.length)
- return {
- color: cssVar.colorWarning,
- icon: CircleSlash,
- text: t('goalBatch.status.stale', { count: counts.stale }),
- };
- if (cells.length > 0 && counts.done + counts.stale === cells.length)
- return { ...CELL_VISUAL.done, text: copy.done };
- if (!started && !counts.running) return { ...CELL_VISUAL.backlog, text: copy.pending };
- return { ...CELL_VISUAL.running, running: true, text: copy.running };
+ switch (unitsPhase(cells, started, held)) {
+ case 'human': {
+ return { ...CELL_VISUAL.human, text: t('goalBatch.status.human', { count: counts.human }) };
+ }
+ case 'stale': {
+ return {
+ color: cssVar.colorWarning,
+ icon: CircleSlash,
+ text: t('goalBatch.status.stale', { count: counts.stale }),
+ };
+ }
+ case 'done': {
+ return { ...CELL_VISUAL.done, text: copy.done };
+ }
+ case 'held': {
+ return { ...CELL_VISUAL.human, text: t('goalBatch.status.held') };
+ }
+ case 'pending': {
+ return { ...CELL_VISUAL.backlog, text: copy.pending };
+ }
+ default: {
+ return { ...CELL_VISUAL.running, running: true, text: copy.running };
+ }
+ }
};
};
@@ -819,6 +833,8 @@ const useOriginCopy = () => {
};
export interface BatchWavesData extends Record<string, unknown> {
+ /** The round's gate is holding the next wave for a person's release. */
+ held?: boolean;
/** Open the batch on its own, the way a person reviews one batch at a time. */
onEnter: () => void;
onSelect: (nodeId: string) => void;
@@ -835,7 +851,7 @@ export interface BatchWavesData extends Record<string, unknown> {
/** A round's waves: the units it re-opened, then the roster waves it owns. */
export const BatchWavesGroup = memo<NodeProps>(({ data }) => {
- const { onEnter, onSelect, probes, retros, revision, rows, started, waveSize } =
+ const { held, onEnter, onSelect, probes, retros, revision, rows, started, waveSize } =
data as BatchWavesData;
const { t } = useTranslation('chat');
const label = useCellLabel();
@@ -858,6 +874,7 @@ export const BatchWavesGroup = memo<NodeProps>(({ data }) => {
running: t('goalBatch.status.running'),
},
started,
+ held,
);
return (
<GroupShell
diff --git a/src/features/AgentGoals/ProcessControl/Graph/batchFlowNodes.ts b/src/features/AgentGoals/ProcessControl/Graph/batchFlowNodes.ts
index f7c48920420..1bfb73bd1f8 100644
--- a/src/features/AgentGoals/ProcessControl/Graph/batchFlowNodes.ts
+++ b/src/features/AgentGoals/ProcessControl/Graph/batchFlowNodes.ts
@@ -92,6 +92,7 @@ export const buildBatchFlowNodes = ({
views: byId,
}
: ({
+ held: round.gate === 'human',
onEnter: () => onEnter(batchStageId(batchId, group.revision)),
onSelect,
probes: round.probes,
diff --git a/src/features/AgentGoals/ProcessControl/Graph/batchModel.test.ts b/src/features/AgentGoals/ProcessControl/Graph/batchModel.test.ts
index 8c152b40c12..9c57eb48d5f 100644
--- a/src/features/AgentGoals/ProcessControl/Graph/batchModel.test.ts
+++ b/src/features/AgentGoals/ProcessControl/Graph/batchModel.test.ts
@@ -14,12 +14,14 @@ import { describe, expect, it } from 'vitest';
import { buildGoalGraphView } from '../goalGraphViewModel';
import { batchGroupId, layoutBatch } from './batchLayout';
+import type { BatchCellState } from './batchModel';
import {
batchPlanTitleKey,
buildBatchModel,
findBatchGate,
findBatchPlan,
reopenedRows,
+ unitsPhase,
verdictChecks,
} from './batchModel';
import {
@@ -793,3 +795,19 @@ describe('batchStages', () => {
expect(parseBatchStageId('batch-1')).toBeUndefined();
});
});
+
+describe('unitsPhase', () => {
+ const cells = (...states: BatchCellState[]) => states.map((state) => ({ state }));
+
+ it('reads a round its gate holds for a person as waiting, not in progress', () => {
+ const roster = cells('done', 'backlog', 'backlog', 'backlog');
+ expect(unitsPhase(roster, true)).toBe('running');
+ expect(unitsPhase(roster, true, true)).toBe('held');
+ });
+
+ it('keeps live work, units needing a person and finished rounds ahead of the hold', () => {
+ expect(unitsPhase(cells('done', 'running', 'backlog'), true, true)).toBe('running');
+ expect(unitsPhase(cells('human', 'backlog'), true, true)).toBe('human');
+ expect(unitsPhase(cells('done', 'done'), true, true)).toBe('done');
+ });
+});
diff --git a/src/features/AgentGoals/ProcessControl/Graph/batchModel.ts b/src/features/AgentGoals/ProcessControl/Graph/batchModel.ts
index 6457bb35a75..098f85f7a6c 100644
--- a/src/features/AgentGoals/ProcessControl/Graph/batchModel.ts
+++ b/src/features/AgentGoals/ProcessControl/Graph/batchModel.ts
@@ -478,6 +478,27 @@ export const countCells = (cells: { state: BatchCellState }[]) => {
return counts;
};
+export type BatchUnitsPhase = 'done' | 'held' | 'human' | 'pending' | 'running' | 'stale';
+
+/**
+ * One group's phase from its units: a person first, then progress. A group its
+ * gate holds for a person, with nothing running, waits on that person — its
+ * started units do not make it "in progress".
+ */
+export const unitsPhase = (
+ cells: { state: BatchCellState }[],
+ started: boolean,
+ held = false,
+): BatchUnitsPhase => {
+ const counts = countCells(cells);
+ if (counts.human) return 'human';
+ if (counts.stale && counts.stale + counts.done < cells.length) return 'stale';
+ if (cells.length > 0 && counts.done + counts.stale === cells.length) return 'done';
+ if (held && !counts.running) return 'held';
+ if (!started && !counts.running) return 'pending';
+ return 'running';
+};
+
/**
* The batch and round a release gate belongs to, when `nodeId` is one — so a
* surface that opens the gate can show its verdicts rather than a bare decision.