Skip to content

fix(workflow): list a failed live attempt once in Runs - #1585

Merged
Birfy merged 1 commit into
mainfrom
dev/1583-runs-dedup-failed-live
Oct 28, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/1583-runs-dedup-failed-live

Conversation

@Birfy

@Birfy Birfy commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Claim 5819

Fixes #1583

Owner: Chief
Reviewer: Reviewer

Tip SHA: 6a5fefb
Base: 2998941
Docs-not-needed: the Runs tab still lists one row per attempt; no documented architecture changes.

What changed

With no run active and the last attempt failed, the Runs tab painted that attempt twice: a live row for the failed run plus its own history row. runHistoryRows keyed a live row by its run id and a history row by task id plus time, so the two never matched. A live row now carries both keys, so the failed attempt is listed once and still labelled Failed (its status already comes from run.status). A real retry — history failed at an earlier time, live run running — still shows two rows with the current one marked current.

Red first

Added two cases in plugins/workflow/test/client.test.js: the failed-live case (rows.length === 1, status failed, zero running) and a genuine-retry guard (two rows, ['running','failed'], [true,false]). Against the base blob of client.js the failed-live case fails with 2 !== 1; with the change all 56 cases in the file pass. The existing runHistoryRows cases and the runs tab shows one running row per concurrent live run stay green.

Ran / not run

Ran: in plugins/workflow: node --import ./test/resolve.mjs --test test/client.test.js — 56 pass, 0 fail (55 pass, 1 fail on the base blob).
Not run: npm run verify and oxlint — no repo node_modules in this checkout; CI runs them.

Scope and risk

Client display only in plugins/workflow/client.js; no service, state, key or permission change. Adds the changelog fragment changelog.d/1583-workflow-runs-dedup.fixed.md.

Checkpoint

{
"pr": 1585, "claim": "Chief", "issue": 1583,
"summary": "Runs no longer lists a failed last attempt twice. A live row is keyed by its run id and by task id plus time, so the history row that is the same attempt is skipped and the attempt shows once, labelled Failed. A genuine retry still shows the earlier failed attempt and the current running one. Client display only; two tests added, the failed-live case red on the base blob.",
"files": ["plugins/workflow/client.js", "plugins/workflow/test/client.test.js", "changelog.d/1583-workflow-runs-dedup.fixed.md"],
"checks": { "ran": "node --import ./test/resolve.mjs --test test/client.test.js (plugins/workflow)", "result": "green", "at": "6a5fefb2c5558397d37c473eed79ee4455261018" },
"next": "none — ready for review"
}

A failed attempt stays live and also has its own history row; runHistoryRows
keyed a live row by its run id and a history row by task id plus time, so the
two never matched and the Runs tab painted the same attempt twice. Key live
rows by both, so the failed attempt shows once while a real retry still shows
the earlier attempt and the current one.

Fixes #1583

Docs-not-needed: the Runs tab still lists one row per attempt; no documented
architecture changes.
@Birfy Birfy added the agent-pr Pull request opened by an agent label Oct 28, 2026
@Birfy Birfy self-assigned this Oct 28, 2026
@Birfy

Birfy commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at 6a5fefb
Written-by: Reviewer
Attestation: 6a5fefb role=Reviewer

Ran at this tip:

$ cd plugins/workflow && node --import ./test/resolve.mjs --test test/client.test.js test/timeline-locale.test.js
# tests 67  # pass 67  # fail 0
$ node .github/scripts/changelog.mjs check
# 75 fragment(s) in changelog.d/ are well formed

Red first: the same two commands with only plugins/workflow/client.js reverted to the base blob 750fa802 (2998941) go red on the new case alone — not ok 27 - a failed live attempt is listed once, as failed, not as its own history row (#1583), 66 pass / 1 fail — and back to 67/67 with the tip blob 21c1a8f6 restored.

Review points:

  • Scope: compare 2998941...6a5fefb is 3 files, +36/-1 — plugins/workflow/client.js (+5/-1), plugins/workflow/test/client.test.js (+30), changelog.d/1583-workflow-runs-dedup.fixed.md (new). No core/, no patches/ds-bot/, no unrelated file.
  • Fix: a live row now contributes both its run id and task.id|at to the seen set, so the failed attempt's own history row (service builds history as { task, status, at }, no id) is skipped, while a retry at a different at keeps both rows. runHistoryRows still labels the surviving row failed.
  • Tests: the red-first case covers rows.length 1, status failed, zero running; the retry case pins ['running','failed'] / [true,false], so the dedup cannot swallow a real second attempt. Existing runHistoryRows cases and the runs tab shows one running row per concurrent live run stay green.
  • Checks at the tip: 15 check-runs, all terminal; tests-ok, plugins (workflow), package and merge-gate succeed. The one failure is enqueue-guard at 12:43:41Z, before tests-ok finished at 12:45:19Z and before any PASS existed at this tip — the expected red this PASS clears.
  • Nit, not blocking: the PR body's first line is Written-by: Claim 5819, which names no Bot (a comment Written-by: Claim d573 has the same shape); the gates do not read it, but the attribution rule asks for a Bot name.

Not run: the full plugins/workflow suite and root npm run verify — this checkout has no installed harness or node_modules; CI's plugins (workflow) and tests-ok ran green at this same tip.

@github-actions github-actions Bot added the pass label Oct 28, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit ac7a916 Oct 28, 2026
13 of 15 checks passed
@Birfy
Birfy deleted the dev/1583-runs-dedup-failed-live branch October 28, 2026 13:04
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(workflow): Runs shows a failed last attempt twice (phantom Running + Failed)

1 participant