Skip to content

fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads - #6198

Merged
wesbillman merged 3 commits into
mainfrom
brain/observer-append-fastpath
Aug 18, 2026
Merged

fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads#6198
wesbillman merged 3 commits into
mainfrom
brain/observer-append-fastpath

Conversation

@wesbillman

@wesbillman wesbillman commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Live 0.5.16 review (Royal Court thread) traced the sustained 20–25% WebContent CPU burn in any large mounted channel with a working agent to three defects, in descending impact:

  1. Shimmer animation forces per-frame style + compositing walks. .buzz-shimmer animated background-position under -webkit-background-clip: text, which WebKit cannot run on the compositor: every frame did a full document style resolve plus a recursive compositing-hierarchy update over the timeline's layer tree. The highlight now lives on an aria-hidden overlay child duplicating the label text and animates opacity only (compositor-accelerated); a real element is used instead of ::after generated content so screen readers never see the duplicate text. Visual: the moving sweep becomes a gentle pulse. prefers-reduced-motion removes the overlay entirely — static muted label, exactly as before.
  2. Observer journal whole-journal dedup + re-sort per append. Every one-per-second observer frame rebuilt a dedup Set over up to 3000 retained events and re-sorted the whole journal with a Date.parse-per-comparison comparator. In-order batches (the ordinary live path, same condition as the existing incremental transcript fold) now dedup within the batch and concat; out-of-order/replayed arrivals keep the full path.
  3. Redundant disk reads in the 5s agent-list poll. build_managed_agent_summary re-read the global config from disk per call despite receiving it as a parameter, and re-read the teams store per tracked pair — 2N redundant reads per poll tick for N agents. Both are now caller-supplied; one-shot command paths use a summarize_from_disk helper. Same stores, same unwrap_or_default failure posture, read once.

Evidence (mechanism attribution, live 0.5.16-block, mounted ~1500-event channel)

  • True-idle mounted view (working-state UI live): 25.08% mean / 24.15% median WebContent CPU; post working-state decay: 6.33% / 3.50%.
  • Reduce Motion A/B during a live agent turn (isolates the shimmer, working UI still mounted): 19.50% mean → 5.39% mean (72% collapse). Native 10s samples: Document::resolveStyle 379 samples → 1; updateCompositingLayersAfterStyleChange 378 → 0; recursive updateBackingAndHierarchy 363 → 6.
  • The shimmer mechanism predates 0.5.16 (CSS unchanged since Polish composer activity layout and transitions #3151); current multi-agent workloads exposed and amplified it. The mention regression itself was fixed separately in fix(desktop): restore release agent mentions #6182.

Testing

  • desktop observer store suites: 55/55 pass, including 5 new tests pinning the fast-path invariants (equal-timestamp seq ordering, duplicate-batch redelivery, intra-batch duplicates, overlapping late arrival takes the slow path, transcript-equals-replay on both paths).
  • cargo test --lib managed_agents (1016 passed) and --lib commands (727 passed); cargo clippy clean; pnpm typecheck + biome clean.
  • Release gate for the patched build (per Mongo): active-turn mounted CPU must collapse from the ~21–25% baseline with no per-frame style/compositing walk in a native sample — measured on Wes's workspace once a build with this branch is running.

Findings and raw samples: RESEARCH/LIVE_0_5_16_WEBKIT_ATTRIBUTION_2026_08_18.md, RESEARCH/RENDERER_STEADY_STATE_LOOP_AUDIT_2026_08_18.md, .scratch/live-app-review/ (Carl/Donut/Mongo/Brain, Royal Court thread 01a7fe75).


Opened by Brain (agent) via @wesbillman's account on his behalf — coordinated in Buzz channel agent-mention-policy-royal-court, thread 01a7fe75.

@wesbillman
wesbillman requested a review from a team as a code owner August 18, 2026 08:06
wesbillman and others added 3 commits August 18, 2026 02:15
…iting walks

The working-agents/typing shimmer animated background-position under
-webkit-background-clip: text. WebKit cannot composite that property, so
every animation frame ran a full document style resolve and a recursive
compositing-hierarchy update over the mounted timeline's layer tree —
~20% sustained WebContent CPU at rest in any large channel with a
working agent (native samples: resolveStyle 379 samples/10s with the
animation running vs 1 with it disabled; CPU 19.5% -> 5.4% mean in a
Reduce Motion A/B on the same mounted view during a live agent turn).

Move the highlight to an aria-hidden overlay child duplicating the label
text and animate only its opacity, which runs on the compositor. A real
element is used instead of ::after generated content so screen readers
never see the duplicate text (pseudo-element text exposure is
inconsistent and cannot be aria-hidden). The sweep becomes a gentle
pulse; prefers-reduced-motion hides the overlay entirely, leaving the
static muted label exactly as before.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@buzz.block.builderlab.xyz>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
…rver appends

Every observer append rebuilt a dedup Set over the entire retained
journal (up to 3000 events) and re-sorted the whole array with a
comparator that Date.parses both sides — once per second per streaming
agent, scaling with journal size rather than batch size.

The ordinary live path appends a batch that lands strictly after the
retained tail (the same condition the incremental transcript fold
already checks). In that case a retained-window collision is impossible,
so dedup only needs to look inside the batch and the merge is a plain
concat. Out-of-order or replayed arrivals keep the full dedup + re-sort
path, and the fast-path check reuses isObserverEventAfter so ordering
cannot drift from compareObserverEvents.

New tests pin the invariants that authorize the skip: equal-timestamp
seq ordering, duplicate-batch redelivery, intra-batch duplicates,
overlapping late arrivals (slow path), and transcript-equals-replay on
both paths.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@buzz.block.builderlab.xyz>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
…aries

build_managed_agent_summary re-loaded the global agent config from disk
on every call despite already receiving it as a parameter (a leftover
from before the parameter existed), and re-loaded the teams store per
tracked pair. With the frontend polling the agent list every 5 seconds
while any agent runs, a 13-agent workspace paid 26 redundant disk reads
per tick.

Make the passed-in global_config authoritative, hoist the teams read to
the same caller-supplied parameter, and give one-shot command paths a
summarize_from_disk helper so the list poll loads each store exactly
once per call. Summary semantics and failure behavior are unchanged:
every load keeps its unwrap_or_default posture, and the same stores are
read — once.

Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@buzz.block.builderlab.xyz>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman
wesbillman force-pushed the brain/observer-append-fastpath branch from faf85fa to 8e0fec0 Compare August 18, 2026 08:17
@wesbillman
wesbillman merged commit f0234f1 into main Aug 18, 2026
24 checks passed
@wesbillman
wesbillman deleted the brain/observer-append-fastpath branch August 18, 2026 12:47
wpfleger96 pushed a commit that referenced this pull request Aug 18, 2026
…ed-agent-store

* origin/main:
  fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads (#6198)

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>

# Conflicts:
#	desktop/src-tauri/src/commands/agents.rs
wpfleger96 pushed a commit that referenced this pull request Aug 18, 2026
…arer-auth

* origin/main: (21 commits)
  fix(desktop): bind presence retry timers (#6213)
  ci: make file-size policy a first-class gate (#6187)
  fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads (#6198)
  chore(release): release Buzz Desktop version 0.5.16 (#6191)
  fix(desktop): restore release agent mentions (#6182)
  test(desktop): cover exact workflow batch limit (#6168)
  chore(release): release Buzz Desktop version 0.5.15 (#6173)
  Preserve managed agent mentions during relay errors (#6167)
  fix(workflows): preserve multi-channel listing semantics (#6009)
  Remove Startup Recovery section in base prompt (#6161)
  fix(desktop): align preview sidebar row styling (#6163)
  fix(desktop): repair dropped team membership links at boot and on edit (#5904)
  fix(cli): keep project replacement timestamps at or after wall clock (#5666)
  Remove GitHub security advisory commitment (#6144)
  Rename Bumble agent to Pollen (#5864)
  fix(desktop): resolve agent profiles through one archive-aware selector (#5706)
  fix(acp): gate relay-signed workflow messages on their attributed author (#6129)
  fix(acp): replace Goose native system prompt (#5964)
  feat(workflows): add responsive library card actions (#6008)
  fix(desktop): enforce shared agent access across devices (#6086)
  ...

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>

# Conflicts:
#	CHANGELOG.md
tlongwell-block pushed a commit that referenced this pull request Aug 18, 2026
Co-authored-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz>
Signed-off-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz>

* origin/main:
  fix(desktop): bind presence retry timers (#6213)
  ci: make file-size policy a first-class gate (#6187)
  fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads (#6198)
  chore(release): release Buzz Desktop version 0.5.16 (#6191)
  fix(desktop): restore release agent mentions (#6182)
  test(desktop): cover exact workflow batch limit (#6168)
  chore(release): release Buzz Desktop version 0.5.15 (#6173)
  Preserve managed agent mentions during relay errors (#6167)
  fix(workflows): preserve multi-channel listing semantics (#6009)
  Remove Startup Recovery section in base prompt (#6161)
  fix(desktop): align preview sidebar row styling (#6163)
  fix(desktop): repair dropped team membership links at boot and on edit (#5904)

Signed-off-by: Wren <5217c5c2f7bfb4333e46d17c98a9255a52dadee18dcd43a43536b95e6776dfa0@buzz.block.builderlab.xyz>
bhargavms pushed a commit to EWA-Services/buzz that referenced this pull request Aug 18, 2026
…er, observer append fast path, poll-tick disk reads (block#6198)

## Summary

Live 0.5.16 review (Royal Court thread) traced the sustained 20–25%
WebContent CPU burn in any large mounted channel with a working agent to
three defects, in descending impact:

1. **Shimmer animation forces per-frame style + compositing walks.**
`.buzz-shimmer` animated `background-position` under
`-webkit-background-clip: text`, which WebKit cannot run on the
compositor: every frame did a full document style resolve plus a
recursive compositing-hierarchy update over the timeline's layer tree.
The highlight now lives on an `aria-hidden` overlay child duplicating
the label text and animates **opacity only** (compositor-accelerated); a
real element is used instead of `::after` generated content so screen
readers never see the duplicate text. Visual: the moving sweep becomes a
gentle pulse. `prefers-reduced-motion` removes the overlay entirely —
static muted label, exactly as before.
2. **Observer journal whole-journal dedup + re-sort per append.** Every
one-per-second observer frame rebuilt a dedup Set over up to 3000
retained events and re-sorted the whole journal with a
`Date.parse`-per-comparison comparator. In-order batches (the ordinary
live path, same condition as the existing incremental transcript fold)
now dedup within the batch and concat; out-of-order/replayed arrivals
keep the full path.
3. **Redundant disk reads in the 5s agent-list poll.**
`build_managed_agent_summary` re-read the global config from disk per
call despite receiving it as a parameter, and re-read the teams store
per tracked pair — 2N redundant reads per poll tick for N agents. Both
are now caller-supplied; one-shot command paths use a
`summarize_from_disk` helper. Same stores, same `unwrap_or_default`
failure posture, read once.

## Evidence (mechanism attribution, live 0.5.16-block, mounted
~1500-event channel)

- True-idle mounted view (working-state UI live): **25.08% mean / 24.15%
median** WebContent CPU; post working-state decay: **6.33% / 3.50%**.
- Reduce Motion A/B during a live agent turn (isolates the shimmer,
working UI still mounted): **19.50% mean → 5.39% mean** (72% collapse).
Native 10s samples: `Document::resolveStyle` 379 samples → 1;
`updateCompositingLayersAfterStyleChange` 378 → 0; recursive
`updateBackingAndHierarchy` 363 → 6.
- The shimmer mechanism predates 0.5.16 (CSS unchanged since block#3151);
current multi-agent workloads exposed and amplified it. The mention
regression itself was fixed separately in block#6182.

## Testing

- `desktop` observer store suites: 55/55 pass, including 5 new tests
pinning the fast-path invariants (equal-timestamp seq ordering,
duplicate-batch redelivery, intra-batch duplicates, overlapping late
arrival takes the slow path, transcript-equals-replay on both paths).
- `cargo test --lib managed_agents` (1016 passed) and `--lib commands`
(727 passed); `cargo clippy` clean; `pnpm typecheck` + biome clean.
- Release gate for the patched build (per Mongo): active-turn mounted
CPU must collapse from the ~21–25% baseline with no per-frame
style/compositing walk in a native sample — measured on Wes's workspace
once a build with this branch is running.

Findings and raw samples:
`RESEARCH/LIVE_0_5_16_WEBKIT_ATTRIBUTION_2026_08_18.md`,
`RESEARCH/RENDERER_STEADY_STATE_LOOP_AUDIT_2026_08_18.md`,
`.scratch/live-app-review/` (Carl/Donut/Mongo/Brain, Royal Court thread
01a7fe75).

---
*Opened by Brain (agent) via @wesbillman's account on his behalf —
coordinated in Buzz channel agent-mention-policy-royal-court, thread
01a7fe75.*

---------

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@buzz.block.builderlab.xyz>
Signed-off-by: bhargavms <bhargav.m@ewa-services.com>
sandro-sq added a commit that referenced this pull request Aug 18, 2026
* origin/main: (78 commits)
  Polish mobile timeline navigation (#5874)
  chore(release): release Buzz Desktop version 0.5.17 (#6234)
  fix(prompt): simplify pickup follow-through (#6186)
  fix(mcp): scope todo usage (#6216)
  fix(desktop): bound remote agent mention authorization (#6224)
  fix: bump h2 for RUSTSEC-2026-0258 (#6222)
  fix(desktop): bind presence retry timers (#6213)
  ci: make file-size policy a first-class gate (#6187)
  fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads (#6198)
  chore(release): release Buzz Desktop version 0.5.16 (#6191)
  fix(desktop): restore release agent mentions (#6182)
  test(desktop): cover exact workflow batch limit (#6168)
  chore(release): release Buzz Desktop version 0.5.15 (#6173)
  Preserve managed agent mentions during relay errors (#6167)
  fix(workflows): preserve multi-channel listing semantics (#6009)
  Remove Startup Recovery section in base prompt (#6161)
  fix(desktop): align preview sidebar row styling (#6163)
  fix(desktop): repair dropped team membership links at boot and on edit (#5904)
  fix(cli): keep project replacement timestamps at or after wall clock (#5666)
  Remove GitHub security advisory commitment (#6144)
  ...

Signed-off-by: Alessandro Joabar <sandro@squareup.com>
wpfleger96 pushed a commit that referenced this pull request Aug 18, 2026
…c-agent-commit-identity

* origin/main:
  Polish mobile timeline navigation (#5874)
  chore(release): release Buzz Desktop version 0.5.17 (#6234)
  fix(prompt): simplify pickup follow-through (#6186)
  fix(mcp): scope todo usage (#6216)
  fix(desktop): bound remote agent mention authorization (#6224)
  fix: bump h2 for RUSTSEC-2026-0258 (#6222)
  fix(desktop): bind presence retry timers (#6213)
  ci: make file-size policy a first-class gate (#6187)
  fix(desktop): eliminate mounted-view CPU burn — compositor-safe shimmer, observer append fast path, poll-tick disk reads (#6198)
  chore(release): release Buzz Desktop version 0.5.16 (#6191)
  fix(desktop): restore release agent mentions (#6182)
  test(desktop): cover exact workflow batch limit (#6168)
  chore(release): release Buzz Desktop version 0.5.15 (#6173)

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
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