Skip to content

Timeline returns 0 rows with olderCursor: null when the window has no user-message anchor, leaving the thread permanently blank #3694

Closed

Description

@gtramontina

Summary

A long-running Codex thread reached a state where GET /api/v1/threads/:id/timeline returns
rows: [] together with hasOlderRows: true and olderCursor: null. The client is told older
history exists and given no cursor to request it, so the thread renders as a blank panel and
re-polls forever; bb thread log --all prints "Showing the newest 0 user-message turns".
I expected the visible rows to render — projection produces 46 rows, and segmentation then
discards all of them. The agent in the thread keeps working fine; only the view is dead.

Versions and environment

  • bb 0.43.1 (desktop app, up to date), macOS 27.0 (26A428), Node v26.3.0
  • provider: Codex, codex-cli 0.154.0
  • environment kind: project checkout (not a worktree)
  • bb Connect paired; also reproduces against 127.0.0.1 directly and via the bb CLI

Steps to reproduce

I do not have a minimal reproduction — I could not shrink this to a fresh thread. What I have
is a live thread that entered the state and has stayed in it, plus the exact code path.

On the affected thread (thr_jbsw52iwnj, ~134k events):

  1. curl -s 'http://127.0.0.1:/api/v1/threads//timeline?segmentLimit=8'
  2. bb thread log --all

Conditions that appear necessary (all true for this thread):

  • ~10 turns open concurrently and interleaved in the same sequence range
    (turn/started 1,224 vs turn/completed 1,214)
  • delegations that never completed, including one open since sequence 5,182
  • zero userMessage item events in the whole thread — Codex records user input as
    client/turn/requested / turn/input/accepted
  • the latest window owns from seq 313,450 while the last client/turn/requested is at
    seq 327,552, and the ordering/group context queries move the owned start past the anchor

Did NOT help: segmentLimit 8 / 20 / 50, pageKind=older, restarting the server (the state is
deterministic given the thread's events). Other threads on the same server render normally.

Expected vs actual

Actual:

$ curl -s 'http://127.0.0.1:<port>/api/v1/threads/<id>/timeline?segmentLimit=8'
{"maxSeq":329993,
 "rows":[],
 "contextBoundarySeq":null,
 "timelinePage":{"kind":"latest","segmentLimit":8,
                 "returnedSegmentCount":0,
                 "hasOlderRows":true,
                 "olderCursor":null}}

$ bb thread log <id> --all
(Showing the newest 0 user-message turns; older history omitted. Use --limit <n> (max 100) or --all to see more.)

activeThinking, contextWindowUsage, historySnapshot are all populated correctly — only rows
is empty. The UI shows an empty scroll area with no messages and no error (screenshot attached;
the whole message region is blank).

Expected:

The 46 rows that thread-view-projection produced should render, and hasOlderRows: true should
never be returned alongside olderCursor: null — that pairing is unrecoverable, since an "older"
page requires beforeCursor.

Evidence

Thread: thr_jbsw52iwnj · project proj_xfwnfj8asx · env env_esrz279tdk

Per-request stage breakdown, ~/.bb/logs/server.38.log ("Thread timeline build blocked the
event loop"), every build of this thread:

event-query + event-json-decode ... 6,461 events (~7.9 MB)
thread-view-projection .......... 46 rows
pagination-segmentation ......... 0 rows

{"threadId":"thr_jbsw52iwnj","totalDurationMs":1999.9,"selectionStrategy":"standard-window",
"pageKind":"latest","segmentLimit":20,"eventRowCount":6443,"eventDataBytes":7904854,
"projectedRowCount":47,"responseRowCount":0,
"stageTimings":[{"durationMs":1558.1,"stage":"ordering-context-query"},
{"durationMs":243.2,"stage":"group-context-query"},
{"durationMs":68.5,"stage":"event-query"},
{"durationMs":56.8,"stage":"event-json-decode"},
{"durationMs":50.3,"stage":"thread-view-projection"},
{"durationMs":0.005,"stage":"pagination-segmentation"}]}

Regression window — the same thread rendered fine earlier on this same build and flipped in
one step, then never recovered:

00:00:25 ok proj=343 resp=328 events=6100
11:00:29 ZERO proj=16 resp=0 events=5536

The build-log stage list also changed between app versions:
<= 0.42.x : accepted-client-request-context-query -> ... -> pagination-segmentation
0.43.x : that stage is gone, replaced by ordering-context-query + group-context-query
The stage that anchored the window to the last accepted client request no longer exists.

Code path (read from the sourcemap shipped in 0.43.1,
server/dist/start-server.js.map -> server/src/services/threads/timeline-pagination.ts):

paginateTimelineRows:
L122 .filter(s => s.cursor.anchorSeq >= args.ownedSequenceStart && ...)
L126 if (selectedSegments.length === 0) {
L130 olderCursor: null, returnedSegmentCount: 0, rows: []
isTimelineSegmentAnchorRow (L44) accepts only the contextBoundarySeq row or a
kind:"conversation" / role:"user" / turnRequest.kind:"message" row.

ownedSequenceStart is the window start (server/src/services/threads/timeline.ts ~L1173),
and knownHasOlderSegments is set true at ~L1175 when hasOlder.

So: no user-message row inside [ownedSequenceStart, ownedSequenceEnd) => every segment is
filtered out at L122 => bail at L126 with rows: [] and a hard-coded null cursor, while
knownHasOlderSegments says true. Two separable defects: (1) no anchorless fallback for rows
belonging to a segment that started before the window; (2) hasOlderRows: true with
olderCursor: null is an unrecoverable client state.

Collateral: each failed build blocks the event loop 1.5-2 s and the client re-polls every few
seconds, degrading the whole server:

{"msg":"Event loop stalled","maxDelayMs":2058.4,"meanDelayMs":834.4,
"slowestWork":"timeline-build thr_jbsw52iwnj","slowestWorkMs":2035.1}

A thread returning no rows should not re-do a 6,000-event / 8 MB decode on every poll.

Suggested fixes:

  1. When selectedSegments is empty but rows is non-empty, return the projected rows as a single
    anchorless segment instead of [].
  2. Never emit hasOlderRows: true with olderCursor: null — synthesise a cursor from the oldest
    projected row, or report hasOlderRows: false.
  3. Keep segments whose anchorSeq < ownedSequenceStart as a leading partial segment rather than
    filtering them out.

What you ruled out

  • Not a client/render bug — the API itself returns rows: [] (curl, no browser involved).
  • Not bb Connect — reproduces the same against 127.0.0.1 directly.
  • Not a paging-parameter issue — segmentLimit 8 / 20 / 50 and pageKind=older all return 0 rows.
  • Not server-wide — other threads on the same server return rows normally in the same period.
  • Not data loss — all 134,594 events are present in bb.db and the thread keeps appending.
  • Not fixed by a server restart — deterministic given the thread's event shape.
  • Not the 2.4 GB bb.db / 334 MB WAL — that inflates query times but the row count is 0
    independently of timing.

Suggested priority and effort (optional)

High — any thread that hits it becomes permanently unreadable with no workaround, and the retry loop degrades the whole server; effort probably Low for the null-cursor guard, Medium for the anchorless-segment fallback

Checks

  • I reproduced this on the latest release or on main, or I say above that I could not.
  • I searched open and closed issues for the same problem.
  • If an agent wrote this, the body ends with > AGENT GENERATED and links the thread or report.

AGENT GENERATED — diagnosed in bb thread thr_jqsdz8rdw7 (Claude Opus 5).

Activity

  1. added theissue type on Sep 15, 2026
  2. added
    threads
    partial-repro
    on Sep 15, 2026
  3. bb-slop-cop commented on Sep 15, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Bug · High priority · Medium effort; labels: threads, partial-repro. All classifications were missing and have been applied and verified.

    Reproduction and root-cause report: PARTIALLY REPRODUCED, high confidence in the pagination defect. A synthetic test failed identically in two clean checkouts of trusted main: ownership filtering drops the entire fallback-anchored group, then advertises older history with a null cursor. The control returns both rows. Production event selection and polling performance remain unverified.

    No PR: the broken local pnpm launcher prevented the required build and existing-test verification.

    AGENT GENERATED

  4. iamhenry commented on Sep 17, 2026

    @iamhenry
    Contributor

    also ran into this issue today. entire ui session went blank

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

    partial-reprothreads

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions