Repository navigation
Description
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment on this issue.
Written-by: FlyBot Lead
Claimed-by: FlyBot Lead
Claim-Id: 8a6573ab0e944d3faab65240df8c841d
Branch: dev/5-social-poll-visibility
Base: 9a48f5a
At: 2026-11-23T01:16:05Z
Implementation: FlyBot (ours) — PR follows within 24h. Do not pick up without a pickup-ok comment.
Written-by: FlyBot Lead
Bot: FlyBot Product
What is wrong
Three of the four client-side face-room timers in plugins/social/client.js never look at whether the tab is visible, so a hidden tab keeps calling the host at full rate — and with a connector token, each call is not free.
Live main 9a48f5aa4bd49c8cae0d80fb4da3a74d02af0f99, read today:
| # | site | timer | hidden check |
|---|---|---|---|
| ① | waiting | plugins/social/client.js:1514-1518 (timer :1516) |
setInterval(load, 2000), none |
| ② | FaceRoomOverview |
plugins/social/client.js:3124-3128 (timer :3126) |
setInterval(…, 3000), none |
| ③ | PausedChat |
plugins/social/client.js:3993-4002 (timer :3995) |
checks document.hidden, but no refill when the tab comes back |
| ④ | connecting (social/server) |
plugins/social/client.js:4113-4117 (timer :4115) |
setInterval(…, 2000), none |
Measured with probe817.mjs (stubs document.hidden, setInterval and visibilitychange, counts beats of the social/face-rooms call):
- waiting (2 s): hidden → 1 mount + 5 beats = 6 calls / 10 s; visible → 5 beats = 5 calls / 10 s;
visibilitychangelistener registered: false. FaceRoomOverview(3 s): hidden → 1 + 5; visible → 5; listener false — hidden and visible run at the same rate.
Extrapolated over 600 s: the 2 s timers ≈ 301 calls, the 3 s timer ≈ 201 calls, all while the tab is hidden.
Each of those calls is real work on the host: plugins/social/src/social.js:4729 awaits pollFaceRooms() when poll !== false, and plugins/social/src/face-rooms.js:928 issues one GET /v1/face-rooms plus one GET /v1/face-rooms/{id}?after= per room (carrying the connector token); they are only merged while a facePolling call is already in flight. The host's own armSocialPoll already polls every 4 s while a room is live, so the client timers are additive on top of it.
Expected behaviour
A timer that exists only to refresh what the person is looking at does not run while they cannot see it, and refreshes immediately once when they come back instead of waiting out the rest of the period:
- hidden: no periodic call;
- becoming visible: one immediate call, then the interval restarts from that moment (clear and rebuild, not just an
if (!document.hidden)guard, so the next call is a full period later, not a remainder of the hidden phase); - unmount: the
visibilitychangelistener is removed with the timer; - visible: the same cadence as today (2000 ms for ①, 3000 ms for ②).
Scope
plugins/social/client.js only — one shared helper (e.g. pollWhileVisible) used by ① and ②, about 20 lines, plus two tests and one sentence in docs/subsystems/social.md. ③ (missing refill on return, plugins/social/client.js:3993-4002) and ④ (:4113-4117) are follow-ups, not this issue; this issue does not touch the core client bundle, so it does not take that single lane.
Tier T2 (plugins/**), no UI face — no visible element changes, so the verdict should record 无 UI 面 rather than ask for screenshots.
Tests must be red first: with the helper removed, the hidden case observes periodic calls and the return case observes no immediate call; both go green with the helper. Assert on the call count per unit time, not on a golden log.
Deduplication
- GitHub issue search
visibilitychange hidden tab polling interval→ 0 results. poll while hidden face rooms background tab→ face rooms: the Hide from sidebar a person chose is wiped by the next poll #2482 (a chosen sidebar hide wiped by the next poll) and fix(social): one lagging poll after face-start still closes the face room #1612 (a lagging poll closing the room), both closed and both different faces.- No open issue covers the hidden-tab cadence of these four timers.
Activity
HugoXK commentedon Nov 23, 2026
Claim-Id:
8a6573ab0e944d3faab65240df8c841dBranch:
dev/5-social-poll-visibilityOwner: FlyBot Dev-5
Base: live
mainat pickup (9a48f5aa4bd49c8cae0d80fb4da3a74d02af0f99)Claimed by FlyBot (ours); implementation PR follows within 24h. Scope is the two timers ① and ② in
plugins/social/client.js; ③ and ④ are follow-ups and stay out of this PR.HugoXK commentedon Nov 23, 2026
Owner change:
FlyBot Dev-5→FlyBot Dev-3.Dev-5's model calls are failing with
MISSING_CREDENTIAL: CSI_API_KEY(an owner-only fix, not a repo issue), so this stays ours but moves to Dev-3 rather than waiting. Same claim (8a6573ab0e944d3faab65240df8c841d) and same branch (dev/5-social-poll-visibility; the name is kept so the claim record stays consistent). Base moves to livemain99cd358e95d69c7a11c3897f5967f87b4945dc3c(#3313and#3314merged after this was filed). Scope, behaviour and the two red-first cases are unchanged.HugoXK commentedon Nov 23, 2026
Release
Written-by: FlyBot Lead
Released: 8a6573ab0e944d3faab65240df8c841d
Reason: stood down
At: 2026-11-23T14:38:27Z