Skip to content
pi-c View Ticket
Login

View Ticket

2026-11-28
18:23 • Closed ticket [bf37ba145c]: Remote: a forked conversation syncs empty on the phone: the follow reads only the fork's own submissions plus 3 other changes artifact: 2cbc18c441 user: dmestas
16:01 • Ticket [bf37ba145c]: 1 change artifact: 66dded4af2 user: quarry
15:43 • New ticket [bf37ba145c]. artifact: 0ce9a1077c user: dmestas

Remote: a forked conversation syncs empty on the phone: the follow reads only the fork's own submissions

Closedbf37ba145c447591a3be941703ea4eac64f09fb2Created 2.3 days agoUpdated 2.2 days ago
Description2026-11-28 15:43:44
A conversation made by `fork_session` (or `/fork`, `pic fork --at`) shows nothing on the phone. Following it, pic answers `sync` with a mark at 0 and no events, and earlier is absent, so the page draws an empty conversation titled "Untitled". Yet its `sessions` row says `seq` 12, `pic log` shows its entries, and the conversation it was forked from syncs normally.

Reproduction (pi-c trunk a163283659ba, release build, an isolated HOME paired to a local relay): 1. From the phone, start a conversation in a folder and send two messages ("Plan the release", "And the date?"). pic log shows entries 9 to 12. 2. Send `fork_session` with no `at` to it. The answer is success, with data.session `W/3455f930`. 3. `sync` to `W/3455f930`. pic sends only `sync` (mark) at seq 0, with no `event`s and no `earlier`. The same sync to the original sends events 11 and 12, then the mark at 12 with earlier 8. 4. `pic log 3455f930` prints entries 9 to 12.

Code path: `rmt_syncjob_run` (src/remote.c:6743) calls `pic_follow_new`. The follow's pass reads `pic_entry e JOIN pic_submission u ... WHERE u.session_id = ?1` (src/attach.c:489-491), and the start mark comes from `max(id) FROM pic_submission WHERE session_id = ?1` (src/attach.c:1142). Both see only the conversation's own submissions. A fork has none until its first request, because its entries are on its `forked_from` path (the recursive walk at src/loop.c:4928 that `pic log` uses). `rmt_earlier` and `pic_follow_page` (earlier pages) have the same limit.

Expected: a fork's follow, earlier pages and mark cover its whole path, as `pic log` does: the inherited entries up to the fork point, then its own. The page follows a fork from `data.session` as soon as the fork is answered, so today every fork opens empty.

Fix shape: have the follow, page and mark queries select entries on the session's path (the `forked_from` chain, each ancestor up to its fork point), not `u.session_id = ?1`. Add a remote test that syncs a fork and pages earlier in it.

2026-11-28 18:23:50

Landed as a05ac3d2b8dc (land fork-follow): a fork syncs, pages and attaches over its whole path.