Make composer background-task rows clickable - #2402
Open
technicalpickles wants to merge 1 commit into
Open
Conversation
Rows in ThreadBackgroundCommandsCard were plain divs with no onClick, unlike the main timeline's expandable delegation rows. Clicking a row now scrolls to and flashes the corresponding row in the main timeline if it's already rendered there (reusing the search-jump convention from useScrollToSearchedMessage), or opens a detail drawer with the row's own data otherwise -- the common case, since a background task's row only stays in the main timeline while its spawning turn is still pending; once that turn completes and gets summarized, the row survives only in the activeBackgroundCommands/activeWorkflows projection this card reads from. Extracted the shared scroll/flash DOM helpers into timelineRowNavigation.ts so both the search-jump hook and this card use the same selector and flash-class logic instead of duplicating it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EDNPjAxzyMPgPZx4ATgUsQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The composer's "Running background agent/command" status card rows had no click handler, unlike the main timeline's expandable delegation rows, so there was no way to jump to a background task's context from the card.
What changed
ThreadBackgroundCommandsCard.tsx: every row (the single non-expandable summary row and each row in the expanded list) is now a real button. On click, it scrolls to and flashes the row in the main timeline if it's already rendered there, or opens a bottom drawer with the row's own data otherwise.activeBackgroundCommands/activeWorkflowsprojection this card reads from, so there's nothing to scroll to.commandson every render (falling back to the last known data once the row drops out of that list), so it reflects live task progress instead of freezing to whatever the row looked like at click time.useScrollToSearchedMessage.tsinto a newtimelineRowNavigation.tsso both features use the same selector and flash-class logic instead of duplicating it.timelineRowIdback-reference field toTimelineWorkflowWorkRow, on the assumption the row carried no id back to its main-timeline counterpart. That assumption doesn't hold:row.idis already built via the samebuildWorkflowWorkRowhelper used for the row that eventually appears in the main timeline, so it's already the right id to look up. No schema change was needed.How you verified
ThreadBackgroundCommandsCard.test.tsxcover both click paths (scroll+flash when rendered, drawer fallback when not), targeting the clicked row's own id when multiple rows are expanded, the header toggle staying navigation-free, and the drawer staying in sync with live row updates (including when the row disappears fromcommandsentirely) instead of freezing to a stale snapshot.pnpm exec turbo run test --filter=@bb/appandpnpm exec turbo run typecheck --filter=@bb/app.mainfirst: spawned a real background task on aclaude-codethread and confirmed the card row did nothing on click, and that no[data-timeline-row-id]element existed for it while it was running.claude-codeprovider, a backgrounded shell command's completion never projects into aworkKind: "workflow"row in the main timeline at all (running or completed) -- it falls into a generic "Unhandled Claude Code event" operation row instead. That's #2224 (background_tasks_changedhitsassertNever), a pre-existing gap this PR doesn't touch; I added the UI-side evidence there. The scroll path itself is still covered at the unit level, using the samedata-timeline-row-idselector the app uses in production.Fixes #2315