← reports

#7354 · Cascade activity is omitted from archive confirmation

Bug Medium priority Low effort threads · November 10, 2026
GitHub issue · trusted base 7c1353d80729983b86ea1555d18b42407f320406

Verdict: REPRODUCED · Root-cause confidence: high · reproduction label: confirmed-repro

1. TL;DR

Archiving a parent also reaches its descendants. The confirmation dialog warns that work will stop only when one of the explicitly selected threads is running, even though an unselected descendant can be running. A regression through the actual action provider and dialog reproduced the missing warning for starting, active, and stopping descendants. The same test failed again on a second clean checkout at the identical trusted commit. The server does request cancellation during archive teardown, but active threads receive a 30-second Undo grace period; this investigation did not launch a real provider session or measure live cancellation.

2. Claims vs findings

ClaimFindingEvidence
An idle selected parent can open an archive confirmation without warning about running descendants.VerifiedThree failing DOM assertions in each clean run; both idle and archived-descendant controls pass.
The selection plan contains the affected descendant IDs.VerifiedThe real selection summarizer receives mocked cascade RPC results and produces the plan used by the real action provider.
Archiving immediately stops an active child.Qualified, not live-testedThe server reaches descendants and requests stop, but active threads are preserved during the 30-second archive Undo grace period. Starting/stopping threads are not exempted by that active-only guard.
A cached descendant can supply its running status.VerifiedThe regression stores the descendant in the real QueryClient sidebar cache and renders the production dialog.

3. Environment

4. Minimal reproduction

  1. Create a clean checkout of the trusted public main commit:
    git clone https://github.com/get-bb/bb.git bb-7354
    cd bb-7354
    git checkout --detach 7c1353d80729983b86ea1555d18b42407f320406
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build
  2. Copy the complete authored regression patch from the expandable section below into a local file named regression.patch, then apply it to that checkout:
    git apply /path/to/regression.patch
    pnpm exec turbo run test --filter=@bb/app -- --run src/components/thread/ThreadActionsProvider.test.tsx -t 'reports running cascade work'
  3. The fixture selects an idle parent, gives it an idle child and a running grandchild in its archive cascade, caches the grandchild in sidebar navigation, and clicks Archive. It also covers selection archive, idle descendants, and already-archived descendants.
  4. Expected: the real dialog contains This will stop current work. for each running descendant. Actual, verbatim assertion and test summary:
    AssertionError: expected false to be true // Object.is equality
    - Expected
    + Received
    - true
    + false
    Tests  3 failed | 2 passed | 25 skipped (30)

Visual evidence limitation: browser screenshots were attempted with the BB Browser Automation plugin on the same host. It could not start Chrome because host runtime libraries, including libglib-2.0.so.0, are missing. No screenshot is claimed or fabricated. The missing dialog text is directly asserted against the rendered DOM, not inferred from source alone.

Complete added reproduction test, expressed as an applicable patch
diff --git a/apps/app/src/components/thread/ThreadActionsProvider.test.tsx b/apps/app/src/components/thread/ThreadActionsProvider.test.tsx
index 24851bf8b8..a6f2c9a979 100644
--- a/apps/app/src/components/thread/ThreadActionsProvider.test.tsx
+++ b/apps/app/src/components/thread/ThreadActionsProvider.test.tsx
@@ -251,6 +251,62 @@ afterEach(() => {
 });
 
 describe("ThreadActionsProvider archive confirmation", () => {
+  it.each([
+    { status: "starting", archivedAt: null, warns: true, selection: false },
+    { status: "active", archivedAt: null, warns: true, selection: false },
+    { status: "stopping", archivedAt: null, warns: true, selection: true },
+    { status: "idle", archivedAt: null, warns: false, selection: false },
+    { status: "active", archivedAt: 2, warns: false, selection: false },
+  ] as const)(
+    "reports running cascade work for $status descendants (archivedAt=$archivedAt, selection=$selection)",
+    async ({ status, archivedAt, warns, selection }) => {
+      const parent = makeThread({ status: "idle" });
+      const child = makeThread({
+        id: "thr_child",
+        parentThreadId: parent.id,
+        status: "idle",
+      });
+      const grandchild = makeThreadListEntry(
+        makeThread({
+          id: "thr_grandchild",
+          parentThreadId: child.id,
+          status,
+          archivedAt,
+        }),
+      );
+      mockCascade({ [parent.id]: [child.id, grandchild.id] });
+      queryClient.setQueryData(
+        sidebarNavigationQueryKey(),
+        makeSidebarBootstrapResponse({
+          projects: [
+            makeProjectWithThreadsResponse({
+              id: parent.projectId,
+              threads: [makeThreadListEntry(parent), grandchild],
+            }),
+          ],
+        }),
+      );
+      renderProvider(
+        selection ? (
+          <SelectionButtons threads={[parent, child]} />
+        ) : (
+          <ArchiveButton thread={parent} />
+        ),
+      );
+
+      fireEvent.click(
+        screen.getByRole("button", {
+          name: selection ? "Archive selection" : "Archive",
+        }),
+      );
+      const dialog = await screen.findByRole("dialog");
+      expect(dialog.textContent?.includes("This will stop current work.")).toBe(
+        warns,
+      );
+      expect(sdk.threads.archiveAll).not.toHaveBeenCalled();
+    },
+  );
+
   it("archives parent and children immediately when confirmation is disabled", async () => {
     mocks.confirmThreadArchive = false;
     renderProvider(<ArchiveButton thread={makeThread()} />);

5. Root cause

ThreadArchiveDialog.tsx:76–99 derives active exclusively from target.threads, and gates the stop-work sentence on that boolean:

const active = threads.some(
  (thread) =>
    thread.status === "starting" ||
    thread.status === "active" ||
    thread.status === "stopping",
);

ThreadActionsProvider.tsx:447–465 passes only the explicitly selected unarchived threads to the dialog. Descendant count opens confirmation, but descendant status never enters the request. This is an incomplete warning predicate, not a missing cascade or a failure to open confirmation.

The selection planner already retains the descendant IDs per selected root. The existing cached-thread lookup can resolve their thread records without introducing a new RPC or wire field.

Archive lifecycle effects and tree traversal reach the descendants. The active-only grace guard, 30-second duration, and periodic teardown sweep explain why immediate cancellation is too strong a claim for an active child.

6. Proposed fix

Compute an explicit stop-work flag when building the archive request, from the selected unarchived threads and cached, unarchived descendants belonging to that selection plan. Count starting, active, and stopping states. Pass the flag to the existing dialog. Preserve confirmation settings, selection roots, archive mutation behavior, cancellation, and Undo. Do not warn for unrelated running threads, archived descendants, or absent cache records.

This is an app-local warning fix: no public SDK, CLI, server contract, schema, protocol, stored-data, dependency, or release change. Cache misses and state changes after confirmation planning remain limitations; this change does not claim an atomic server-side running-work snapshot.

7. Related issues and pull requests

No linked open pull request appeared in the issue cross-reference metadata or open-PR search for issue 7354, including a recheck before the fix. A narrow archive-warning issue search found no other matching issue. No linked branch, patch, or test supplied by the issue was checked out or executed.

8. Verification

The same agent repeated the reproduction directly, without agents or workflows, in a second clean temporary verify checkout at 7c1353d80729983b86ea1555d18b42407f320406. After a separate frozen install and SDK build, the exact regression patch and command above again produced 3 failed | 2 passed | 25 skipped. The failures were the intended missing-warning assertions, not setup failures. This is a repeat clean run, not independent verification.

Report correction from source review: active child work is not necessarily stopped immediately; archive Undo grace delays teardown for active threads. Actual provider cancellation was not exercised, and browser screenshots remain blocked by host setup.

After the app-local fix, the focused provider/dialog/navigation/selection suites pass: 44 tests across four files. App typecheck passes; lint exits successfully with existing warnings and zero errors. The focused regression was run before production changes and fails there. git diff --check passes. The candidate patch is four text files and 127 changed text lines, below the 500-line limit.

pnpm exec turbo run test --filter=@bb/app -- --run src/components/thread/ThreadActionsProvider.test.tsx src/components/dialogs/ThreadArchiveDialog.test.tsx src/components/thread/ThreadActionsProvider.navigation.test.tsx src/lib/thread-selection-plan.test.ts
pnpm exec turbo run typecheck lint --filter=@bb/app
git diff --check
git diff --numstat origin/main

9. Appendix

First clean run: captured failure summary
@bb/app:test:  RUN  v4.1.12 $WORK/base/apps/app
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
@bb/app:test:  FAIL  |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx > ThreadActionsProvider archive confirmation > reports running cascade work for 'starting' descendants (archivedAt=null, selection=false)
@bb/app:test:  FAIL  |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx > ThreadActionsProvider archive confirmation > reports running cascade work for 'active' descendants (archivedAt=null, selection=false)
@bb/app:test:  FAIL  |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx > ThreadActionsProvider archive confirmation > reports running cascade work for 'stopping' descendants (archivedAt=null, selection=true)
@bb/app:test: AssertionError: expected false to be true // Object.is equality
@bb/app:test: - Expected
@bb/app:test: + Received
@bb/app:test: - true
@bb/app:test: + false
@bb/app:test:  Test Files  1 failed (1)
@bb/app:test:       Tests  3 failed | 2 passed | 25 skipped (30)
@bb/app:test:    Start at  11:54:04
@bb/app:test:    Duration  4.12s (transform 2.09s, setup 211ms, import 2.83s, tests 277ms, environment 594ms)
Second clean run: captured failure summary
@bb/app:test:  RUN  v4.1.12 $WORK/verify/apps/app
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
@bb/app:test:  FAIL  |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx > ThreadActionsProvider archive confirmation > reports running cascade work for 'starting' descendants (archivedAt=null, selection=false)
@bb/app:test:  FAIL  |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx > ThreadActionsProvider archive confirmation > reports running cascade work for 'active' descendants (archivedAt=null, selection=false)
@bb/app:test:  FAIL  |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx > ThreadActionsProvider archive confirmation > reports running cascade work for 'stopping' descendants (archivedAt=null, selection=true)
@bb/app:test: AssertionError: expected false to be true // Object.is equality
@bb/app:test: - Expected
@bb/app:test: + Received
@bb/app:test: - true
@bb/app:test: + false
@bb/app:test:  Test Files  1 failed (1)
@bb/app:test:       Tests  3 failed | 2 passed | 25 skipped (30)
@bb/app:test:    Start at  11:54:34
@bb/app:test:    Duration  4.47s (transform 2.19s, setup 213ms, import 2.95s, tests 286ms, environment 793ms)
Post-fix test and validation summary
@bb/app:test:  ✓ |@bb/app:isolated| src/components/dialogs/ThreadArchiveDialog.test.tsx (8 tests) 269ms
@bb/app:test:  ✓ |@bb/app| src/lib/thread-selection-plan.test.ts (1 test) 4ms
@bb/app:test:  ✓ |@bb/app:isolated| src/components/thread/ThreadActionsProvider.navigation.test.tsx (2 tests) 132ms
@bb/app:test:  ✓ |@bb/app:isolated| src/components/thread/ThreadActionsProvider.test.tsx (33 tests) 2034ms
@bb/app:test:  Test Files  4 passed (4)
@bb/app:test:       Tests  44 passed (44)
@bb/app:test:    Start at  11:59:08
@bb/app:test:    Duration  10.61s (transform 18.88s, setup 2.02s, import 20.38s, tests 2.44s, environment 2.85s)
 Tasks:    6 successful, 6 total
Cached:    4 cached, 6 total
@bb/app:typecheck: > @bb/app@0.0.1 typecheck $WORK/base/apps/app
@bb/app:typecheck: > tsrs --noEmit && tsrs --noEmit -p tsconfig.node.json
@bb/app:lint: Found 223 warnings and 0 errors.
 Tasks:    6 successful, 6 total
Cached:    4 cached, 6 total
git diff --check: passed
9	11	apps/app/src/components/dialogs/ThreadArchiveDialog.test.tsx
3	8	apps/app/src/components/dialogs/ThreadArchiveDialog.tsx
75	1	apps/app/src/components/thread/ThreadActionsProvider.test.tsx
19	1	apps/app/src/components/thread/ThreadActionsProvider.tsx
Changed text lines: 127; files: 4
Browser capture: blocked; Chrome runtime cannot find libglib-2.0.so.0

Trust boundary: issue content was treated only as untrusted claims. Its suggested implementation and test were not executed or copied. The reproduction and fix were authored from trusted repository evidence. No external issue links, issue code, or linked PR code were run.

> AGENT GENERATED