Repository navigation
fix(workflow): keep a run Bot's id when its release fails - #1617
Conversation
releaseAll() reports the ids it could not remove, but releaseRun(), reap() and dispose() dropped every id up front and ignored that return, so a Bot that refused to go became a hidden orphan that no later load could name. Keep the failed ids on the run record so the next load's reap() retries the removal. Docs-not-needed: fixes release bookkeeping; no architecture or interface change.
|
@Birfy review request — PR #1617 at
One regression test drives both the run-end path and As of my read: 3 files +116/−7, base |
|
Verdict: PASS at e2ee46d Ran at this tip: Red first, at this tip: with Review:
Tier: T2 ( |
Fixes #1616
Owner: Dev-3
Reviewer: Reviewer
Written-by: Dev-3
Branch:
dev3/fix/p116-ephemeral-release-idBase:
50c9e47b0599b40a76ca078f9bde9e44369170c6(main, #1613)Tip:
e2ee46dd6f4fa41b89abc89a5911d8e35c8bbe1aTree:
6c4ace32aa77324f107556b862facc8f0ea0344creleaseAll()returns the ids whose release failed and documents the contract: that Bot is still there, so the caller must keep naming it and a later attempt retries the removal (#1476). Three call sites dropped that return value and deleted the id first, so a run Bot the host could not remove became a hidden orphan — not in the sidebar, Search or Settings→Bots, skipped bylist_botsandbot.list, its name still held so no later Bot could take it, and its Session never reclaimed.What changed (three call sites, one shared helper)
plugins/workflow/src/service.js:593releaseRun()— the normal end of every run (timeout, dispatch failure, finished): the record no longer dropsephemeralbefore the release. Afailedid stays named on the run record, and a reloaded service'sreap()retries it.plugins/workflow/src/service.js:1479reap()— deletes an id only afterreleaseAllreports it as released: the stale and the abandoned-run branches keep their run instaleRuns, and the.thendrops only the ids the host really removed.plugins/workflow/src/service.js:1531dispose()— the.then()no longer stripsephemeralfrom every run; it keeps the failed ids and drops only the released ones.keepUnreleased(run, failed)— the shared filter. An id the host did remove is dropped, because a second remove of a gone Bot throws (fix(workflow): Reset/Stop writes state before releasing run Bots, so a failed release erases the only id record #1476).reset()already carries this logic as its own local closureforgetReleased; it is untouched, as the issue asks.plugins/workflow/test/dispose.test.js— one regression test, two halves: (1) a run that ends normally withreleasethrowing for itseph-onlyBot leaves{ only: 'eph-only' }on the record, and a reloaded service'sreap()retries exactly that id; (2)dispose()witheph-coderefusing leaves{ code: 'eph-code' }, exactly oneflybot-workflow: could not remove eph-code: host call failedwarning, and a same-directory reload'sreap()retrieseph-codeand only then clears it.changelog.d/1616-workflow-release-keeps-id.fixed.md.Not touched:
reset()(already correct),migrateRuns(), release retry policy/backoff, any UI or rendered text.Red first, at
50c9e47b(source untouched, only the test file added)cd plugins/workflow && node --import ./test/resolve.mjs --test test/dispose.test.js— 6 tests / 5 pass / 1 fail:That is the
releaseRun()half; the run failed at the first assertion, so thedispose()half was not reached onmain.Green at this tip
test/dispose.test.js: 6 / 6.plugins/workflow: 218 / 218 (mainis 217; the one new test is the only addition),#1472,#1476and#1613included.TZ=UTC ARCH_DOCS_BASE=50c9e47b0599b40a76ca078f9bde9e44369170c6 npm_config_cache=<writable> npm run verify— exit 0: core 1903, social 528, tree 125, timeline 129, workflow 218,.github549, interop 37, live-e2e 24, every suite# fail 0; oxlint 0 errors (warnings only, unchanged: core 63, social 36, timeline 9, tree 2, workflow 15);arch-docs: OK (3 changed file(s));build-client --checksilent;ds-bot-patches check→ok 10 patches apply cleanly in order+ok core/ equals ds-bot/ + patches/ds-bot/; the.githubsuite'schangelog.d/ is validtest green.Not run: the smoke test and the test bench (no
index.js/core/src/host/change), and no browser check — the record is asserted from the store and from what a reloaded service does with it, not through a rendered page.Docs-not-needed:
docs/subsystems/workflow.mdalready states that a run's Bots are released when it ends and that a failed release keeps the ids named; this change only makes the three call sites obey that sentence. No owned path outsideplugins/workflow/changes.Risk: T2 —
plugins/**sets the tier;plugins/workflow/test/**andchangelog.d/**are T1.Checkpoint
{ "pr": 1617, "claim": "Dev-3", "issue": 1616, "summary": "releaseRun(), reap() and dispose() deleted every run Bot id before calling releaseAll(), then ignored the ids it reported as failed, so a Bot the host could not remove became a hidden orphan no state named. All three now drop only the ids the host really removed and keep a failed id on the run record, so the next load's reap() retries the removal. One regression test covers the normal end of a run and dispose(), each followed by a same-directory reload whose reap() retries exactly the id that refused to go.", "files": [ "plugins/workflow/src/service.js", "plugins/workflow/test/dispose.test.js", "changelog.d/1616-workflow-release-keeps-id.fixed.md" ], "checks": { "ran": "cd plugins/workflow && node --import ./test/resolve.mjs --test test/dispose.test.js; TZ=UTC ARCH_DOCS_BASE=50c9e47b0599b40a76ca078f9bde9e44369170c6 npm run verify", "result": "green", "at": "e2ee46dd6f4fa41b89abc89a5911d8e35c8bbe1a" }, "next": "none — ready for review" }