Repository navigation
fix(coordinator): emit one IDEA_PRUNED event per cascaded node - #63
Merged
ignorejjj merged 1 commit intoAug 30, 2026
Merged
Conversation
prune_node() sets status="pruned" on the target node and every descendant, but emitted a single IDEA_PRUNED event for the target only. Every consumer (StatsCollector, RunState, which feeds the TUI header and the WebUI tree) keys off one node_id per event, so cascaded descendants stayed at their pre-prune status in the TUI/WebUI ledger even though idea_tree.json on disk already marked them pruned. Emit one IDEA_PRUNED event per pruned node id instead of one for the whole cascade. Fixes RUC-NLPIR#62
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.
Summary
IdeaTree.prune_node()recursively setsstatus = "pruned"on the target node and everydescendant (
_prune(), called onnode_idthen eachchild_id), but after the recursionfinished it emitted exactly one
IDEA_PRUNEDevent, fornode_idonly.Every consumer keys off a single
node_idper event:StatsCollector._inc_prunedincrementsa counter by one per event, and
RunState.on_idea_pruned(the source for the TUI header and,via
webui/snapshot.py, the WebUI tree) updates the record for the onenode_idin the eventpayload. So cascaded descendants kept their pre-prune status ("proposed") in both places even
though
idea_tree.jsonon disk already marked them pruned, which is the TUI/WebUI countmismatch reported in #62.
Fix: collect the ids mutated during the cascade and emit one
IDEA_PRUNEDevent per id insteadof one for the whole cascade. Each descendant now carries the same
reasonas the node thecaller pruned, since it was pruned as a direct consequence of that call.
Linked issue
Closes #62
Type of change
fix)How was this tested?
target) and that an untouched sibling emits nothing; both fail against unpatched
prune_nodeand pass after the fix.StatsCollectorandRunStateend to end through the real event busand asserts the pruned count and every descendant's status.
pytest(154 files) andruff check src/ tests/both pass clean on Python 3.10 and3.13, in a clean Docker container, with dependency versions pinned from
uv.lock.Not checked: the live TUI/WebUI rendering itself, since neither has a scripted test harness in
this repo; the assertion is on the state each of them consumes (
RunState/StatsCollector).Checklist
fix(config): ...).python tests/test_*.py) and they pass.