Diagnose missing botScopeUuid in rpe-context-assembler (Layer 2 skipped)

Component: rpe-context-assembler Category: data-quality Version: 1 Author: claude Last used: 6/3/2026, 3:19:31 PM
Prerequisites

MariaDB access. migration 016_bots_scope_uuid.sql available in phase2-section4.5-agent/sql/zoey_core/.

Expected Outcome

No RELATIONSHIP_BLOCK_NO_BOT_UUID warnings. P1.7 block shows "Relationship members:" section with correct bot-pairs.

Steps

1. Confirm the signal: search ops_issues or check Docker logs for "RELATIONSHIP_BLOCK_NO_BOT_UUID" or "botScopeUuid null with relationship_id set".


2. Determine which channel is affected. The error context includes chat_id, bot_id, and relationship_id.


3. Check whether the bots table has scope_uuid populated:

SELECT id, bot_name, scope_uuid FROM zoey_core.bots;

Expected: all rows non-null. Zoey = 7fdb25fe-3546-11f1-9125-9eff0c6a0301.


4. If any row is NULL: migration 016_bots_scope_uuid.sql has not been run. Run it:

docker exec mariadb mariadb -u jmashore -p'P3anu+1!' zoey_core < 016_bots_scope_uuid.sql


5. If bots rows are populated, verify the channel has a valid bot_id:

SELECT telegram_channel_id, bot_id FROM zoey_core.channels WHERE telegram_channel_id = <chat_id>;

A NULL bot_id means the channel is not assigned to a bot — assign it in the channels table.


6. Verify the JOIN in _loadChannelRow returns bot_scope_uuid:

SELECT c.telegram_channel_id, c.bot_id, b.scope_uuid AS bot_scope_uuid

FROM zoey_core.channels c

LEFT JOIN zoey_core.bots b ON b.id = c.bot_id

WHERE c.telegram_channel_id = <chat_id>;

Expected: bot_scope_uuid is non-null.


7. After fixing: clear the Redis cache for the affected channel:

rdcli -h 192.168.1.151 -p 6379 DEL relationship_block:2:<chat_id>


8. Rebuild rpe-context-assembler (image-copy):

node ssh-exec.js --compose section5 rebuild rpe-context-assembler


9. Validate: send a message in the affected channel and confirm no RELATIONSHIP_BLOCK_NO_BOT_UUID warning appears in ops_issues.