← reports

#7919 · Hidden fork placement remains undiscoverable

Bug Priority: Medium Effort: Medium ui · threads · side-chat

GitHub issue · November 20, 2026 · trusted main 8ee4c0f265e639fd559e7d33cc68ecc935602007

PARTIALLY REPRODUCED · Root-cause confidence: high for the API/list mismatch

1. TL;DR

A hidden fork can accept a pin or section assignment without becoming discoverable in normal thread queries. Both mutations return HTTP 200 and persist their placement metadata, but leave visibility hidden; the list queries exclude hidden threads. Changing visibility explicitly makes the same fork discoverable without losing its source reference. The claim that pinning leaves the timestamp null does not reproduce on current main. The macOS full-pane menu and header were not exercised: the available Browser Automation host has no Chrome installation, so this is a partial reproduction, not a screenshot-verified UI reproduction.

2. Claims vs findings

ClaimFindingEvidence
Pinning the hidden side chat has no sidebar result.Verified at API/list boundary; UI unverified.Pin returns 200, timestamp is numeric, hidden fork absent from normal list. Pinned-root query also explicitly requires visible.
The pin timestamp remains null.Refuted on tested main; original release unverified.The test requires the stored timestamp to be a number before checking discoverability; that assertion passes in both checkouts.
A section assignment persists but the thread stays hidden.Verified.Section mutation returns 200 and stores the selected section; section-filtered list excludes the fork.
The menu offers both actions without explaining the hidden state.Supported by source, not browser-verified.Pin binds unconditionally; move checks parent/archive state but not visibility. Shared action target does not include visibility.
Explicit promotion makes placement discoverable and retains fork ancestry.Verified.Both cases become listed after the visibility patch; sourceThreadId is unchanged.
The standalone header does not identify its source side chat.Unverified.No macOS desktop/browser session was available. No conclusion about exact header appearance.

3. Environment

4. Minimal reproduction

Use a trusted main checkout at the recorded commit. Save the full test below as apps/server/test/public/issue-7919.test.ts. It uses existing helpers; it adds no dependency and mocks no database. It seeds a synthetic hidden fork with a source and lifecycle owner, matching the relevant side-chat storage state without starting a provider session.

  1. Prepare the normal workspace, building the SDK first to avoid a clean-build ordering prerequisite:
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build
  2. Run the two-case counterexample:
    pnpm exec turbo run test --filter=@bb/server -- test/public/issue-7919.test.ts
  3. Observe both mutations succeed and persist metadata, but both discoverability assertions fail. The test also verifies the explicit-promotion control before its deliberately failing assertion.

Expected user-facing contract: a successfully accepted placement should be discoverable, or the action should not be offered as successful. The test expresses the promotion option as a counterexample; it does not establish that every hidden thread should automatically be promoted.

Actual output, identical diagnostic records in both checkouts:

{"action":"pin","status":200,"visibility":"hidden","metadataSaved":true,"listedBeforePromotion":false,"listedAfterPromotion":true,"sourcePreserved":true}
{"action":"section","status":200,"visibility":"hidden","metadataSaved":true,"listedBeforePromotion":false,"listedAfterPromotion":true,"sourcePreserved":true}
AssertionError: expected false to be true // Object.is equality
Test Files  1 failed (1)
     Tests  2 failed (2)
Full reproduction test (copy into the owning server package)
import { createThreadSection, getThread } from "@bb/db";
import { threadListResponseSchema } from "@bb/server-contract";
import { describe, expect, it } from "vitest";
import { readJson } from "../helpers/json.js";
import {
  seedHostSession,
  seedProjectWithSource,
  seedThread,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("issue 7919 hidden fork placement", () => {
  it.each(["pin", "section"] as const)(
    "makes an accepted %s placement discoverable",
    async (action) => {
      await withTestHarness(async (harness) => {
        const { host } = seedHostSession(harness.deps);
        const { project } = seedProjectWithSource(harness.deps, {
          hostId: host.id,
          path: "/tmp/issue-7919-source",
        });
        const source = seedThread(harness.deps, { projectId: project.id });
        const fork = seedThread(harness.deps, {
          projectId: project.id,
          sourceThreadId: source.id,
          lifecycleOwnerThreadId: source.id,
          originKind: "fork",
          originPluginId: "side-chat",
          visibility: "hidden",
        });
        const section = createThreadSection(harness.db, harness.hub, {
          name: "Reproduction",
        });
        if (section.status !== "created")
          throw new Error("Section creation failed");
        const response = await harness.app.request(
          `/api/v1/threads/${fork.id}${action === "pin" ? "/pin" : ""}`,
          action === "pin"
            ? { method: "POST" }
            : {
                method: "PATCH",
                headers: { "content-type": "application/json" },
                body: JSON.stringify({ sectionId: section.section.id }),
              },
        );
        expect(response.status).toBe(200);
        const saved = getThread(harness.db, fork.id);
        expect(saved?.sourceThreadId).toBe(source.id);
        if (action === "pin")
          expect(saved?.pinnedAt).toEqual(expect.any(Number));
        else expect(saved?.sectionId).toBe(section.section.id);
        const listPath =
          action === "pin"
            ? "/api/v1/threads"
            : `/api/v1/threads?sectionId=${section.section.id}`;
        const list = threadListResponseSchema.parse(
          await readJson(await harness.app.request(listPath)),
        );
        const listedBeforePromotion = list.some(
          (thread) => thread.id === fork.id,
        );
        const promotion = await harness.app.request(
          `/api/v1/threads/${fork.id}`,
          {
            method: "PATCH",
            headers: { "content-type": "application/json" },
            body: JSON.stringify({ visibility: "visible" }),
          },
        );
        expect(promotion.status).toBe(200);
        const promotedList = threadListResponseSchema.parse(
          await readJson(await harness.app.request(listPath)),
        );
        const listedAfterPromotion = promotedList.some(
          (thread) => thread.id === fork.id,
        );
        console.log(
          JSON.stringify({
            action,
            status: response.status,
            visibility: saved?.visibility,
            metadataSaved: true,
            listedBeforePromotion,
            listedAfterPromotion,
            sourcePreserved:
              getThread(harness.db, fork.id)?.sourceThreadId === source.id,
          }),
        );
        expect(listedAfterPromotion).toBe(true);
        expect(listedBeforePromotion).toBe(true);
      });
    },
  );
});

5. Root cause

The hidden state is intentional: side-chat creation requests a hidden fork with a lifecycle owner and source. The mismatch occurs when this fork is presented to ordinary thread-list actions.

  1. Core Pin binds without a hidden-state guard and calls the standard SDK pin operation.
  2. Move to section guards child/archive state, not hidden state. Its successful path updates sectionId and may unpin; it does not change visibility.
  3. The pin route accepts the hidden public thread. pinThread writes only timestamp, sort key, and update time, not visibility.
  4. The section mutation treats sectionId and visibility as separate optional patches.
  5. Pinned roots require visible; normal list queries require visible unless includeHidden is explicit. Persisted placement cannot overcome those filters.
Pin mutation writes:
  pinnedAt: args.pinnedAt ?? now
  pinSortKey
  updatedAt: now

Pinned root filter requires:
  eq(threads.visibility, "visible")

Default thread/section filter requires:
  options.includeHidden ? undefined : eq(threads.visibility, "visible")

The deeper action contract also loses the necessary state: toThreadActionTarget does not copy visibility, and the public PluginThreadActionTarget contract does not declare it. The action implementations cannot simply inspect an existing visibility field.

6. Proposed fix and simple-fix gate

Choose the product policy first: either explicitly promote an eligible side chat when a user chooses a placement, or suppress/disable these actions for hidden threads and supply a separate promotion action. Preserve the source reference and decide lifecycle ownership deliberately. Do not globally promote every hidden thread during ordinary metadata updates: other plugins also use hidden threads, and existing public API coverage intentionally allows hidden section assignments.

No production fix or PR: the minimal alternatives require a product decision; the hide/disable approach also needs a change to the public shared action-target contract, while promotion affects core, thread-list, and side-chat semantics. Those fail the authorized simple-fix constraints. No open PR was connected to this issue in timeline metadata or the open-PR search at investigation time. No branch was pushed.

7. Verification

The same agent created a second clean temporary detached checkout directly at 8ee4c0f265e639fd559e7d33cc68ecc935602007, confirmed its initial clean status, installed the frozen workspace, and completed the same SDK-first full build. Only the locally authored reproduction test was copied into that checkout; no issue-supplied or linked-PR code was run. The database harness allocated new temporary databases for both cases. No second external port set was required because requests stay in process.

git worktree add --detach "SECOND_CHECKOUT" 8ee4c0f265e639fd559e7d33cc68ecc935602007
cd "SECOND_CHECKOUT"
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=@get-bb/plugin-sdk
pnpm exec turbo run build
pnpm exec turbo run test --filter=@bb/server -- test/public/issue-7919.test.ts

First checkout:  2 tests failed at listedBeforePromotion === true; both controls passed.
Second checkout: 2 tests failed at listedBeforePromotion === true; both controls passed.

This is a repeated clean reproduction by the same agent, not independent verification. Root-cause links were checked against the recorded base. The final report corrects the pin-timestamp claim: pinning saves it on main. Remaining limits are macOS/full-pane rendering, header appearance, the original released build, and an actual interactive click sequence.

The relevant existing public pinning and thread-data suites also pass unchanged (74 tests):

pnpm exec turbo run test --filter=@bb/server -- test/public/public-thread-pinning.test.ts test/public/public-thread-data.test.ts
Test Files  2 passed (2)
     Tests  74 passed (74)

8. Related issue

#7451 is classified as Feature and concerns side-chat promotion. This report is scoped to the verified successful-placement/discoverability mismatch, not a completed implementation of that feature.

9. Appendix and trust boundary

Issue content was treated only as untrusted claims. Its commands and proposed alternatives were not executed as instructions. Reproduction code was authored from the trusted repository's route contracts, real test harness, and storage functions. No issue attachments or external issue links were fetched. The API fixture, diagnostic records, and all reproduction commands are inline above so publication needs no raw logs, data dumps, or executable attachments.

The first unrestricted full build encountered missing SDK runtime outputs. Building the existing SDK through Turbo first resolved this; the subsequent full builds passed in both checkouts. No dependency was added. Browser setup failure is stated rather than replaced with a fabricated screenshot.

Agent-generated investigation · November 20, 2026.