Skip to content

fix(web): keep the Working shimmer lit while background tasks run - #4906

Open
daniellok-db wants to merge 1 commit into
mainfrom
fix/working-shimmer-with-background-tasks
Open

fix(web): keep the Working shimmer lit while background tasks run#4906
daniellok-db wants to merge 1 commit into
mainfrom
fix/working-shimmer-with-background-tasks

Conversation

@daniellok-db

@daniellok-db daniellok-db commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Related issue

Regression from #4893 (background-tasks composer pill). No separate issue was
filed — surfaced during manual use.

Closes #

Summary

  • feat(web): show background tasks as a composer pill, not the working shimmer #4893 added a shared isBackgroundTasksOnly predicate that gated all three
    busy surfaces (inline "Working…" shimmer, pinned tab shimmer, background-task
    pill) off bgCount > 0 alone — without checking whether the agent's turn was
    still 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.
  • The waiting status is exactly this case: the parent is parked on its
    async-work drain (sub-agents / background shells) with bgCount > 0, yet the
    turn is still live.
  • This makes the shimmer and the pill independent surfaces: the shimmer
    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

State Shimmer Pill
Working, no background tasks
Working (running/waiting), with background task (fixed)
Turn ended (idle), task lingers ✅ (unchanged)
Blocked on a dialog ✅ "Blocked on: …" ✅ if tasks

Implementation:

  • isBackgroundTasksOnly(bgCount, blockedOn, agentWorking) now also requires
    !agentWorking (running/waiting or a local send in flight), so the shimmer
    yields only once the turn has genuinely ended.
  • BackgroundTaskPill shows on bgCount > 0 alone, decoupled from the shimmer.
  • workingIndicatorLabel no longer emits the background count (the pill owns it).

Test Plan

  • pnpm exec vitest run src/pages/ChatPage.test.ts — 169 pass (updated
    isBackgroundTasksOnly / workingIndicatorLabel cases for the new signatures
    and the coexistence behavior).
  • pnpm exec tsc -b, pnpm exec oxlint, pnpm exec prettier --check — clean.
  • Added E2E test_working_shimmer_and_pill_coexist_while_waiting: a waiting
    edge with background_task_count=2 asserts both the working indicator and the
    pill render.
  • Manual: drove a waiting turn with a lingering background shell and confirmed
    shimmer + 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

  • Bug fix
  • Feature
  • UI / frontend change
  • Refactor / chore
  • Docs
  • Test / CI
  • Breaking change

Test coverage

  • Unit tests added / updated
  • Integration tests added / updated
  • E2E tests added / updated
  • Manual verification completed
  • Existing tests cover this change
  • Not applicable

Coverage notes

Unit tests cover the two pure helpers (isBackgroundTasksOnly,
workingIndicatorLabel); an E2E test covers the waiting coexistence path via
the Sessions events route. Manual verification: confirmed shimmer + pill render
together during a live waiting turn and that it collapses to pill-only once the
turn 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.

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
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