Skip to content

test: a reactive node must not restart its RUNNING child - #1258

Merged
facontidavide merged 1 commit into
masterfrom
test/reactive-keep-running-child
Oct 25, 2026
Merged

facontidavide merged 1 commit into
masterfrom
test/reactive-keep-running-child

Conversation

@facontidavide

@facontidavide facontidavide commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Adds three tests pinning behavior that master already has and that a fix for #1031 must keep. Tests only, no change to the library.

  • ReactiveSequence_CompletedSiblingsDoNotRestartRunningChild and ReactiveFallback_CompletedSiblingsDoNotRestartRunningChild: the children before the RUNNING one are re-ticked on every tick. When they complete immediately (a check implemented as a StatefulActionNode or a CoroActionNode), the RUNNING child keeps running: it is neither halted nor started again.
  • ConcurrentChildrenOfCustomControlAreNotHalted: a control node that keeps several children running at once, like nav2's PipelineSequence, doesn't get them halted when one of them starts.

All three pass on master. Applied on top of the current #1217 branch, all three fail: the RUNNING action is started 5 times and halted 4 times in 5 ticks.

🤖 Generated with Claude Code

Pin the behavior of master that a fix for #1031 must keep:

- In ReactiveSequence / ReactiveFallback, the children before the RUNNING
  one are re-ticked on every tick. When they complete immediately (a check
  implemented as a StatefulActionNode or a CoroActionNode), the RUNNING
  child keeps running: it is neither halted nor started again.
- A control node that keeps several children running at once, like nav2's
  PipelineSequence, does not get them halted when one of them starts.

All three tests pass on master and fail on the current #1217 branch
(the RUNNING action is started 5 times and halted 4 times in 5 ticks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@facontidavide
facontidavide merged commit 1a21a78 into master Oct 25, 2026
18 checks passed
@facontidavide
facontidavide deleted the test/reactive-keep-running-child branch October 25, 2026 17:37
Quchaosheng added a commit to Quchaosheng/BehaviorTree.CPP that referenced this pull request Oct 28, 2026
The previous version halted the running siblings from inside the asynchronous
node, whenever it left IDLE. That cannot be made to work: before onStart()
runs, a check that will return SUCCESS and a new action that will keep running
look identical, so the rule has to guess from the shape of the tree. It also
misses ThreadedAction, whose executeTick() is final and does not run the body
of TreeNode::executeTick().

Replace it with a decorator that answers the question where the answer is
known. Preempt wraps the action that starts the new branch; on its first tick,
before ticking its child, it halts the RUNNING child of every reactive ancestor
it is not itself inside. Children of a Parallel are not touched, since that
node is allowed to keep several of them RUNNING.

ReactiveSequence and ReactiveFallback now share a ReactiveControlNode base that
owns the running child index and can let go of it on request, so the index stays
consistent with the child that is actually RUNNING. The base adds state and
non-virtual members only: no existing vtable changes, and the parent pointer
lives in the existing PImpl.

Tests: both fallbacks, an action inside a SubTree, a ThreadedAction, and a
Parallel inside the new branch whose children must keep running together. The
three cases pinned by BehaviorTree#1258 pass, as does the rest of the suite (591 passed,
2 skipped).

Suggested-by: Davide Faconti <davide.faconti@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant