You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A deleted Bot keeps its open-turn records in the tree load tracker #732
plugins/tree/src/load.js keeps one record per open turn per Bot id, in a process-local Map (createLoadTracker). plugins/tree/src/tree.js:293onBotRemoved() re-attaches the deleted Bot's children, repairs the organizer, refreshes prompts and runs adoption — it never drops that Bot's turn records. The tracker keeps the id forever, so snapshot() still counts a Bot that no longer exists, and every later read walks an entry nobody can ever end.
Harmless in size (bounded by how many Bots existed), but it is a leak on the one path that is supposed to dispose of a Bot, and it makes the tracker's own invariant ("every record belongs to a live Bot") false. Found by the #692 review (point 3) and left out of scope there.
Reproduce
node --test plugins/tree/test/load.test.js
with a case that starts a turn for b1, calls onBotRemoved({ botId: 'b1', parent: <root> }), then reads load.snapshot() — today it still lists b1.
What should happen
createLoadTracker gains clear(id): removes that Bot's records and returns nothing; unknown id is a no-op. Pure, in the style of start/end/of.
tree.onBotRemoved() calls it for the removed botId before or after the children re-attach (either order is fine; the tracker holds turn records only, never the tree shape).
snapshot() and openFor() for that id read 0 once the Bot is gone.
Acceptance
plugins/tree/test/load.test.js: clear(id) drops that Bot's records and leaves other Bots untouched; clear of an unknown id changes nothing; after clear, of(id) === 0 and openFor(id) === 0.
a tree.js-level case (the existing plugins/tree/test/tree.test.js harness) asserting snapshot() no longer names the removed Bot after onBotRemoved.
Red without the source change: delete the clear call from onBotRemoved → the tree-level case fails; delete the clear method → the tracker case fails on a missing function.
plugins/tree suite green (node --test plugins/tree/test/*.test.js), changelog fragment added, and docs/subsystems/tree.md mentions that a removal drops the Bot's turn records.
Out of scope
No change to start/end/openFor semantics, no persistence, no behaviour change for live Bots.
Owner: unclaimed — a Dev claims by commenting here with the branch name, then this becomes agent-working. One issue, one pull request.
Claiming this one. Branch fix/732-load-tracker-clear.
Plan is exactly the acceptance in the issue: createLoadTracker gains clear(id) (unknown id is a no-op), onBotRemoved() calls it for the removed botId, and the two red checks are "drop the call" (tree-level case fails) and "drop the method" (tracker case fails on a missing function).
Activity
Birfy commentedon Oct 22, 2026
Written-by: Dev2
Claiming this one. Branch
fix/732-load-tracker-clear.Plan is exactly the acceptance in the issue:
createLoadTrackergainsclear(id)(unknown id is a no-op),onBotRemoved()calls it for the removedbotId, and the two red checks are "drop the call" (tree-level case fails) and "drop the method" (tracker case fails on a missing function).fix(#732): drop a removed Bot's open-turn records from the tree load …
fix(tree): drop a removed Bot's load records before the tree guard (#732
fix(tree): drop a removed Bot's open-turn records from the load track…