Skip to content

Follow SubTree remapping and @ root keys in Blackboard::unset - #1303

Open
dvadovsz wants to merge 1 commit into
BehaviorTree:masterfrom
dvadovsz:fix/blackboard-unset-follows-remap
Open

dvadovsz wants to merge 1 commit into
BehaviorTree:masterfrom
dvadovsz:fix/blackboard-unset-follows-remap

Conversation

@dvadovsz

@dvadovsz dvadovsz commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #1302.

unset() now resolves the key the same way getEntry() does:

  • A key starting with @ is removed from the root blackboard.
  • A key in the blackboard's own storage is removed there, as before.
  • Otherwise the key follows internal_to_external_ to the parent, or follows _autoremap unless it is a private _ key.

A missing entry is still a no-op. The local storage lock is released before recursing into the parent, so no two blackboard locks are held at once. A removed entry is still destroyed outside the lock.

Tests in gtest_blackboard.cpp:

  • UnsetBlackboardNodeClearsRemappedSubtreeVariable: UnsetBlackboard in a SubTree with an explicit remap, with _autoremap, and with @.
  • UnsetAutoRemappingKeepsPrivateKeysLocal: _ keys are not autoremapped.
  • UnsetFollowsNestedRemapping: a key remapped through two SubTree levels.

All three fail on master and pass with the fix. pre-commit and clang-tidy-21 are clean.

Behavior change: unsetting a remapped key in a SubTree now removes the parent's entry. Anything subscribed to that entry with subscribeToEntry() loses its subscription. This matches the existing doc comment ("unset() drops it"). There is no layout change and no new symbols. unset() stays inline in the header.

@dvadovsz
dvadovsz marked this pull request as ready for review December 2, 2026 22:40
getEntry() and set() resolve a key through SubTree remapping, _autoremap and the '@' root prefix, but unset() only looked at local storage. An UnsetBlackboard inside a SubTree on a remapped key, or on "@key", did nothing and still returned SUCCESS. Resolve the key in unset() the same way getEntry() does. A missing entry is still a no-op, and private keys starting with '_' are not autoremapped.

Fixes BehaviorTree#1302

Co-Authored-By: David Vadovszki <david.vadovszki@picknik.ai>
@dvadovsz
dvadovsz force-pushed the fix/blackboard-unset-follows-remap branch from cbb9ed6 to 9bbfb83 Compare December 2, 2026 22:43
dvadovsz added a commit to PickNikRobotics/BehaviorTree.CPP that referenced this pull request Dec 2, 2026
getEntry() and set() resolve a key through SubTree remapping, _autoremap and the '@' root prefix, but unset() only looked at local storage. An UnsetBlackboard inside a SubTree on a remapped key, or on "@key", did nothing and still returned SUCCESS. Resolve the key in unset() the same way getEntry() does. A missing entry is still a no-op, and private keys starting with '_' are not autoremapped.

Upstream: issue BehaviorTree#1302, PR BehaviorTree#1303. Drop this commit once a release carries it.

Co-Authored-By: David Vadovszki <david.vadovszki@picknik.ai>
(cherry picked from dvadovsz/BehaviorTree.CPP@9bbfb83)

This branch has not been deployed

No deployments
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.

UnsetBlackboard in a SubTree does nothing for remapped or @ keys

2 participants