Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1583-workflow-runs-dedup.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
With no run active and the last attempt failed, the workflow **Runs** tab listed that same attempt twice: a phantom row for the live run plus its own history row. It now lists one row per attempt — the failed attempt appears once, marked `Failed` — while a real retry still shows the earlier attempt and the current one ([#1583](https://github.com/ThinkFlowLab/FlyBot/issues/1583)).
6 changes: 5 additions & 1 deletion plugins/workflow/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,11 @@ window.__ModuleLoader__.load({
current: workflow.run?.id === run.id,
}))
for (const task of queued) rows.push({ task, status: 'queued', current: false })
const seen = new Set(rows.map(row => row.id ?? `${row.task?.id ?? ''}|${row.at ?? ''}`))
const seen = new Set()
for (const row of rows) {
if (row.id) seen.add(row.id)
seen.add(`${row.task?.id ?? ''}|${row.at ?? ''}`)
}
for (const item of history) {
const key = item.id ?? `${item.task?.id ?? ''}|${item.at ?? ''}`
if (seen.has(key)) continue
Expand Down
30 changes: 30 additions & 0 deletions plugins/workflow/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,36 @@ test('run history does not invent a second running row when only one live run ex
assert.equal(rows.filter(row => row.status === 'running').length, 1)
})

test('a failed live attempt is listed once, as failed, not as its own history row (#1583)', () => {
const task = { id: '#1422', title: 'PR 1422' }
const workflow = {
activeCount: 0,
queue: [],
runs: [{ id: 'run-a', live: true, status: 'failed', task, updatedAt: 1_700_000_000_000 }],
run: { id: 'run-a', live: true, status: 'failed', task, updatedAt: 1_700_000_000_000 },
history: [{ task, status: 'failed', at: 1_700_000_000_000 }],
}
const rows = client.runHistoryRows(workflow)
assert.equal(rows.length, 1)
assert.equal(rows[0].status, 'failed')
assert.equal(rows.filter(row => row.status === 'running').length, 0)
})

test('a genuine retry still shows the failed attempt and the current one (#1583)', () => {
const task = { id: '#1422', title: 'PR 1422' }
const workflow = {
activeCount: 1,
queue: [],
runs: [{ id: 'run-b', live: true, status: 'running', task, updatedAt: 1_700_000_100_000 }],
run: { id: 'run-b', live: true, status: 'running', task, updatedAt: 1_700_000_100_000 },
history: [{ task, status: 'failed', at: 1_700_000_000_000 }],
}
const rows = client.runHistoryRows(workflow)
assert.equal(rows.length, 2)
assert.deepEqual(rows.map(row => row.status), ['running', 'failed'])
assert.deepEqual(rows.map(row => row.current), [true, false])
})

test('the runs tab shows one running row per concurrent live run', async () => {
const graph = delivery()
graph.activeCount = 2
Expand Down
Loading