Skip to content

Reparented threads can remain at sidebar root until reload (unverified) #3029

Open

Description

@SawyerHood

Summary

Two task-origin threads remained visible as top-level sidebar rows after bb thread update <child> --parent-thread <parent> returned the updated parent and persisted it. Reloading the app made both rows appear under the parent. The same operation updates immediately in an isolated dev store on current main, so this report is unverified and needs evidence from a recurrence.

Versions and environment

  • Observed 2026-09-03 on bb 0.41.0, Linux, Node 24.18.0, Codex 0.153.1
  • App viewed remotely through bb Connect
  • Server source checkout was 831fd0abd4 when inspected after the incident
  • Original project: proj_atixi2qwed
  • Original parent: thr_b75gwewczb
  • Original children: thr_n35mqx4spq, thr_6ccxy66282
  • Closest repro attempted from source at dbc16017c9c980391fb1bc604b45b94f9c3ae105 with a fresh isolated dev data directory

Steps to reproduce

The original sequence was:

  1. Create two standalone threads through the Tasks plugin.
  2. Keep the app and project sidebar open.
  3. Run:
    bb thread update thr_n35mqx4spq --parent-thread thr_b75gwewczb
    bb thread update thr_6ccxy66282 --parent-thread thr_b75gwewczb
  4. Observe the sidebar without reloading.

Closest faithful dev attempt, which did not reproduce:

  1. Start an isolated app with scripts/bb-dev-app start and load it in Chrome.
  2. Run:
    eval "$(scripts/bb-dev-app env)"
    pnpm --silent bb:dev thread spawn --project personal --provider codex --prompt "Reply only with ok."
    pnpm --silent bb:dev thread spawn --project personal --provider codex --prompt "Reply only with ok."
    pnpm --silent bb:dev thread update <child> --parent-thread <parent>
  3. The child moved under the parent in the open sidebar within about one second, without navigation or reload.

The immediate update also worked with an active child, two children reparented in succession, and two threads in a standard worktree project.

Expected vs actual

Actual during the incident:
The CLI returned the requested parentThreadId and subsequent reads showed it persisted, but both children remained top-level sidebar rows. Reloading the app made them children.

Expected:
The open sidebar moves each child under the parent after the successful PATCH, without a reload.

Actual on current main in an isolated dev store:
The open sidebar moved each child immediately, so the incident did not reproduce.

Evidence

  • thr_n35mqx4spq and thr_6ccxy66282 both currently persist parentThreadId: thr_b75gwewczb; both have originPluginId: tasks.
  • The PATCH route passes parentThreadId to updateThread:
    patch(routes.update, async (context, payload) => {
    const thread = requirePublicThread(deps.db, context.req.param("id"));
    if (payload.parentThreadId) {
    assertValidParentThread(deps, {
    childThreadId: thread.id,
    parentThreadId: payload.parentThreadId,
    });
    }
    if ("model" in payload || "reasoningLevel" in payload) {
    await applyThreadExecutionOverride(deps, {
    thread,
    patch: {
    ...("model" in payload ? { model: payload.model } : {}),
    ...("reasoningLevel" in payload
    ? { reasoningLevel: payload.reasoningLevel }
    : {}),
    },
    });
    }
    const metadataUpdate: UpdateThreadInput = {};
    if ("title" in payload) {
    metadataUpdate.title = payload.title;
    }
    const sectionId = payload.sectionId;
    if (sectionId !== undefined) {
    if (sectionId !== null) {
    requireThreadSection(deps, sectionId);
    }
    metadataUpdate.sectionId = sectionId;
    }
    if ("parentThreadId" in payload) {
    metadataUpdate.parentThreadId = payload.parentThreadId;
    }
    if ("visibility" in payload) {
    metadataUpdate.visibility = payload.visibility;
    }
    const updated =
    Object.keys(metadataUpdate).length > 0
    ? updateThread(deps.db, deps.hub, thread.id, metadataUpdate)
    : requirePublicThread(deps.db, thread.id);
  • updateThread emits parent-changed with the project ID:
    if ("lastReadAt" in input) changes.push("read-state-changed");
    if (
    "visibility" in input &&
    input.visibility !== existing.visibility
    ) {
    changes.push("title-changed");
    }
    if (
    "parentThreadId" in input &&
    input.parentThreadId !== existing.parentThreadId
    ) {
    changes.push("parent-changed");
    }
    and
    if (updated && changes.length > 0) {
    notifier.notifyThread(id, changes, {
    projectId: existing.projectId,
    });
  • The hub broadcasts list-relevant thread changes to thread-list subscribers:
    function subscriptionKeysForMessage(message: ChangedMessage): string[] {
    switch (message.entity) {
    case "thread":
    return message.id
    ? [
    subscriptionKey({ kind: "thread-list" }),
    subscriptionKey({ kind: "thread-detail", threadId: message.id }),
    ]
    : [subscriptionKey({ kind: "thread-list" })];
    and
    notifyThread(
    threadId: string,
    changes: ThreadChangeKind[],
    metadata?: ThreadChangeMetadata,
    ): void {
    const message: ThreadChangedMessage = {
    type: "changed",
    entity: "thread",
    id: threadId,
    ...(metadata ? { metadata } : {}),
    changes,
    };
    if (isThreadListRelevantChange(message)) {
    this.notifyClients(message);
    } else {
    this.notifyThreadEventsAppendedCoalesced(threadId, message);
    }
  • The client maps parent-changed to thread-list invalidation, which includes the sidebar bootstrap query:
    "pin-state-changed": {
    flush: "debounced",
    dirty: [dirtyThreadListQueries, dirtyThreadDetailQueries],
    },
    "parent-changed": {
    flush: "debounced",
    dirty: [dirtyThreadListQueries, dirtyThreadDetailQueries],
    },
    and
    export function getThreadListInvalidationQueryKeys({
    projectId,
    queryClient,
    }: ThreadListInvalidationArgs): QueryKey[] {
    const threadListQueryKeys = projectId
    ? getCachedProjectThreadListInvalidationQueryKeys({
    projectId,
    queryClient,
    })
    : [threadsQueryKey()];
    return [
    ...threadListQueryKeys,
    sidebarNavigationQueryKey(),
    threadSearchQueryKeyPrefix(),
    ];
  • The tree is rebuilt from each entry's current parentThreadId; it has no create-only path:
    function isRootThread(
    thread: ThreadListEntry,
    projectThreadIds: ReadonlySet<string>,
    ): boolean {
    return (
    thread.parentThreadId === null ||
    !projectThreadIds.has(thread.parentThreadId)
    );
    }
    and
    export function buildProjectThreadGroups(
    allProjectThreads: readonly ThreadListEntry[],
    compareThreads: ThreadComparator = compareStandardThreads,
    draftThreadIds: ReadonlySet<string> = new Set(),
    ): ProjectThreadItem[] {
    return buildThreadTreeItems(
    allProjectThreads,
    compareThreads,
    true,
    draftThreadIds,
    );
    }
    function buildThreadTreeItems(
    allThreads: readonly ThreadListEntry[],
    compareThreads: ThreadComparator,
    groupEnvironmentThreads: boolean,
    draftThreadIds: ReadonlySet<string>,
    ): ProjectThreadItem[] {
    const projectThreads = allThreads.filter(isSidebarProjectThread);
    const projectThreadIds = new Set(projectThreads.map((thread) => thread.id));
    const childrenByParentId = new Map<string, ThreadListEntry[]>();
    for (const thread of projectThreads) {
    if (thread.parentThreadId === null) continue;
    if (!projectThreadIds.has(thread.parentThreadId)) continue;
    const children = childrenByParentId.get(thread.parentThreadId);
    if (children) {
    children.push(thread);
    } else {
    childrenByParentId.set(thread.parentThreadId, [thread]);
    }
    }
  • No WebSocket disconnect, reconnect, invalid-message, or related server error was present around the original update window. The first relevant later log entry was a parent timeline load after the manual navigation/reload.
  • Investigation thread: https://bee.getbb.app/threads/thr_jsuewiepay

What you ruled out

  • Not a generally missing server event: the existing DB test verifies parent-changed, and the isolated end-to-end operation updated immediately.
  • Not a missing sidebar query key: getThreadListInvalidationQueryKeys explicitly includes sidebarNavigationQueryKey().
  • Not create-only tree behavior: buildThreadTreeItems derives children from current parentThreadId values on every rebuilt list.
  • Not explained by active status: an active child updated immediately in the dev app.
  • Not explained by two rapid updates: two sequential updates both appeared without a reload.
  • Not explained by personal versus worktree project grouping: both variants updated immediately.
  • No duplicate issue found with searches for reparent, parent-changed, sidebar, realtime, and refresh.

Suggested priority and effort (optional)

Medium if recurrent because the state is persisted and the workaround is a reload; unknown effort until a recurrence captures the client-side changed message and sidebar-bootstrap refetch.

  • 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

Activity

  1. added
    threads
    ui
    no-repro
    on Sep 3, 2026
  2. added theissue type on Sep 3, 2026
  3. added
    partial-repro
    and removed
    no-repro
    on Sep 3, 2026
  4. bb-slop-cop commented on Sep 3, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification: Bug · Priority Medium · Effort Medium · labels threads, ui, partial-repro.

    Report: https://get-bb.github.io/reports/issues/3029.html

    • Verdict: PARTIALLY REPRODUCED
    • Root-cause confidence: medium
    • Root cause: a parent change emitted before the server registers the client's thread-list subscription is not replayed or reconciled; the reported long-open natural recurrence remains unverified.
    • Reproduction label: partial-repro
    • Pull request: none — normal settled-page updates worked, and a complete remedy requires realtime reconciliation or protocol judgment, so this is not a safe simple fix.
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-reprothreadsui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions