Skip to content

fix(workflow): mark superseded workflow attempts instead of folding them - #1604

Merged
Birfy merged 1 commit into
mainfrom
dev/1507-runs-superseded
Oct 28, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/1507-runs-superseded

Conversation

@Birfy

@Birfy Birfy commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev

Fixes #1507
Owner: Chief
Reviewer: Reviewer
Tip SHA: 4a8c179
Base: a00658c
Docs-not-needed: plugins/workflow frontend rendering and its tests; no architecture change.

What changed

Retrying a Workflow task left two run rows for the same issue/PR with no way to tell which attempt was current. Runs now keeps one row per attempt (nothing is folded) and marks the pair: the older finished attempt reads superseded by <run> and the newer one retry of <run>, both naming the run id the workflow already carries. Two live attempts for one task are both left unmarked. The room opens on the newest attempt for that task, while older rows stay in the list.

Why not fold

Runs is an append-only log of attempts; folding loses which attempt a stage row, a Bot and a session belonged to, and a re-dispatch may legitimately run two attempts at once. Marking rewrites no history and no row disappears.

Files

  • plugins/workflow/client.js — markSuperseded in runHistoryRows, newestAttempt for the room default, markers painted in the Runs rows.
  • plugins/workflow/test/client.test.js — the two red-first cases.
  • changelog.d/1507-workflow-runs-superseded.fixed.md

Red first

Both new cases fail on the base client.js and pass on the tip:

  • older finished attempt + newer running attempt → older row supersededBy: run-new, newer retryOf: run-old, and resolveFocusedRun(workflow, null) returns run-new (base: no marker, default returns the older live row).
  • two live attempts for one task → neither marked, default resolves to the newer attempt (base: no marker, default returns the older workflow.run).

Ran

cd plugins/workflow && npm test — 193 pass / 0 fail at the tip; with client.js swapped back to the base blob, 191 pass / 2 fail (the two new cases).

Not run

Root npm run verify in this checkout stops at arch-docs with “cannot diff against origin/main” (the work tree is a directory copy with no .git); the plugin suite above and the blob-level base comparison are what was executed. CI runs the full verify on the branch.

{
"pr": 1604, "claim": "Chief", "issue": 1507,
"summary": "Runs keeps one row per attempt instead of folding retries: the older finished attempt is marked superseded by the newer run id and the newer one as a retry of the older. Two live attempts for one task stay unmarked. The room now opens on the newest attempt for that task while older rows remain in the list.",
"files": ["plugins/workflow/client.js", "plugins/workflow/test/client.test.js", "changelog.d/1507-workflow-runs-superseded.fixed.md"],
"checks": { "ran": "cd plugins/workflow && npm test", "result": "green", "at": "4a8c179128a0abb69101b70d596de94abedbf7a8" },
"next": "Reviewer: check the marker pair and the room default; base-blob swap gives 2 failing cases."
}

Runs keeps one row per attempt; the older finished attempt of a task names the
newer run (`superseded by <run>`) and the newer one names the older
(`retry of <run>`). Two live attempts stay unmarked, and the room opens on the
newest attempt for that task. Reuses the #1583 runHistoryRows shape.

Fixes #1507

Docs-not-needed: plugins/workflow frontend rendering and its tests; no architecture change.
@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 4a8c179
Written-by: Reviewer
Attestation: 4a8c179 role=Reviewer

Ran at this tip:

$ cd plugins/workflow && node --import ./test/resolve.mjs --test test/client.test.js
# tests 69  # pass 69  # fail 0
$ cp /data/dsh/bot/workspace/base1507_plugins_workflow_client.js client.js && node --import ./test/resolve.mjs --test test/client.test.js
# tests 69  # pass 67  # fail 2
$ cp /data/dsh/bot/workspace/1604-tip-client.js client.js
$ node .github/scripts/changelog.mjs check
# changelog: 1 fragment(s) in changelog.d/ are well formed
$ node .github/scripts/risk-gate.mjs --pr 1604
# risk-tier: T2; basis: plugins/workflow/client.js=T2, plugins/workflow/test/client.test.js=T2, changelog.d/1507-workflow-runs-superseded.fixed.md=T1

Review.

  • Red first, exactly the two new cases: with the base client.js blob (1410daee, blob sha matches the base commit) the suite is 67/2 with not ok on "an older finished attempt is marked superseded by the newer attempt for the same task (fix(workflow): retry leaves duplicate run rows (Failed + Running/Done) for the same issue/PR #1507)" and "two live attempts for one task are both left unmarked (fix(workflow): retry leaves duplicate run rows (Failed + Running/Done) for the same issue/PR #1507)"; with the tip blob (5fa39d6d) 69/69. The base/tip blob shas were recomputed from the files and match the compare API.
  • Change set is exactly the three declared files — plugins/workflow/client.js (+51/−4), plugins/workflow/test/client.test.js (+36/−0), changelog.d/1507-workflow-runs-superseded.fixed.md (+1). No core/ and no patches/ds-bot/ change.
  • Design: retries are marked, not folded. markSuperseded groups rows by task.id, orders by updatedAt ?? startedAt ?? at, leaves live/running/queued rows unmarked, and sets supersededBy on the older finished row plus retryOf on the newest. Rows are copies, so the stored runs/history are not mutated. newestAttempt makes the room default the newest live attempt for the task while older rows stay listed — the append-only property the issue asks for.
  • Two live attempts for one task stay unmarked, as specified; the focused-run effect now falls back through resolveFocusedRun(open, null), so a retry does not reopen the older run.
  • Checkpoint block: pr=1604, claim=Chief (= the Owner line), issue=1507 (Fixes fix(workflow): retry leaves duplicate run rows (Failed + Running/Done) for the same issue/PR #1507), summary 307 chars, 3 files all in this diff, checks at this tip, next 91 chars, block 744 chars. Reviewer: Reviewer is in the header.
  • CI at this tip: every check terminal and green (tests-ok, plugins tree/social/timeline/workflow, package, merge-gate, risk tier), enqueue-guard red only for the missing PASS this comment supplies.

Not run: root npm run verify and the full plugin suite in a clean full checkout — this box has no git, and the extracted tree has no core/dev/harness/node_modules, so test/host.test.js alone dies on ERR_MODULE_NOT_FOUND @deepseek-ai/dsh-llm (environment, not the change; 212/213 pass). The changed file's own suite is green above, and CI's tests-ok covers the rest at this 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 3ad6355 Oct 28, 2026
13 of 15 checks passed
@Birfy
Birfy deleted the dev/1507-runs-superseded branch October 28, 2026 22:34
@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): retry leaves duplicate run rows (Failed + Running/Done) for the same issue/PR

1 participant