Pārlūkot izejas kodu

docs: record Bot._on_timeline_upsert protobuf crash (chattolib-uuqm)

RoomTimelineRoomEvent has room_id (string), not a nested room message.
The handler calls sub.HasField('room') which raises a protobuf error,
crashing the server task on any room-lifecycle timeline event.

Bean: chattolib-uuqm (in-progress)
Federico Feliziani 2 mēneši atpakaļ
vecāks
revīzija
307737c49b

+ 25 - 0
.beans/chattolib-uuqm--fix-bot-on-timeline-upsert-roomtimelineroomevent-h.md

@@ -0,0 +1,25 @@
+---
+# chattolib-uuqm
+title: 'Fix Bot._on_timeline_upsert: RoomTimelineRoomEvent has room_id not room'
+status: in-progress
+type: bug
+created_at: 2026-08-31T13:12:27Z
+updated_at: 2026-08-31T13:12:27Z
+---
+
+The _on_timeline_upsert handler in bot.py calls sub.HasField('room') for room-lifecycle events (room_created, user_joined_room, etc.), but the RoomTimelineRoomEvent protobuf only has a room_id string field, not a nested room message. This raises a protobuf error that crashes the server task, causing a crash-restart loop when combined with retained room timeline replay.
+
+Fix: change sub.HasField('room') to sub.HasField('room_id') and build the Room from the ID string instead of a nested message.
+
+Discovered during robochatto 0.5 upgrade testing (2026-08-31). Local venv patch applied at robochatto/.venv/lib/python3.14/site-packages/chattolib/bot.py line ~603. The patch:
+
+    room = None
+    sub = getattr(event, case, None)
+    if sub is not None:
+        if sub.HasField("room_id") and sub.room_id:
+            room = Room.parse({"id": sub.room_id})
+    await self._dispatch(BotRoomEvent(bot=self, kind="room", room=room, detail=case))
+
+Replaces the old:
+    if sub is not None and sub.HasField("room"):
+        room = Room.parse(_pb_to_dict(sub.room))

+ 4 - 0
AGENTS.md

@@ -133,3 +133,7 @@ to its grants.
 - No more `motd` on the public profile; it is a separate authenticated RPC (`ServerService.GetMotd`).
 - Room groups can contain `SidebarLink` items (not just rooms). `RoomGroup.sidebar_links` exposes them.
 - **Never regenerate protos from `chattocorp/chatto@main`.** `scripts/generate_pb.sh` now defaults to `v<version>` (from `pyproject.toml`); override with `CHATTO_REF=<tag>` only when you know the deployed server has caught up. chattolib 0.4.19 shipped once from `main` and broke realtime for every downstream client because Chatto's main had a protocol-v2 rewrite that the deployed 0.4.19 server did not speak.
+
+### Known bugs
+
+- **`Bot._on_timeline_upsert` crashes on room-lifecycle events** (`chattolib-uuqm`). `RoomTimelineRoomEvent` has a `room_id` string field, not a nested `room` message. The handler calls `sub.HasField("room")` which raises a protobuf error. Affects `room_created`, `user_joined_room`, etc. Fix: use `sub.room_id` and build a minimal `Room` from it. Discovered 2026-08-31 during robochatto 0.5 upgrade testing.