Skip to content

handlesignal,msgconv,signalmeow: add support for receiving stories - #726

Open
iFixRobots wants to merge 7 commits into
mainfrom
iFixRobots/stories
Open

iFixRobots wants to merge 7 commits into
mainfrom
iFixRobots/stories

Conversation

@iFixRobots

@iFixRobots iFixRobots commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The Signal server only delivers stories to websockets that send X-Signal-Receive-Stories: true. Without that header it acks and drops them, so stories never reached the bridge. Replies to stories arrived as plain text and reactions to stories were dropped.

With enable_stories (off by default), the authed websocket requests stories and each login gets a "Signal Stories" room. Stories are sent there by the author's ghost, and group stories get a "Story in " caption. The room is receive-only. mute_stories and stories_tag work like whatsapp's mute_status_broadcast and status_broadcast_tag. Stories are removed from the room 24h after they're posted.

The account's "Turn off stories" setting (AccountRecord.storiesDisabled) is handled the same way Signal Desktop handles it. While it's on, the header isn't sent (SocketManager.preload.ts:246). A change that arrives through storage sync reconnects the authed websocket (storageRecordOps.preload.ts:2219-2221, SocketManager.preload.ts:525-533). Stories, story replies and story sync messages that still arrive are dropped (MessageReceiver.preload.ts:1559-1568, :2163, :3017).

Story replies and reactions set ReplyTo, ReplyToRoom (the stories room) and ReplyToUser. When cross_room_replies is off, a "Replied to your story:" prefix is added. Group story replies carry the story's 24h expireTimer, so they no longer change the group's disappearing timer.

Deletes use envelope story. Own list-story deletes sync as a recipient update. An own group story deleted from another device has no story marker, so it's left to expire.

main this PR
Story never delivered in Signal Stories
Reply, cross_room_replies off plain text "Replied to your story: …"
Reply, cross_room_replies on plain text cross-room reply (DMs)
Reaction dropped "Reacted 😂 to your story"
Story deleted — redacted
Group story reply sets the group timer to 1 day group timer unchanged
Stories turned off in Signal header still sent header dropped after storage sync, reconnects

Questions for you:

  • Should stories expire from the room after 24h, or stay?
  • Is the prefix the right way to keep context when cross_room_replies is off?
  • bridgev2 looks up reply targets with the current portal's receiver, so group story replies can't find the story (receiver = login) even with ReplyToRoom set. Would using ReplyToRoom.Receiver for that lookup when it's set be OK?

View in Indent
Tag @indent to continue the conversation here.

@indent

indent Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Issues

All clear! No issues remaining. 🎉

4 issues already resolved
  • The e4c0b52 fix only closes the race while the story is still in recentMessageRooms, a 32-entry ring buffer (about 31 usable) shared with view-once messages. In a reconnect backlog, once ~31 more stories or view-once messages arrive between a story and its delete, the entry is evicted. The lookup then falls back to the DB, which has no row yet, and the delete again goes to the DM or group portal. The deleted story stays visible until the 24h expiry. (fixed by commit 9f01167)
    Found by Indent Review Agent
  • Each story now takes a slot in the 32-entry recentMessageRooms buffer, which handleSignalViewOnceOpen uses to route a view-once "opened" sync that arrives before the message row is saved. A burst of stories, e.g. a reconnect backlog, evicts those entries. The open is then dropped and the view-once media is never redacted. (fixed by commit 9f01167)
    Found by Indent Review Agent
  • 46fe227 removed redirectStoryDelete and the queued stories-portal MessageRemove. Signal clients delete group stories as regular messages, so the linked-device copy arrives as a plain SyncMessage.Sent with Message.Delete, not a story-flagged envelope. It becomes a ChatEvent for the group portal, whose receiver is "", so the lookup never matches the story row and the delete is ignored. The story stays in the Stories room until the 24h expiry. (fixed by commit 46fe227)
    Found by Indent Review Agent
  • canReplyToStory was removed, so with cross_room_replies on, story replies always skip the "Replied to your story" prefix and set ReplyTo to the story ID. For group story replies (portal receiver "") and for stories that were never bridged, bridgev2 can't find the target. The message then shows as plain text with no story context, or as a broken fabricated reply if outgoing_message_re_id is enabled. (fixed by commit 46fe227)
    Found by Indent Review Agent

CI Checks

All required CI checks passed on cf0dcea.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found
Full results

Indent Review Agent

  • Summary: No issues found
  • Last ran on commit: cf0dcea2
  • Latest result
    {
      "summary": "No issues found",
      "findings": []
    }

Comment thread pkg/connector/handlesignal.go Resolved
Comment thread pkg/connector/handlesignal.go Resolved
@iFixRobots iFixRobots changed the title connector: bridge Signal stories into a per-login room handlesignal,msgconv,signalmeow: add support for receiving stories Nov 10, 2026
@indent
indent Bot requested a review from tulir November 10, 2026 19:15
Comment thread pkg/signalmeow/receiving.go Resolved
Comment thread pkg/msgconv/stories.go Resolved
@indent indent Bot assigned tulir Nov 10, 2026
# Conflicts:
#	pkg/connector/config.go
#	pkg/connector/example-config.yaml
#	pkg/connector/handlesignal.go
sc.UserLogin.Log.With().Str("component", "signalmeow").Logger(),
sc.handleSignalEvent,
)
sc.Client.ReceiveStories = s.Config.EnableStories

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the signal app has an option to turn off stories entirely. Is that synced? if yes, it should probably be respected

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's synced as AccountRecord.storiesDisabled. It now works like Signal Desktop: X-Signal-Receive-Stories is only sent when enable_stories is on and stories aren't disabled, a change coming in through storage sync reconnects the authed websocket with the new header, and stories, story replies and story sync messages that still arrive while disabled are dropped. Fixed in cf0dcea.

Comment thread pkg/msgconv/stories.go Outdated
prefixBody(dm, "Replied to "+whose)
}
cm := mc.ToMatrix(ctx, client, portal, sender, intent, dm, attMap)
cm.ReplyTo = &networkid.MessageOptionalPartID{MessageID: storyID}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should set ReplyToRoom since this is a cross-room reply

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in cf0dcea. Story replies and reactions now set ReplyToRoom to the stories room and ReplyToUser to the story author, plus ReplyToLogin for our own stories. DM replies link across rooms. Group story replies still don't, because getRelationMeta looks the target up with the group portal's receiver ("") while the story is stored under the login. I asked in the description whether bridgev2 should use ReplyToRoom.Receiver for that lookup; it works when I tried it locally.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants