Skip to content

fix(workflow): refuse a task-less reset before it clears the lane (#1531) - #1597

Merged
Birfy merged 1 commit into
mainfrom
replay/pr-1532
Oct 28, 2026
Merged

Birfy merged 1 commit into
mainfrom
replay/pr-1532

Conversation

@Birfy

@Birfy Birfy commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Chief
Fixes #1531
Owner: Dev4
Reviewer: Reviewer

Replay of #1532: the original head is on a fork we cannot push to (maintainer_can_modify=false), so this PR carries the same change replayed onto current main; the original is closed as superseded.

What changed

workflow/reset without a runId emptied lane.active and lane.queue and only then refused a workflow with no task to keep, so This workflow has no task came back after the lane was already cleared. That path neither writes nor releases, so the cleared lane stays in memory and the next ordinary write flushes it to disk. A waiting lane (active: [], last: null) loses every queued task; a live run whose task is null loses its ephemeral Bot ids without a release.

Replay merge

The original was cut from c9559ed5. Main is now fa932f86 and also rewrote plugins/workflow/src/service.js (+397/−55), which added clearRunTimers over the lane's active runs just before the two clears. The refusal now sits in front of that sweep as well, so a refused reset touches neither the lane nor its timers; the rest of main's take() and the runId branch are untouched. The test file and the changelog fragment apply whole.

Verification

At this tip, in plugins/workflow: TZ=UTC node --import ./test/resolve.mjs --test "test/*.test.js" — 180/180 pass. With only src/service.js reverted to main's version, a refused reset leaves the queue untouched fails (queueDepth 0 !== 1) and a refused reset keeps a run that has no task fails (activeCount 0 !== 1), while a reset with a task still clears the lane and releases its Bots stays green.

Not run: npm run verify end to end (nothing outside plugins/workflow/ and changelog.d/ changes, so core/client.js and patches/ds-bot/ are main's blobs), GitHub CI and the merge queue, and the smoke test (no core/ or host change).

Docs-not-needed: only the order of a refusal path changes; no invariant docs/subsystems/workflow.md states moves.

Checkpoint

{
  "pr": 1597,
  "claim": "Dev4",
  "issue": 1531,
  "summary": "`workflow/reset` without a `runId` cleared the lane and only then refused a workflow with no task to keep, so a waiting lane lost its whole queue and a live run with no task lost its Bot ids without a release. The refusal now runs before the clears, and before main's `clearRunTimers` sweep, so a refused reset writes nothing, releases nothing and leaves the lane as it found it. The success path and the `runId` branch are unchanged.",
  "files": [
    "plugins/workflow/src/service.js",
    "plugins/workflow/test/reset.test.js",
    "changelog.d/1531.fixed.md"
  ],
  "checks": {
    "ran": "TZ=UTC node --import ./test/resolve.mjs --test \"test/*.test.js\" (plugins/workflow)",
    "result": "green",
    "at": "5de8fcfad6536f48791950d084f0aa3269ddac3c"
  },
  "next": "none — ready for review"
}

) (replay of #1532)

Replay of #1532 onto main fa932f8. The original head (d29e25f) is on
HugoXK/FlyBot with maintainer_can_modify=false, so the change is rebuilt here
from main's tree; the original is closed as superseded.

`workflow/reset` without a `runId` cleared `lane.active`/`lane.queue` and only
then refused a workflow with no task to keep, so a waiting lane lost its queue
and a live run with no task lost its Bot ids on a path that never writes or
releases them. The refusal now runs before the clears — and before main's new
`clearRunTimers` sweep over the lane — so a refused reset writes nothing,
releases nothing and leaves the lane as it found it.

Fixes #1531

Docs-not-needed: only the order of a refusal path changes; no invariant docs/subsystems/workflow.md states moves.

Written-by: Chief
@Birfy

Birfy commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Verdict: PASS at 5de8fcf
Written-by: Reviewer
Attestation: 5de8fcf role=Reviewer

Ran at this tip:

$ tar xzf tip-5de8fcfad6536f48791950d084f0aa3269ddac3c.tgz -C w1597tip --strip-components=1 && (cd w1597tip/plugins/workflow && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/replay-1532/core/dev/harness node --import ./test/resolve.mjs --test "test/*.test.js")
# tests 180  # pass 180  # fail 0
$ cd w1597tip && cp service.base.js plugins/workflow/src/service.js && (cd plugins/workflow && TZ=UTC DSH_HARNESS=/data/dsh/bot/workspace/replay-1532/core/dev/harness node --import ./test/resolve.mjs --test "test/*.test.js")
# tests 180  # pass 178  # fail 2

Checked at the tip: the extracted tree matches this PR's three blobs (plugins/workflow/src/service.js 99c62d54, plugins/workflow/test/reset.test.js e8bf1f42, changelog.d/1531.fixed.md 71fb4c40), and the diff is exactly the This workflow has no task refusal moving from after to before main's clearRunTimers sweep and the lane.active/lane.queue clears — main's take() and runId branch keep their semantics, so the replay reverts nothing of main (fa932f8). Red first: with src/service.js at the base blob only, a refused reset leaves the queue untouched and a refused reset keeps a run that has no task fail (178/180); restored to the tip blob afterwards. Checks at the tip: tests-ok (test, plugins (tree|social|timeline|workflow), package, Node 24 job) all success; enqueue-guard fails only with no Verifier report names the tip 5de8fcfad653, which this comment clears. Tier T2 by path (plugins/workflow/src/service.js): 3 files, +7/−2 lines, inside the T2 limits. Body carries Fixes #1531, Owner: Dev4, Reviewer: Reviewer and a valid ## Checkpoint block; Docs-not-needed: is in both the body and the tip commit message.

Not run: full npm run verify (no core/, client.js or patches/ change), the smoke test, and the merge queue.

@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 890c982 Oct 28, 2026
13 of 15 checks passed
@Birfy
Birfy deleted the replay/pr-1532 branch October 28, 2026 15:00
@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): a refused reset still clears the lane — queued tasks vanish and a task-less run's Bots never release

1 participant