Skip to content

tree: the reorganization notice keeps reading tree/reorg every 30 s in a hidden window #3371

Not planned

Description

@HugoXK

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: 91ee96833b8e433ea91551dc51c1de81
Branch: dev/5-tree-hidden-poll
Base: bab1fe9
At: 2026-11-24T09:40:30Z

Written-by: FlyBot Lead
Bot: FlyBot Dev-5

What is wrong

plugins/tree/client.js:470 arms the reorganization notice's host read as a bare setInterval(load, REFRESH_MS * 3) — 30 s, with no visibility check and no visibilitychange listener. load() is a tree/reorg call against the host (:463), so a Tree panel left open in a background window — a second window, a minimised app, a tab behind another — keeps asking the host for the reorganization report every 30 s for as long as it is mounted, and coming back to the window can show a report up to 30 s stale.

Every other panel in the product follows the page: plugins/timeline/client.js:70 declines to poll while visible() is false, and the social and workflow surfaces have the same rule (#3315, #3327, #3361). This is the tree surface's own poll and the last one that ignores it.

Expected behaviour

  • Hidden page: no interval is armed at all, so no tree/reorg read happens.
  • Visible again: the interval is cleared and re-armed before one read happens at once — not "wait for the next tick", and not "keep the old interval and also read", which would keep the phase from before the hidden stretch and put the next read early.
  • Visible: unchanged 30 s cadence (REFRESH_MS * 3), and the field-change subscription that reads on reorg is untouched.
  • Unmount: no interval and no listener left behind.

Red first

plugins/tree/test/hidden-poll.test.js (new, on this branch), with the fix not yet written — a hidden document, the notice mounted, then the armed timer fired:

not ok 14 - a hidden window does not read tree/reorg, and coming back reads it at once
  error: |-
    a hidden window does not read tree/reorg again
    2 !== 1
  expected: 1
  actual: 2
# tests 158
# pass 157
# fail 1

After the fix, the same command: # tests 158 / # pass 158 / # fail 0.

Scope

  • plugins/tree/client.js — one pollWhileVisible(fn, ms) helper and the two lines of the notice's effect that use it (+20/−2).
  • plugins/tree/test/hidden-poll.test.js — the case above, including the unmount assertion (no interval, no listener) (+120).
  • docs/subsystems/tree.md — one line on the client rules.
  • changelog.d/<this issue>.fixed.md.

No UI face: the change is when a read happens, not what the card draws, so no before/after screenshots. plugins/social/**, core/src/client/** and core/dev/bench-preflight.mjs untouched.

Tier and dedupe

T2 by .github/agent/risk-rules.json (plugins/**), so the PR needs a Verdict: PASS naming its exact tip.

Searched open and closed issues: tree/reorg poll (2 hits — #828 is the roster feed's one-read-per-tick fix, #3114 is an unrelated umbrella), reorg notice hidden (1 hit, the same umbrella). No issue names this timer.

Activity

  1. Birfy commented on Nov 25, 2026

    @Birfy
    Collaborator

    基于已退役布局关闭(关闭原因,非验收结论)

    • main 锚点:d8898cad(2026-11-25T12:20:16Z,2156 blobs)
    • 正文引用的定位路径在 main d8898cad 上不存在
    • Release FlyBot 0.3.0 with the OpenTeamily workspace #3377(FlyBot 0.3.0,2026-11-25T01:29Z)移除了 core/ plugins/ policy/ patches/ .github/agent/ .github/scripts/ workflows/test.yml
    • 结论:重构前血缘的条目,无法在当前 main 上复现或评审;如仍需该项能力,请在现行线上重开一条并写明当前路径
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions