Skip to content

No visibility into a provider session's subagent mesh: live rosters and interaction attribution #3020

Description

@bradhallett

The workflow

I run orchestrator workloads — parallel scouts, reviewers, task fan-out — through a single provider thread (today via acp-omp, whose agent runs its own subagent mesh). The workflow I want:

  1. Spawn the orchestrator thread and let it fan out work to its child agents.
  2. Watch the live roster: which children exist, their labels, what each is doing (running / idle / parked / aborted), without opening the provider's own UI or logs.
  3. When a child agent raises a pending interaction (approval, question), see which agent is asking before answering — bb thread interactions-style attribution, and an Agent: … line on the banner in the desktop app.

What happens today

The provider session's subagent mesh is entirely invisible to bb. A thread running ten child agents looks like one opaque single-agent session; there is no vocabulary for a roster anywhere — not in the bridge protocol, the daemon contract, or persistence — and pending interactions raised inside a subagent arrive unattributed, so an approval request reads as if the parent asked. On desktop/CLI there is no roster to inspect at all. (Binary-verified for omp 18.1.7: it emits no subagent state over ACP today, so even a wire-level view would be empty for that provider as shipped.)

What you would expect

  • A thread-scoped roster snapshot per provider session: ThreadSubagent { id, label, state, summary, transcriptRef }, latest-snapshot-wins semantics (mirrors thread/goal/updated).
  • Emission capability-gated on the bridge handshake (subagents, default false) — providers that cannot report rosters are unaffected; the delta grammar gains thread.subagents.
  • bb thread subagents <id> [--json] CLI + SDK method, and a desktop roster panel alongside the existing prompt-area cards.
  • Interaction attribution: agentLabel on pending interactions end-to-end (raise path → persistence → every list/detail/resolve surface, banner line in the app).

Context and alternatives

I prototyped the full slice on my fork — branch feat/subagent-roster @ 853f7b5fe, stacked on the ACP plan-capability branch (see #3019). It covers the contract layer (thread/subagents/updated event, delta thread.subagents, protocol bump for the daemon launch capability, agentLabel schema with default-null so legacy payloads parse), migration 0113 (pending_interactions.agent_label + widened state partial index), the server capability chain, dormant ACP translation (subagents_update wire kind → delta, gated per provider — nothing ships enabled until omp-side emission exists), CLI/SDK/guide/skill/docs parity, and the desktop ThreadSubagentsCard. Plugin SDK needed a patch bump (0.4.41) per the npm version guard. Full CI-parity gate run locally (typecheck/test/lint/build, bundle budget, provider ratchet, version guard).

Design choices worth a maintainer eye:

  • Capability stays off by default and off for every shipped agent — honesty rule: no live provider emits rosters over the wire today, so the surface is ready but dark until omp-side emission lands. The alternative (advertising it broadly) would show empty rosters and erode trust in the capability bit.
  • Snapshot-replace rather than per-agent deltas: matches the goal/extensionState precedent and keeps client merge logic trivial.
  • The daemon wire does not carry an agent label yet, so plugin-origin interactions stay null until the bridge protocol grows the field — dormant plumbing on the same honesty rule.

Ruled out:

Tested against main at f6868ad; investigation thread thr_wr92wddupy.

AGENT GENERATED

Activity

  1. added
    providers
    threads
    provider-acp
    on Sep 3, 2026
  2. bb-slop-cop commented on Sep 3, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification applied:

    • Type: Feature
    • Priority: Medium
    • Effort: High
    • Labels: providers, threads, provider-acp

    The request adds new provider-session visibility and interaction attribution. It does not describe unexpected existing behavior.

  3. neox31 commented on Sep 10, 2026

    @neox31

    Confirmed independently on BB 0.42.1 with the Cursor ACP provider. Three provider-internal background subagents were actively running, but the parent thread reported activeBackgroundAgentCount: 0 and childThreads: []; the BB UI showed no activity, so the user reasonably believed work had stopped. We initially filed #3409 and closed it as a duplicate of this issue. This confirms the gap also affects Cursor ACP, not only the OMP mesh described in the original report.

  4. neox31 commented on Sep 10, 2026

    @neox31

    Additional lifecycle evidence from the same Cursor ACP run: all three provider-internal background agents eventually recorded a successful terminal state, but BB never surfaced their start, active state, or completion. The parent thread remained at activeBackgroundAgentCount: 0 / childThreads: [], and no automatic completion notification reached the parent agent; completion was discovered only by manually inspecting each provider transcript. This means the gap covers completion delivery as well as live roster visibility. A minimal fallback would be an opaque provider-background-work count plus terminal notification even before detailed roster support lands.

  5. HugoVizcainoSantana commented on Oct 20, 2026

    @HugoVizcainoSantana

    For providers that already report subagents (Claude Code, Codex), bb has the per-subagent data in nested delegation rows; what's missing is UI and SDK access. Filed that part as #5864 so this issue can stay focused on ACP providers that emit nothing.

    AGENT GENERATED

  6. adamalagha commented on Oct 28, 2026

    @adamalagha

    Hermes ACP evidence and proposed native display fixes

    I investigated the same missing provider-internal activity through Hermes ACP on Windows. An isolated provider plugin can publish real work into BB's ordinary background-task dropdowns, but it did not pass full acceptance: truthful unknown status, follow-up delivery during background work, and live output after turn closure remain incomplete. The proposed patch below fixes four native display paths; it does not implement complete Hermes integration or resolve all of #3020.

    Versions and verification scope

    • Runtime reproduction: installed BB desktop 0.47.1, plugin SDK 0.6.79, Windows 11 Pro build 26200, Node 24.19.0, Hermes Agent 0.22.2 / local revision d923a5eb487a.
    • Source base: 5e1acd765039e874643f34c4d35409e58484e408.
    • The attached patch applies cleanly to inspected main 33b8f913e8fadc815b329eb0b13d2612faa4495e and the newly published desktop 0.48.0 release commit 1a4a1d254c7b1f70d340ef9c800dad77dbeb8e66. This is an application check only. I have not installed or runtime-tested 0.48.0.
    • Investigation chat thr_si2jxaa7nn; owned acceptance chat thr_pwzkzc2g27.

    The stock-UI tests used a real Hermes-launched, bounded local process, then generated new output through its health endpoint and completed it through its finish endpoint. The plugin published only owner-verified activity. No custom UI, database event insertion, managed bundle edits, fake completion, or replacement of the ordinary ACP provider was used. Existing chat/provider/session identities were retained. The experimental plugins are disabled.

    Native display reproduction

    With an owned provider fixture that emits native backgroundTask items:

    1. Start actual bounded work inside turn 1 and publish type: backgroundTask, taskType: local_bash, status: pending, taskStatus: running with its initial summary/output.
    2. Finish the parent response while that process remains alive. Expand the original work group and its native output disclosure.
    3. Send a newer user message. Append output to the real process, then publish progress for the same item and original turn. Compare the persisted summary with the already-expanded disclosure before reloading.
    4. Simulate tracking failure, retaining the logs, with native taskStatus: paused, description Status unknown, and a provider presentation requesting an unknown-state title. Recover that same item to running with a refreshed presentation.
    5. Complete the process, verify its real terminal evidence, and watch the open disclosure without reloading. Repeat with an emulated touch browser and with browser reconnect/replay.

    Observed on the stock 0.47.1 frontend:

    • Background output advances live while the logical turn is kept open. Once work is on a closed turn, the disclosure can retain stale data until reload. The persisted task summary continues advancing.
    • The model-idle background indicator uses a static icon. It should animate while verified work runs and respect reduced motion.
    • During the real tracking outage the native record becomes paused, yet the dropdown reads Running background command: followed by Status unknown: .... It should not describe unknown work as running.
    • Background-task projection retains an old provider presentation after later progress, so recovery can retain the earlier unknown label.

    Source at the tested base:

    Proposed patch and verified limits

    The eight-file patch includes regression tests and:

    • Invalidates the correct disclosed turn details on background lifecycle changes, including with timeline push enabled, while preserving active fetches and unrelated caches.
    • Uses the existing native loading spinner for background work with reduced-motion support.
    • Honors provider title presentation and displays paused work without a running label or shimmer.
    • Updates presentation on later background progress without moving the original item.

    The new regressions failed before repair. The focused suite passed 137 tests, and the source app and server built. The repository's tsrs compiler has no Windows binary; the configured TypeScript 6.0.2 compiler passed app and thread-view --noEmit checks instead. This is not a passing tsrs claim.

    pnpm exec turbo run test --filter=@bb/thread-view --filter=@bb/app --concurrency=2 --continue=always --output-logs=errors-only -- --maxWorkers=1 background-task-title.test.ts background-task-timeline.test.ts ThreadStatusGlyph.test.tsx realtime-cache-effects.test.ts
    pnpm exec turbo run build --filter=@bb/app --filter=@bb/server --concurrency=2 --output-logs=errors-only

    Eleven browser checks passed with the built source frontend against the existing backend and a real bounded process, including native dropdown logs, spinner, original-turn ordering before a newer message, live progress/exit, replay, reduced motion, and touch rendering. That source frontend used a temporary loopback preview proxy. The installed frontend was untouched, and these passing patched-source checks must not be confused with the later failing stock-frontend plugin experiment.

    The stock-frontend held-turn plugin experiment passed live logs, tracking recovery on the same item, reconnect, reload replay, and touch disclosure. It failed the complete acceptance gate. Its 42 passing deterministic checks include a characterization of the SDK limitation below; they do not establish a usable plugin. Native aggregation can also count an unknown paused descendant as active background work. That policy and full provider integration are outside the attached display patch.

    Additional protocol blocker: explicit turns lose main-run idle

    The plugin's wire trace confirms it emits turn.mainRun with state: idle after the real model response, retaining the explicit original turn identity for correct ownership. BB emits no corresponding native turn/mainRun/updated, so a newer user message remains queued while the real background process runs.

    This reduces to the installed SDK assembler without Hermes, UI, or a database. In a scratch directory with @get-bb/[email protected], save and run this as repro.mjs:

    import {experimental_createDeltaAssembler} from '@get-bb/plugin-sdk/provider-bridge/testing';
    import {threadDeltaNotificationParamsSchema} from '@get-bb/plugin-sdk/provider-bridge';
    
    for (const explicit of [false, true]) {
      const assembler = experimental_createDeltaAssembler({
        providerId: 'owned-test', entropyPrefix: 'repro',
        textDeltaFlushMs: 0, progressThrottleMs: 0,
      });
      const events = assembler.assemble(threadDeltaNotificationParamsSchema.parse({
        threadId: 'owned-test',
        deltas: [
          {kind: 'turn.open', ...(explicit ? {providerTurnId: 'verified-origin'} : {})},
          {kind: 'turn.mainRun', state: 'idle'},
        ],
      }));
      console.log(JSON.stringify({explicit, events: events.map(event => event.type)}));
    }

    Actual output:

    {"explicit":false,"events":["turn/started","turn/mainRun/updated"]}
    {"explicit":true,"events":["turn/started"]}

    Expected: main-run idle should reach the correctly identified original turn for both supported ways to open it.

    Explicit turn.open resolves a vouched ID without setting the implicit current ID. turn.mainRun reads only that implicit ID. The same code remains in the source inspected at submission time.

    Proposed direction for maintainer discussion, not included in the display patch: let turn.mainRun target a vouched providerTurnId, preserving existing implicit-turn behavior and testing both paths. Simply discarding original-turn ownership to bypass the issue would weaken late-output correctness. Fresh-start origin recovery and complete internal-worker lifecycle coverage remain unverified.

    Scope and maintainer input

    #3409 was closed as a duplicate of #3020; its Cursor ACP evidence supports the shared provider-visibility gap. The native display defects above also affect work already published to BB and may deserve separate tracked bugs. This is partial supporting evidence for #3020, not a claim to solve its full roster/interaction-attribution request. I have read the issue's existing discussion and contribution rules and am supplying the patch here for sign-off rather than opening an unapproved UI PR.

    Please advise on the supported owning-provider integration route and whether these native display fixes should be split into a separate issue/PR. No custom BB build or ordinary-chat provider switch has been deployed.

    Patch SHA-256: 6d537e41fc283a26e6c925d8dbbaed6600de8d1a3ef9110a322900e972adf41c.

    Proposed native display patch, eight files
    diff --git a/apps/app/src/components/thread/ThreadStatusGlyph.test.tsx b/apps/app/src/components/thread/ThreadStatusGlyph.test.tsx
    index 70bcab4..01d9db8 100644
    --- a/apps/app/src/components/thread/ThreadStatusGlyph.test.tsx
    +++ b/apps/app/src/components/thread/ThreadStatusGlyph.test.tsx
    @@ -21,8 +21,8 @@ describe("ThreadStatusGlyph", () => {
         ["queued-waiting", "Thread has a message waiting to send", "Clock"],
         ["working-draft", "Thread working with unsubmitted draft", "Edit"],
         ["workflow", "Workflow running", "Workflow"],
    -    ["background-agent", "Background agent running", "UserRoundPlus"],
    -    ["background-command", "Background command running", "Terminal"],
    +    ["background-agent", "Background agent running", "Loading"],
    +    ["background-command", "Background command running", "Loading"],
         ["plan-mode", "Plan mode active", "ListTodo"],
         ["goal", "Goal active", "Target"],
         ["runtime", "Thread working", "Loading"],
    @@ -47,7 +47,9 @@ describe("ThreadStatusGlyph", () => {
         rerender(<ThreadStatusGlyph indicator="runtime" />);
         const runtime = screen.getByLabelText("Thread working");
         expect(Array.from(runtime.classList)).toContain("animate-spin");
    -    expect(Array.from(runtime.classList)).toContain("motion-reduce:animate-none");
    +    expect(Array.from(runtime.classList)).toContain(
    +      "motion-reduce:animate-none",
    +    );
       });
     
       it("draws unread success as a dot and nothing for none", () => {
    @@ -62,6 +64,21 @@ describe("ThreadStatusGlyph", () => {
         expect(container.firstChild).toBeNull();
       });
     
    +  it.each(["background-agent", "background-command"] as const)(
    +    "keeps %s spinning after the model turn ends",
    +    (indicator) => {
    +      const { container } = render(<ThreadStatusGlyph indicator={indicator} />);
    +      expect(
    +        container.firstElementChild?.classList.contains("animate-spin"),
    +      ).toBe(true);
    +      expect(
    +        container.firstElementChild?.classList.contains(
    +          "motion-reduce:animate-none",
    +        ),
    +      ).toBe(true);
    +    },
    +  );
    +
       it("hides the idle draft glyph from assistive technology on request", () => {
         const { container } = render(
           <ThreadStatusGlyph indicator="draft" hideIdleDraftLabel />,
    @@ -75,9 +92,9 @@ describe("ThreadStatusGlyph", () => {
       it("draws the archive glyph for archived threads", () => {
         render(<ThreadStatusGlyph indicator="runtime" archived />);
     
    -    expect(screen.getByLabelText("Archived thread").getAttribute("data-icon")).toBe(
    -      "Archive",
    -    );
    +    expect(
    +      screen.getByLabelText("Archived thread").getAttribute("data-icon"),
    +    ).toBe("Archive");
       });
     
       it.each([
    diff --git a/apps/app/src/components/thread/ThreadStatusGlyph.tsx b/apps/app/src/components/thread/ThreadStatusGlyph.tsx
    index c68dbe8..832de65 100644
    --- a/apps/app/src/components/thread/ThreadStatusGlyph.tsx
    +++ b/apps/app/src/components/thread/ThreadStatusGlyph.tsx
    @@ -18,8 +18,6 @@ import {
     
     const WORKING_ACTIVITY_ICONS = {
       workflow: "Workflow",
    -  "background-agent": "UserRoundPlus",
    -  "background-command": "Terminal",
       "plan-mode": "ListTodo",
       goal: "Target",
     } satisfies Partial<Record<ThreadListIndicatorKind, IconName>>;
    @@ -184,8 +182,6 @@ export function ThreadStatusGlyph({
         case "working-draft":
           return <ThreadDraftIndicator isWorking size={size} />;
         case "workflow":
    -    case "background-agent":
    -    case "background-command":
         case "plan-mode":
         case "goal":
           return (
    @@ -199,6 +195,8 @@ export function ThreadStatusGlyph({
               aria-label={getThreadListIndicatorLabel(kind) ?? undefined}
             />
           );
    +    case "background-agent":
    +    case "background-command":
         case "runtime":
           return (
             <Icon
    diff --git a/apps/app/src/hooks/cache-owners/realtime-cache-registry.ts b/apps/app/src/hooks/cache-owners/realtime-cache-registry.ts
    index 33b45a6..cb419e0 100644
    --- a/apps/app/src/hooks/cache-owners/realtime-cache-registry.ts
    +++ b/apps/app/src/hooks/cache-owners/realtime-cache-registry.ts
    @@ -75,6 +75,8 @@ import {
       threadStorageLocationQueryKey,
       threadStoragePathsForThreadQueryKeyPrefix,
       threadTimelineQueryKeyPrefix,
    +  threadTimelineTurnSummaryDetailsQueryKeyPrefix,
    +  allThreadTimelineTurnSummaryDetailsQueryKeyPrefix,
     } from "../queries/query-keys";
     import { systemEnvironmentProvidersQueryKey } from "../queries/environment-provider-queries";
     import { schedulePluginFrontendReconcile } from "../../lib/plugin-frontend-lazy";
    @@ -356,6 +358,7 @@ export const REALTIME_THREAD_CHANGE_REGISTRY = {
           dirtyThreadDetailQueriesForBackgroundActivity,
           dirtyThreadSearchQueriesForCompletedTurn,
           dirtyThreadTimelineQueriesForAppendedEvents,
    +      dirtyThreadTimelineDetailsForBackgroundActivity,
           dirtyThreadTurnRequestQueries,
         ],
       },
    @@ -951,6 +954,35 @@ function dirtyThreadTimelineQueriesForAppendedEvents(
       }
     }
     
    +function dirtyThreadTimelineDetailsForBackgroundActivity({
    +  backgroundActivityChanged,
    +  eventTypes,
    +  queryClient,
    +  threadId,
    +}: ThreadRealtimeDirtyContext): void {
    +  if (
    +    eventTypes !== undefined &&
    +    !backgroundActivityChanged &&
    +    !eventTypes.some(
    +      (type) =>
    +        type === "item/backgroundTask/progress" ||
    +        type === "item/backgroundTask/completed" ||
    +        type === "item/delegation/progress" ||
    +        type === "item/delegation/completed",
    +    )
    +  ) {
    +    return;
    +  }
    +  invalidateQueryKeysWithoutCancelingActiveFetches({
    +    queryClient,
    +    queryKeys: [
    +      threadId === undefined
    +        ? allThreadTimelineTurnSummaryDetailsQueryKeyPrefix()
    +        : threadTimelineTurnSummaryDetailsQueryKeyPrefix(threadId),
    +    ],
    +  });
    +}
    +
     function dirtyThreadTurnRequestQueries({
       eventTypes,
       queryClient,
    diff --git a/apps/app/src/hooks/realtime-cache-effects.test.ts b/apps/app/src/hooks/realtime-cache-effects.test.ts
    index a0e9667..dd4c266 100644
    --- a/apps/app/src/hooks/realtime-cache-effects.test.ts
    +++ b/apps/app/src/hooks/realtime-cache-effects.test.ts
    @@ -2103,6 +2103,59 @@ describe("createRealtimeCacheEffects", () => {
         effects.dispose();
       });
     
    +  it.each([false, true])(
    +    "refreshes closed-turn disclosures after background progress with timeline push %s",
    +    (timelinePush) => {
    +      vi.useFakeTimers();
    +      const { effects, queryClient } = createRealtimeEffectsTestContext();
    +      queryClient.setQueryData(
    +        systemConfigQueryKey(),
    +        makeSystemConfig({
    +          experiments: { ...defaultExperiments, timelinePush },
    +        }),
    +      );
    +      const timelineKey = threadTimelineQueryKey("thr_1");
    +      queryClient.setQueryData(timelineKey, { rows: [], maxSeq: 20 });
    +      const observer = new QueryObserver(queryClient, {
    +        queryKey: timelineKey,
    +        queryFn: async () => ({ rows: [], maxSeq: 21 }),
    +        staleTime: Infinity,
    +      });
    +      const unsubscribe = observer.subscribe(() => {});
    +      const key = threadTimelineTurnSummaryDetailsQueryKey({
    +        itemId: null,
    +        threadId: "thr_1",
    +        turnId: "old-turn",
    +        sourceSeqStart: 1,
    +        sourceSeqEnd: 5,
    +      });
    +      const foreignKey = threadTimelineTurnSummaryDetailsQueryKey({
    +        itemId: null,
    +        threadId: "thr_other",
    +        turnId: "old-turn",
    +        sourceSeqStart: 1,
    +        sourceSeqEnd: 5,
    +      });
    +      queryClient.setQueryData(key, { rows: [] });
    +      queryClient.setQueryData(foreignKey, { rows: [] });
    +      effects.handleChanged({
    +        type: "changed",
    +        entity: "thread",
    +        id: "thr_1",
    +        metadata: {
    +          eventTypes: ["item/backgroundTask/progress"],
    +          timelineSequence: 21,
    +        },
    +        changes: ["events-appended"],
    +      });
    +      vi.advanceTimersByTime(50);
    +      expect(queryClient.getQueryState(key)?.isInvalidated).toBe(true);
    +      expect(queryClient.getQueryState(foreignKey)?.isInvalidated).toBe(false);
    +      unsubscribe();
    +      effects.dispose();
    +    },
    +  );
    +
       it("does not cancel active timeline refetches for repeated event invalidations", async () => {
         vi.useFakeTimers();
         const { effects, queryClient } = createRealtimeEffectsTestContext();
    diff --git a/packages/thread-view/src/background-task-projection.ts b/packages/thread-view/src/background-task-projection.ts
    index e66383c..0f51c6a 100644
    --- a/packages/thread-view/src/background-task-projection.ts
    +++ b/packages/thread-view/src/background-task-projection.ts
    @@ -55,6 +55,9 @@ function applyBackgroundTaskItem(
       message.usage = item.usage ?? null;
       message.summary = item.summary ?? null;
       message.error = item.error ?? null;
    +  if (item.presentation !== undefined) {
    +    message.presentation = item.presentation;
    +  }
       if (lifecycle.kind === "end" && message.completedAt === null) {
         message.completedAt = meta.createdAt;
       }
    diff --git a/packages/thread-view/src/timeline-row-title.ts b/packages/thread-view/src/timeline-row-title.ts
    index ae44fc6..ae4d23a 100644
    --- a/packages/thread-view/src/timeline-row-title.ts
    +++ b/packages/thread-view/src/timeline-row-title.ts
    @@ -396,6 +396,7 @@ interface PresentedTitleArgs {
       content?: string | null;
       plainContent?: string;
       em?: boolean;
    +  shimmer?: boolean;
     }
     
     function presentedTitle({
    @@ -406,11 +407,12 @@ function presentedTitle({
       content,
       plainContent,
       em = true,
    +  shimmer = status === "pending",
     }: PresentedTitleArgs): TimelineTitle {
       const resolvedContent = content === undefined ? presentation.title : content;
       const segments: TimelineTitleSegment[] = [
         segment(presentationLabel(presentation, status), {
    -      shimmer: status === "pending",
    +      shimmer,
           truncate: resolvedContent ? false : true,
         }),
       ];
    @@ -1053,6 +1055,34 @@ function mapBackgroundAgentTitle(
     }
     
     function mapWorkflowTitle(row: TimelineViewWorkflowWorkRow): TimelineTitle {
    +  if (row.presentation) {
    +    return presentedTitle({
    +      presentation: row.presentation,
    +      status: row.status,
    +      startedAt: row.startedAt,
    +      completedAt: row.completedAt,
    +      shimmer: row.status === "pending" && row.taskStatus !== "paused",
    +    });
    +  }
    +  if (row.status === "pending" && row.taskStatus === "paused") {
    +    const label = isBackgroundCommandTaskType(row.taskType)
    +      ? "Background command paused:"
    +      : isBackgroundAgentTaskType(row.taskType)
    +        ? "Background agent paused:"
    +        : "Workflow paused:";
    +    return makeTitle({
    +      segments: [
    +        segment(label),
    +        segment(row.workflowName ?? row.description, {
    +          em: true,
    +          truncate: true,
    +        }),
    +      ],
    +      decorations: filterNull([
    +        durationDecoration(row.startedAt, row.completedAt),
    +      ]),
    +    });
    +  }
       if (isBackgroundCommandTaskType(row.taskType)) {
         return mapBackgroundCommandTitle(row);
       }
    diff --git a/packages/thread-view/test/background-task-timeline.test.ts b/packages/thread-view/test/background-task-timeline.test.ts
    index 68aa05c..5dedbe9 100644
    --- a/packages/thread-view/test/background-task-timeline.test.ts
    +++ b/packages/thread-view/test/background-task-timeline.test.ts
    @@ -758,10 +758,9 @@ describe("background task timeline projection", () => {
           },
           2,
         );
    -    const whileForeground = buildTimeline(
    -      [turnStarted("turn-1", 1), started],
    -      { includeNestedRows: false },
    -    );
    +    const whileForeground = buildTimeline([turnStarted("turn-1", 1), started], {
    +      includeNestedRows: false,
    +    });
         expect(whileForeground.activeBackgroundCommands).toEqual([]);
     
         const afterBackgrounding = buildTimeline(
    @@ -1198,4 +1197,57 @@ describe("background task timeline projection", () => {
         expect(findWorkflowRows(timeline.rows)).toHaveLength(0);
         expect(timeline.activeWorkflows).toHaveLength(0);
       });
    +
    +  it("updates presentation after late recovery without moving the work item", () => {
    +    const item = bashTaskItem({ status: "pending", taskStatus: "paused" });
    +    const presentation = {
    +      icon: { glyph: "terminal" },
    +      title: "Task",
    +      label: { pending: "Running process", completed: "Finished" },
    +    };
    +    const rows = buildTimelineRows([
    +      turnStarted("turn-1", 1),
    +      withMeta(
    +        {
    +          type: "item/started",
    +          threadId: "thread-1",
    +          providerThreadId: "provider-1",
    +          scope: turnScope("turn-1"),
    +          item: {
    +            ...item,
    +            presentation: {
    +              ...presentation,
    +              label: { ...presentation.label, pending: "Status unknown" },
    +            },
    +          },
    +        },
    +        2,
    +      ),
    +      turnCompleted("turn-1", 3),
    +      turnStarted("turn-2", 4),
    +      turnCompleted("turn-2", 5),
    +      withMeta(
    +        {
    +          type: "item/backgroundTask/progress",
    +          threadId: "thread-1",
    +          providerThreadId: "provider-1",
    +          scope: threadScope(),
    +          item: {
    +            ...item,
    +            taskStatus: "running",
    +            presentation,
    +          },
    +        },
    +        6,
    +      ),
    +    ]);
    +    expect(findWorkflowRows(rows)).toEqual([
    +      expect.objectContaining({
    +        sourceSeqStart: 2,
    +        sourceSeqEnd: 2,
    +        taskStatus: "running",
    +        presentation,
    +      }),
    +    ]);
    +  });
     });
    diff --git a/packages/thread-view/test/background-task-title.test.ts b/packages/thread-view/test/background-task-title.test.ts
    new file mode 100644
    index 0000000..f63e70b
    --- /dev/null
    +++ b/packages/thread-view/test/background-task-title.test.ts
    @@ -0,0 +1,74 @@
    +import { describe, expect, it } from "vitest";
    +import type { TimelineWorkflowWorkRow } from "@bb/server-contract";
    +import { buildTimelineRowTitle } from "../src/index.js";
    +
    +function row(taskType: string): TimelineWorkflowWorkRow {
    +  return {
    +    kind: "work",
    +    workKind: "workflow",
    +    id: "activity",
    +    itemId: "activity",
    +    threadId: "thread",
    +    turnId: "original",
    +    sourceSeqStart: 2,
    +    sourceSeqEnd: 2,
    +    createdAt: 1,
    +    startedAt: 1,
    +    completedAt: null,
    +    status: "pending",
    +    taskType,
    +    taskStatus: "paused",
    +    description: "Fixture task",
    +    workflowName: null,
    +    model: null,
    +    workflow: null,
    +    usage: null,
    +    summary: null,
    +    error: "Tracking unavailable",
    +  };
    +}
    +
    +describe("background task tracking titles", () => {
    +  it.each(["local_bash", "local_agent", "local_workflow"])(
    +    "does not describe a paused %s as running",
    +    (taskType) => {
    +      const title = buildTimelineRowTitle(row(taskType), {
    +        summaryStyle: "bundle",
    +        workStyle: "default",
    +      });
    +      expect(title.plain).toMatch(/paused/i);
    +      expect(title.plain).not.toMatch(/running/i);
    +      expect(title.segments.some((segment) => segment.shimmer)).toBe(false);
    +    },
    +  );
    +
    +  it("shows the provider's unknown warning and recovers to its running label", () => {
    +    const activity = {
    +      ...row("local_bash"),
    +      presentation: {
    +        icon: { glyph: "triangle-alert" },
    +        title: "Fixture task",
    +        label: { pending: "Status unknown", completed: "Finished" },
    +      },
    +    } satisfies TimelineWorkflowWorkRow;
    +    const title = buildTimelineRowTitle(activity, {
    +      summaryStyle: "bundle",
    +      workStyle: "default",
    +    });
    +    expect(title.plain).toContain("Status unknown");
    +    expect(title.plain).not.toContain("Running");
    +    expect(title.segments.some((segment) => segment.shimmer)).toBe(false);
    +    const recovered = buildTimelineRowTitle(
    +      {
    +        ...activity,
    +        taskStatus: "running",
    +        presentation: {
    +          ...activity.presentation,
    +          label: { pending: "Running process", completed: "Finished" },
    +        },
    +      },
    +      { summaryStyle: "bundle", workStyle: "default" },
    +    );
    +    expect(recovered.plain).toContain("Running process");
    +  });
    +});

    AGENT GENERATED

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

    provider-acpprovidersthreads

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions