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
tree load: end a turn by its turnId, not by whichever start is oldest #696
The tree's load tracker cannot tell two open turns apart, so turn.end ends the oldest start. That is the one case where the number is supposed to help: a Bot with two turns open, the newer one finishing first, now reports the newer turn's age as "how long this Bot has been open" — the stall the tracker exists to surface (#624) reads as recent.
Where
plugins/tree/index.js:36-37 passes only the Bot id:
fb.onFeed('turn.start', e => { tree.noteTurnStart(e?.botId); refreshParentPrompt(e?.botId) }),
fb.onFeed('turn.end', e => { tree.noteTurnEnd(e?.botId); refreshParentPrompt(e?.botId) }),
The feed event itself carries turnId (core/src/client/flybot-feed.js, the turn.start / turn.end payloads), and plugins/tree/src/load.js keeps one start time per open turn with end(id) dropping the oldest — the shift is deliberate (a turn id is not passed in), but it means an out-of-order finish resets openFor() to the wrong start.
Change
load.js: start(id, turnId) / end(id, turnId) store the id with the start time; end removes the matching turn when the id is known, and keeps the current shift-oldest behaviour when it is missing or does not match (unmatched fallback — old clients, a dropped turn.start).
plugins/tree/index.js: pass e?.turnId on both feeds. openFor(id, now) and everything list_children returns keep their current shape.
Acceptance
Two turns open (t1 at 00:00, t2 at 00:30), end(id, 't2') → openFor still reports the age of t1 (the older start), and of(id) is 1.
end(id, 'nope') (unknown id) and end(id) (no id) each remove exactly one turn and leave the older start standing.
Revert the id pairing (keep only the shift) → the first case goes red; node --test plugins/tree/test/ green at the tip.
Claiming this one. Branch fix/696-load-pairs-by-turn-id.
feed already carries turnId, and #624 threw it away: load.js kept only start times, so end() dropped the oldest open turn no matter which one actually ended. Two turns open with the later one ending first, and openFor reports the newer turn's age — exactly the state #624 exists to expose. The tracker will key each open turn by turnId when it has one, with the oldest-first drop left as the fallback for an end without a matching id, so an unknown or missing id still only decrements by one.
(The first version of this comment lost its inline code to a shell expansion; this is the same text with the identifiers intact.)
Activity
Birfy commentedon Oct 22, 2026
Claiming this one. Branch
fix/696-load-pairs-by-turn-id.feedalready carriesturnId, and #624 threw it away:load.jskept only start times, soend()dropped the oldest open turn no matter which one actually ended. Two turns open with the later one ending first, andopenForreports the newer turn's age — exactly the state #624 exists to expose. The tracker will key each open turn byturnIdwhen it has one, with the oldest-first drop left as the fallback for an end without a matching id, so an unknown or missing id still only decrements by one.(The first version of this comment lost its inline code to a shell expansion; this is the same text with the identifiers intact.)
Name the routing fields in the list_children description
Name the routing fields in the list_children description (#753)
Pair a turn end with its own turn in the tree load tracker (ThinkFlow…