fix: don't force a full render on no-op agent state republish - #6
Draft
Castrozan wants to merge 1 commit into
Draft
fix: don't force a full render on no-op agent state republish#6Castrozan wants to merge 1 commit into
Castrozan wants to merge 1 commit into
Conversation
A visible, stable blocker republishes its unchanged AgentState every STABLE_VISIBLE_SIGNAL_REFRESH (~800ms). The AppEvent::StateChanged arm in the headless render loop returned an unconditional `true`, forcing needs_full_render and a full compute_view + ratatui draw + frame extraction every interval per blocked agent, only for prepare_frame to discard the resulting byte-identical frame. That is a fixed idle CPU/wakeup cost scaling with blocked-agent count (upstream herdrdev#726, herdrdev#1158). Return whether the state change actually alters the rendered surface (effective state, agent label, or toast) instead of always true. The state mutation and fallback_observed_at bookkeeping still run before the return, so delayed notifications are unaffected; every real transition still forces a render and the retained path remains the safety net. Adds a regression test asserting a no-op stable-blocker republish does not force a full render while the blocker stays displayed.
Castrozan
commented
Jul 12, 2026
OwnerAuthor
Upstream tracking. Relates to the open herdr discussion "Reduce the CPU load when agent is running": herdrdev#399, where the maintainer has already done render optimizations. This fix removes one redundant class: a stable agent republishing the same state forced a full-frame redraw, and it now renders only on a real visible change (agent state, label, or toast). Tangential, not a duplicate: herdrdev#1265 (client render cost while the app is hidden) is a different render-cost path. Holding this PR until a maintainer approves the contribution path per herdr CONTRIBUTING: a first-time contributor needs a maintainer /approve into APPROVED_CONTRIBUTORS before an upstream PR. |
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 freeto 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.
Draft preview of the upstream PR against ogulcancelik/herdr. Base
upstream-mastermirrors upstream master (4617456), so the diff is exactly the single fix commit.Summary
StateChangedhandler always returnedtrue, forcing a full render even when nothing visible changed. A stable agent republishing the same state (a blocked agent re-reporting Blocked) redrew the whole frame on every republish.Tests
stable_blocker_republish_does_not_force_full_render: entering Blocked forces a render; a no-op republish does not, and the blocker stays shown.cargo clippy --all-targets -- -D warnings