Repository navigation
Show how long a child's turn has been open in the tree prompt (#624) - #692
Merged
Merged
Conversation
A load count could not tell a long turn from a stuck one: `load: 1` read the same for a turn three seconds in and for one that had been open 47 minutes without ending. The tracker now keeps each open turn's start, `openFor()` answers the age of the oldest one, and past 12 minutes the coordinator's line names it instead of only the count. - load.js: keep per-turn start times; `openFor(id, at)`; `STALLED_AFTER_MS = 12 min`; `loadLine` takes an optional third argument and renders `working (47 min, no turn ended)` / `busy (2 running, oldest open 47 min)` past the threshold. - tree.js: pass the injected clock through and expose `openForOf`. - tools.js: `list_children` adds `openForMs` (and `stalled: true` past the threshold) only for a child with a turn open, so an idle child keeps exactly its old shape and `load` stays a number for every existing reader. - A routing hint, never a gate: the plugin cannot see a Bot's inbox, so a legitimately long turn ages too. Nothing here refuses, ends or reassigns work.
Collaborator
Author
|
Verdict: PASS at 171bedf The change is small and honest about what it is: a per-Bot list of open-turn start times, Ran:
Not run:
Non-blocking:
T2: awaiting a maintainer approve at this tip; I am not enqueueing it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reproduce
loadwas a bare count, so a stuck turn and a busy one read the same. With the tree plugin loaded and a child onload: 1:Nothing in either answer distinguishes a turn three seconds in from one that has been open 47 minutes and never ended — which is exactly the state
#624is about.What changed
plugins/tree/src/load.js— the tracker keeps each open turn's start time instead of a counter, soopenFor(id, at)answers the age of the oldest open turn (0when idle) andend(id)drops the oldest one, keeping the count right whatever order the ends arrive in. NewSTALLED_AFTER_MS = 12 minandloadLine(children, countOf, openForOf?): past the threshold a child readsworking (47 min, no turn ended)orbusy (2 running, oldest open 47 min). The third argument is optional, so a caller with only a count keeps the old line.plugins/tree/src/tree.js— the injected clock reaches the tracker, andopenForOfis exposed.plugins/tree/src/tools.js—list_childrenaddsopenForMsonly for a child with a turn open, plusstalled: truepast the threshold. An idle child keeps exactly its old shape, andloadstays a number for every existing reader.plugins/tree/test/load.test.js,plugins/tree/test/tree.test.js— three cases: the age is the oldest start and rolls to the newer turn once one ends; the line names the age only past the threshold and never calls an idle child stalled; a turn that never ends shows its age in bothlist_childrenand the coordinator's stored prompt, and clears atturn.end.docs/subsystems/tree.md— a "How long a turn has been open" subsection, the Key files line and the coverage line.Boundary, stated plainly: this is a routing hint, never a gate. The tree plugin cannot see a Bot's inbox, so a legitimately long turn ages too, and nothing here refuses, ends or reassigns work. 12 minutes is a display threshold, not a timeout.
What I ran
Red without the source change
With the age recording withdrawn (
start()no longer storesnow(),openFor()returns0,loadLineignores the third argument) while the call sites and the tests stay as they are:Restoring
load.jsmakes them pass again (89/89, then 100/100 for the whole plugin).Not run
npm run verifyend to end: this machine hitsspawnSync /bin/sh EAGAIN/esbuild … EAGAINat the default concurrency, so the steps above were run one by one.esbuild/jsdomnot installed here). CI runs them on a machine with dependencies; that is whattests-okcovers.Risk
T2 —
plugins/tree/**plus a docs file; no core path, no.github/**, no security surface. The GitHub workflow's ownrisk-gaterecomputes it on this tip.Fixes #624
Tip SHA: 171bedf