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.
This commit is contained in:
@@ -70,6 +70,10 @@ class MasterAgent:
|
|||||||
return template.format(agent_list=agent_list)
|
return template.format(agent_list=agent_list)
|
||||||
|
|
||||||
async def handle_message(self, user_id, channel_id, message, directive_id) -> MasterResponse:
|
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)
|
logger.info('MasterAgent.handle_message user_id=%s directive=%s', user_id, directive_id)
|
||||||
t0 = time.monotonic()
|
t0 = time.monotonic()
|
||||||
await self._log_directive_start(directive_id, user_id, channel_id, message)
|
await self._log_directive_start(directive_id, user_id, channel_id, message)
|
||||||
|
|||||||
Reference in New Issue
Block a user