Skip to content

Show every background command's duration and fold them from the row you clicked - #6007

Closed
alexandre-vl wants to merge 3 commits into
get-bb:mainfrom
alexandre-vl:bb/background-commands-card-thr_mwgsr32qtd
Closed

alexandre-vl wants to merge 3 commits into
get-bb:mainfrom
alexandre-vl:bb/background-commands-card-thr_mwgsr32qtd

Conversation

@alexandre-vl

@alexandre-vl alexandre-vl commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

The background-commands card above the composer hid the two things people look at it for: how long the command has been running, and whether there are more commands. On main (b143a2286), apps/app/src/components/promptbox/banner/ThreadBackgroundCommandsCard.tsx renders the newest command with showDuration={false} (:241), and the unfolded list holds only the other commands (:193), so the newest command's duration never shows. When the card is narrower than 34 rem, the header becomes "Running 3 background commands", with no description at all. A count pill is the only mark that the card opens (:242). The chevron appears on hover only and is hidden on touch screens (packages/shared-ui/src/components/ui/prompt-stack-disclosure.tsx:105, [@media(hover:none)]:hidden). The prompt stack is anchored to the composer, so opening the card grows it upward: the header you clicked jumps 78 px, and the separate close row (#4890) lands under the pointer. Unfolded rows wrap mid-word (line-clamp-2 break-all, :296), giving "check run pro / gress". The open state (apps/app/src/views/thread-detail/ThreadDetailPromptArea.tsx:683) was never reset. After the commands dropped to one, the next second command opened the card already unfolded.

What changed

Before (main)After
Before: 'Running background command: Wait seven minutes…' and a 3 pill, no durationAfter: the newest command with its duration and a 3 chip with a chevron
Before, open: the header moved up, the two other commands below it, a chevron row to closeAfter, open: older commands above, oldest first; the newest row stays where it was
Before: clicking the header pushes it up; closing takes the chevron rowAfter: the clicked row stays put and folds the list back
Before, 390 px touch: 'Running 3 background commands' Before, 390 px touch, open: descriptions break mid-wordAfter, 390 px touch: the newest command, its duration and the chip After, 390 px touch, open: one line per command, truncated

A source dev instance with a Claude Code thread running three sleep 7200 background commands. Chromium at 2x: 1280×800, then a 390×844 touch viewport. Each GIF opens and closes the card once, with the pointer drawn in.

Dark theme After, dark, open
  • Every command is one row: icon, description, live duration and, for background agents, the model. The newest row always shows, with its own duration.
  • With two or more commands, the newest row is the toggle. A count chip with a chevron (3 ⌃) ends the row, visible without hover and on touch. The chip shows the total, as other banner badges do (Show total counts in banner badges #5457).
  • Older commands unfold above the newest, oldest first. The row you clicked stays where it was, and the same row folds them back. This card leaves Use one tap-to-open, chevron-row-to-close model for every composer banner #4890's model (header opens, a chevron row closes) because, in a bottom-anchored stack, that model moves the control you just used. The other banners keep the Use one tap-to-open, chevron-row-to-close model for every composer banner #4890 model.
  • A single command is a plain row, with no toggle and no chip.
  • Descriptions stay on one line and truncate. The full text is in the tooltip and the timeline, and for the newest command in the toggle's label. This replaces the mid-word wrapping.
  • The "Running background command:" prefix and the narrow-width summary are gone, along with their ResizeObserver. The icon marks the row as a command, which leaves room for the description and duration.
  • The open state belongs to the thread on screen. Switching threads folds the card, and so does dropping below two running commands. The card is keyed by thread, so nothing it keeps carries over to the next thread.
  • Older rows mount on the first open and are dropped once fewer than two commands run (Remove re-render amplifiers across slots, contexts, banners and the prompt area (C6-C13, D2, D4, E9, E11, E12, H8) #1898). Their durations tick only while unfolded, so a folded card runs one live duration (the newest row's) on the shared one-second ticker.
  • The list is revealed from its bottom edge, so the rows emerge from the toggle row upward, nearest first, 40 ms apart. prefers-reduced-motion turns the transitions off.
  • The toggle is a button with aria-expanded and aria-controls pointing at the list. Its label is "Background commands (3): ", plus "· Model haiku" for a background agent. The folded list is inert, and focus stays on the toggle.
  • Keyboard focus draws an inset ring. The global outline was clipped by the card's overflow, as it was on main.
  • DOM order follows the screen: the older rows, then the toggle. Reading order matches what you see.

Files:

  • apps/app/src/components/promptbox/banner/ThreadBackgroundCommandsCard.tsx: the card, rewritten.
  • apps/app/src/views/thread-detail/ThreadDetailPromptArea.tsx: the per-thread open state.
  • apps/app/src/components/promptbox/banner/ThreadBackgroundCommandsCard.test.tsx: tests for the new behavior.
  • apps/app/src/views/thread-detail/ThreadDetailPromptArea.test.tsx, apps/app/src/test/thread-detail-prompt-area-harness.tsx: the harness renders a stand-in card, so the prompt area's open state can be tested.
  • apps/app/src/components/promptbox/banner/AnimatedBody.test.tsx: the lazy-mount check now expects the newest row's ticker.
  • apps/app/src/components/promptbox/banner/ThreadBackgroundCommandsCard.stories.tsx: fixtures ordered newest first, bottom-anchored like the real stack.
  • No wire, SDK, CLI or setting change.

Follow-up: #6009 applies the same model to the active child threads card. It is stacked on this PR.

How you verified

  • pnpm exec turbo run typecheck lint test --filter=@bb/app: passes. 6241 tests pass (4 skipped) across 647 files, and lint reports 0 errors.

  • Four of the five new tests fail against main's card and prompt area and pass here: the newest command's duration while folded, unfolding above from the same row, the mixed-activity label, and folding again below two commands. The single-command test passes on both.

  • An independent review (a separate agent thread) found four problems:

    • hidden rows kept ticking;
    • the card kept state across threads;
    • the toggle's label dropped the agent model;
    • the clip revealed the oldest rows first.

    The second commit fixes them. It adds two tests and extends two others, and all four fail against the first commit (28cb77cc3).

  • Screenshots: a source dev instance (pnpm dev) with a fresh data directory, where a Claude Code thread (Haiku 5.5) started three sleep 7200 background commands. Chromium was driven through dev-browser, in light and dark. The GIFs come from a CDP screencast, rendered at 25 fps. The "After" GIF was recorded on the final commit, after the fixture had been restarted, so its newest command and durations differ from the stills.

  • Geometry, measured in Chromium:

    • On main, the header's top moves from 598 px to 520 px when the card opens.
    • Here, the toggle row's top moves from 614 px to 615 px at 1280×800; the 1 px comes from the composer's elastic height. It stays at 753 px on a 390×844 touch viewport.
  • Not checked: Safari/WebKit, the iOS app, a screen reader.

AGENT GENERATED

…ou clicked

Each background command is one row with its live duration. With two or
more, the newest row is the toggle: older commands open above it, oldest
first, and the same row folds them back, so it never moves under the
pointer in the bottom-anchored prompt stack. The expanded state is per
thread and folds back below two commands.
Older rows tick only while unfolded and are dropped once fewer than two
commands run. The card is keyed by thread and its open state resets on a
thread switch. The list reveals from its bottom edge, the toggle's label
keeps a background agent's model, and keyboard focus draws an inset ring
inside the card.
# Conflicts:
#	apps/app/src/components/promptbox/banner/AnimatedBody.test.tsx
#	apps/app/src/components/promptbox/banner/ThreadBackgroundCommandsCard.test.tsx
#	apps/app/src/components/promptbox/banner/ThreadBackgroundCommandsCard.tsx
#	apps/app/src/views/thread-detail/ThreadDetailPromptArea.test.tsx
@github-actions github-actions Bot closed this Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

This is an automated message. We have closed this pull request because it has been open for more than two weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant