Skip to content

Face room: a peer's multi-paragraph line arrives empty (3+ lines lose first/last line) — room.message viewed twice #302

Closed

Description

@Birfy

Summary

In a Face-to-face room, a peer line with two paragraphs arrives on the other home as an empty bubble. A line with three or more lines loses its first and last line. Single-line text and plain two-line text arrive intact. The text is complete on Bot Social, so this is a FlyBot client bug. The cause is proven below; it is not the new mentions field.

Environment

Repro

  1. A: + → Face-to-face group → Chief → number 482913. B joins the same number with Chief. Enter chat.
  2. A types hi from A (a plain line, so both Chiefs answer, Face rooms: a plain line should let every Bot in the room answer (one round, capped), not only the first (follow-up to #287) #295). Approve A's Chief's reply on A.
  3. A's Chief's reply has two paragraphs: Hi from A's side 👋 I'm Chief, A's assistant here. … nice face-to-face setup. + blank line + Anything you'd like us to work on together while we're here? @SelfB1622's Chief, want to say hello from B's side?
  4. Look at that line on B.

Actual

  • On A the reply shows in full.
  • On B it is an empty grey bubble under SelfA1622's Chief @chief.selfa1622.home. It stays empty after a reload and in Past rooms → Open (read-only). B's sidebar preview reads SelfA1622's Chief: with nothing after it. Screenshot: B's room with the empty bubble between B's own Chief line and the user's next line.
  • The short reply later (2 + 2 = 4 😄) arrives fine.
  • B's stored transcript has the line with "text": "" (room log seq 6, no eventId). B's room Session got [Group post from Chief · SelfA1622]\n with nothing after it, so B's Chief also saw an empty post.

Evidence (read-only)

  • Bot Social has the full text. GET /v1/face-rooms/frm_01M571ZK5FZCKPS54G5J27B4ZS?after=0 (as A; B had left, so it got 404) returns event 199 with untrusted_content: { text: "Hi from A's side …\n\nAnything … from B's side?" } (240 chars). That event has no mentions field. Mentions only appear on B's typed line 201, and that line arrived fine.
  • Root cause: the event is "viewed" twice. faceApi.get() → viewFaceRoom() → viewFaceEvent() turns untrusted_content into a plain string untrustedText. applyFaceSnapshot() (plugins/social/src/social.js L2211) then calls renderFaceEvent(event), which calls viewFaceEvent() again. On that second pass untrusted_content is absent, so faceUntrustedText(untrustedText) takes the string branch. That branch (face-rooms.js L64–69, UNTRUSTED = /^[\s\S]*?\n([\s\S]*)\n[^\n]*$/) assumes a wrapped <marker>\n…\n<marker> string. It drops the first and last line of any plain text with ≥ 2 newlines.
  • Reproduced with the real server payload (node, on a003044):
    viewFaceRoom(serverBody) → renderFaceEvent(ev, { attested: true }).text
    198 "hi from A"            → "hi from A"
    199 (240 chars, 2 paras)  → ""
    202 "2 + 2 = 4 😄"          → "2 + 2 = 4 😄"
    "line1\nline2\nline3"     → "line2"
    
  • The same path handles every received room.message: Bot lines, people's typed lines, and Past rooms replay. Any multi-paragraph message from another home is blanked or cut.

Expected

  • Every home shows a peer's line exactly as Bot Social delivered it, including paragraphs and line breaks (docs/subsystems/social.md: peer text is fenced, not rewritten).
  • The receiving Bot sees the same fenced text.
  • A regression test feeds a multi-paragraph room.message through viewFaceRoom → applyFaceSnapshot/renderFaceEvent.

Fix direction (not done here)

Make viewFaceEvent idempotent: keep an already-viewed untrustedText string as-is, or have renderFaceEvent accept a viewed event without viewing it again. Apply the marker regex only to strings that really carry the begin/end markers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions