fix(web): keep the Working shimmer lit while background tasks run - #4906
Open
daniellok-db wants to merge 1 commit into
Open
fix(web): keep the Working shimmer lit while background tasks run#4906daniellok-db wants to merge 1 commit into
daniellok-db wants to merge 1 commit into
Conversation
The background-tasks pill (#4893) introduced a shared `isBackgroundTasksOnly` predicate that gated all three busy surfaces off `bgCount > 0` alone, without checking whether the agent's turn was still active. So any live turn that coincided with a background task — notably `waiting`, where the parent is parked on its async-work drain of sub-agents / background shells — had its "Working…" shimmer suppressed and replaced by the pill, misreading an active turn as finished. Make the shimmer and the pill independent surfaces: - `isBackgroundTasksOnly` now also requires the turn to be inactive (`!agentWorking`), so the shimmer yields only once the turn has genuinely ended (`idle`) with tasks lingering. - `BackgroundTaskPill` shows on `bgCount > 0` alone, decoupled from the shimmer, so both appear together while the turn is active. - `workingIndicatorLabel` no longer emits the background count (the pill owns it); the shimmer just rotates its working messages or shows "Blocked on: …". Co-authored-by: Isaac
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.
Related issue
Regression from #4893 (background-tasks composer pill). No separate issue was
filed — surfaced during manual use.
Closes #
Summary
isBackgroundTasksOnlypredicate that gated all threebusy surfaces (inline "Working…" shimmer, pinned tab shimmer, background-task
pill) off
bgCount > 0alone — without checking whether the agent's turn wasstill active. So a live turn that coincided with a background task had its
shimmer suppressed and shown as the pill only, misreading an active turn as
finished.
waitingstatus is exactly this case: the parent is parked on itsasync-work drain (sub-agents / background shells) with
bgCount > 0, yet theturn is still live.
tracks the live turn, the pill tracks the task count, and both can show at once.
ELI5: "Working…" means the agent is busy; the pill counts background tasks.
They answer different questions, so they shouldn't hide each other. Previously
having a background task switched off "Working…" even while the agent was still
going.
Behavior
running/waiting), with background taskidle), task lingersImplementation:
isBackgroundTasksOnly(bgCount, blockedOn, agentWorking)now also requires!agentWorking(running/waitingor a local send in flight), so the shimmeryields only once the turn has genuinely ended.
BackgroundTaskPillshows onbgCount > 0alone, decoupled from the shimmer.workingIndicatorLabelno longer emits the background count (the pill owns it).Test Plan
pnpm exec vitest run src/pages/ChatPage.test.ts— 169 pass (updatedisBackgroundTasksOnly/workingIndicatorLabelcases for the new signaturesand the coexistence behavior).
pnpm exec tsc -b,pnpm exec oxlint,pnpm exec prettier --check— clean.test_working_shimmer_and_pill_coexist_while_waiting: awaitingedge with
background_task_count=2asserts both the working indicator and thepill render.
waitingturn with a lingering background shell and confirmedshimmer + pill show together, then dropped to pill-only once the turn settled
to
idle.Demo
Before: a background task suppressed the "Working…" shimmer (pill only, even
mid-turn). After: see the behavior table above — both surfaces coexist while the
turn is active.
Type of change
Test coverage
Coverage notes
Unit tests cover the two pure helpers (
isBackgroundTasksOnly,workingIndicatorLabel); an E2E test covers thewaitingcoexistence path viathe Sessions events route. Manual verification: confirmed shimmer + pill render
together during a live
waitingturn and that it collapses to pill-only once theturn settles to
idle.Changelog
The "Working…" indicator now stays visible while background tasks run, alongside the background-tasks pill
This pull request and its description were written by Isaac.