Skip to content

perf(system): send Live Update steps at most every 1.5 s - #223

Merged
Tarquinen merged 2 commits into
devfrom
live-update-step-throttle
Nov 21, 2026
Merged

Tarquinen merged 2 commits into
devfrom
live-update-step-throttle

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

While an agent works, the session's Live Update was reposted for every new step. Android drops notification updates that come too fast, so an important one like Needs your input or Done could get lost.

Now step changes go out at most every 1.5 s, and the latest step wins. A start, rename, Needs your input, Done, Failed or end still goes at once. A held step also goes out when the app leaves the foreground. Android reports that about 0.7 s after the last activity pauses. Ports iOS #307 (464576fa).

Known limitation: with two windows each following its own run, the single notification already switches between the runs on every update (LiveSessionActivity treats a different run as a takeover). This PR doesn't change that.

Only the timing changes, so there's no media.

Verified

  • Ported iOS SessionActivityStepThrottleTests into SessionLiveActivityTests with the same test names. 3 of the 4 fail when the hold is turned off.
  • Full scripts/check.sh on the VM.
  • Emulator with session-lab and the session-live-activity experiment: a send posts the session-run notification, it settles to Done, and going Home doesn't crash.

While an agent worked, the session's ongoing notification was reposted for
every new step. Android drops an app's notification updates that come too
fast, so a later, important one (Needs your input, Done) could be lost.

SessionActivityStepThrottle now sits behind SessionLiveActivityClient.update:
a working run's step-only changes go out at most once per 1.5 s (the latest
wins). A start, rename, Needs your input, Done, Failed or end goes at once in
place of a held step, and a held step goes out when the app leaves the
foreground (ProcessLifecycleOwner pause). Ports iOS #307 (464576fa).

Verified: ported iOS SessionActivityStepThrottleTests into
SessionLiveActivityTests (3 of 4 fail with the hold disabled); full
scripts/check.sh on the VM; on an emulator with session-lab and the
session-live-activity experiment, a send posts the session-run notification,
it settles to Done, and going Home doesn't crash.
… flushes

Review follow-up. The throttle's shared instance is now a file-private lazy
behind SessionLiveActivityClient.Key, not a module-visible singleton. The KDoc
and parity row now say that ProcessLifecycleOwner reports leaving the
foreground about 0.7 s after the last activity pauses. The system parity Tests
table gets the SessionActivityStepThrottleTests row and the real total (118).

Verified: full scripts/check.sh on the VM.
@Tarquinen
Tarquinen merged commit e188bdd into dev Nov 21, 2026
2 checks passed
@Tarquinen
Tarquinen deleted the live-update-step-throttle branch November 21, 2026 00:59
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