From b4f1f5f01531a13ae43957e19d4c89e3af44b316 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Fri, 24 Apr 2026 23:10:00 -0400 Subject: [PATCH] fix(agent): coerce user_id to int in MasterAgent.handle_message Odoo's bot model serialises user_id as a string (str(uid)) over the HTTP boundary, but the asyncpg memory queries ($1) expect an integer. This caused 'str object cannot be interpreted as an integer' on every Discuss DM. Cast at the entry point so downstream stores get an int. --- agent_service/agents/master_agent.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agent_service/agents/master_agent.py b/agent_service/agents/master_agent.py index 075e14a..59bc233 100644 --- a/agent_service/agents/master_agent.py +++ b/agent_service/agents/master_agent.py @@ -70,6 +70,10 @@ class MasterAgent: return template.format(agent_list=agent_list) async def handle_message(self, user_id, channel_id, message, directive_id) -> MasterResponse: + try: + user_id = int(user_id) + except (TypeError, ValueError): + pass logger.info('MasterAgent.handle_message user_id=%s directive=%s', user_id, directive_id) t0 = time.monotonic() await self._log_directive_start(directive_id, user_id, channel_id, message)