fix: phases update correctly

there was a bug where phases would not update without restarting cb

ref: N25B-400
This commit is contained in:
Pim Hutting
2026-01-12 12:51:24 +01:00
parent 5e2126fc21
commit d202abcd1b
2 changed files with 5 additions and 26 deletions

View File

@@ -67,14 +67,14 @@ class BDIProgramManager(BaseAgent):
await self.send(msg)
def handle_message(self, msg: InternalMessage):
async def handle_message(self, msg: InternalMessage):
match msg.thread:
case "transition_phase":
phases = json.loads(msg.body)
self._transition_phase(phases["old"], phases["new"])
await self._transition_phase(phases["old"], phases["new"])
def _transition_phase(self, old: str, new: str):
async def _transition_phase(self, old: str, new: str):
if old != str(self._phase.id):
self.logger.warning(
f"Phase transition desync detected! ASL requested move from '{old}', "
@@ -90,8 +90,8 @@ class BDIProgramManager(BaseAgent):
if str(phase.id) == new:
self._phase = phase
self._send_beliefs_to_semantic_belief_extractor()
self._send_goals_to_semantic_belief_extractor()
await self._send_beliefs_to_semantic_belief_extractor()
await self._send_goals_to_semantic_belief_extractor()
# Notify user interaction agent
msg = InternalMessage(

View File

@@ -260,27 +260,6 @@ class UserInterruptAgent(BaseAgent):
)
await self.send(out_msg)
async def _send_to_program_manager(self, belief_id: str):
"""
Send a button_override belief to the BDIProgramManager.
:param belief_id: The belief_id that overrides the goal/trigger/conditional norm.
this id can belong to a basic belief or an inferred belief.
See also: https://utrechtuniversity.youtrack.cloud/articles/N25B-A-27/UI-components
"""
data = {"belief": belief_id}
message = InternalMessage(
to=settings.agent_settings.bdi_program_manager_name,
sender=self.name,
body=json.dumps(data),
thread="belief_override_id",
)
await self.send(message)
self.logger.info(
"Sent button_override belief with id '%s' to Program manager.",
belief_id,
)
async def _send_to_bdi(self, thread: str, body: str):
"""Send slug of trigger to BDI"""
msg = InternalMessage(