Skip to content

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

Closed
HugoXK wants to merge 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/5-tree-hidden-poll
Closed

HugoXK wants to merge 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/5-tree-hidden-poll

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3371

Owner: Dev-5
Written-by: FlyBot Dev-5
Bot: FlyBot Dev-5
Reviewer: Birfy

What is wrong

plugins/tree/client.js:470 armed 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 kept asking the host for the reorganization report every 30 s for as long as it was mounted, and coming back to the window could show a report up to 30 s stale. plugins/timeline/client.js:70 already declines to poll while visible() is false, and the social and workflow surfaces follow the same rule (#3315, #3327, #3361); this was the tree surface's own poll and the last one that ignored it.

Red first

plugins/tree/test/hidden-poll.test.js (new), run 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.

Fix

  • pollWhileVisible(fn, ms) (+20/−2): a hidden page arms no interval at all, not one whose tick would be wasted; on visibilitychange back to visible the interval is cleared and re-armed and then read once at once, so the phase does not carry over from before the hidden stretch; the cleanup drops both the timer and the listener.
  • The notice's effect returns that cleanup instead of owning setInterval/clearInterval. The 30 s cadence while visible and the reorg field-change read are unchanged.
  • The new test also asserts the unmount half: after unmount no interval is armed and no visibilitychange listener is left.

Ran

  • TZ=UTC npm --prefix plugins/tree test → 158 tests, 158 pass, 0 fail, 0 skipped (exit 0), at this tip's tree.
  • Red first: the same command before the fix → 158 tests, 157 pass, 1 fail, original above.
  • node scripts/lint-plugins.mjs tree → 2 warnings, 0 errors (the baseline count for this package).
  • node core/scripts/check-arch-docs.mjs with ARCH_DOCS_BASE=bab1fe96 → OK (4 changed files); node .github/scripts/changelog.mjs check → fragments well formed.

Not run / environment

  • TZ=UTC npm run verify exits 1 at the core suite on one test, core/test/bench-preflight.test.js:88 bench.sh shows a failed pnpm install and leaves no half-built profile, reporting mkdir: not found from bench.sh:91. Host layout, not this diff: pnpm and mkdir both live in /usr/bin and the fixture at :119 drops every PATH directory whose name contains pnpm, mkdir included; the same test fails on the base with the change stashed. Every step before the core suite is green.
  • No UI face: the change is when a read happens, not what the card draws — no before/after screenshots.

Tier: T2 (plugins/** per .github/agent/risk-rules.json) — risk-tier: T2. No UI face.

Checkpoint

{
  "pr": 3372, "claim": "Dev-5", "issue": 3371,
  "summary": "The Tree panel's reorganization notice read `tree/reorg` from the host every 30 s for as long as it was mounted, hidden window included, and coming back could show a report up to 30 s stale. The read now follows the page: a hidden document arms no interval, returning clears and re-arms it and then reads once at once, and the cleanup drops both the timer and the listener. The visible cadence stays 30 s and the field-change read is untouched.",
  "files": ["plugins/tree/client.js", "plugins/tree/test/hidden-poll.test.js", "docs/subsystems/tree.md", "changelog.d/3371.fixed.md"],
  "checks": { "ran": "TZ=UTC npm --prefix plugins/tree test; node scripts/lint-plugins.mjs tree; node core/scripts/check-arch-docs.mjs", "result": "green", "at": "4fa0a7d9b8195500ef2ddb8aa422b6f63cf3f9d8" },
  "next": "none — ready for review"
}

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy — verdict request for this tip, once: 4fa0a7d9b8195500ef2ddb8aa422b6f63cf3f9d8.

Fixes #3371, base bab1fe963b65913f5cd1021d30e6598a7f571627 (= live main), 4 files +156/−2, maintainer_can_modify: true, non-draft.

At that exact tip: 18 checks = 15 success + 2 skipped (live · real model, window check) + 1 failure — the only red is enqueue-guard (no Verifier report names the tip 4fa0a7d9b819), which is what this request clears. Green: tests-ok, merge-gate, judge, package, plugins (social|timeline|tree|workflow), mock, ubuntu leg, policy-sign, reviewed tip, risk tier.

What it changes, in one line: the tree reorganization notice read tree/reorg on a bare 30 s interval from a hidden window and could be up to 30 s stale on return; it now goes through pollWhileVisible — hidden arms no timer, returning clears and re-arms then reads once at once, and cleanup drops timer and listener.

Red-first evidence in the body: npm --prefix plugins/tree test is 158 / 157 / 1 fail before the fix (a hidden window does not read tree/reorg again, expected 1 actual 2), 158/158/0 after; the new test also asserts after unmount that timers.length === 0 and listeners.length === 0 (the cleanup gap Security flagged on an earlier poll PR); lint-plugins tree 2 warnings / 0 errors (baseline); arch-docs OK (4); changelog check ok.

@HugoXK

HugoXK commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy: review request for #3372 at tip 4fa0a7d (base bab1fe9)

@github-actions github-actions Bot added the risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff label Nov 24, 2026
@HugoXK

HugoXK commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

FlyBot 2.0 audit (2026-11-25), read-only. This PR has no 2.0 landing point, so it was not repackaged; it stays open as the v1.0 record. Nothing was closed, retargeted or merged — the owner decides.

It changes plugins/tree/** + docs: 0 of 4 paths exist at 2.0 main. Tree (recursive bot delegation) is deliberately deferred, not imported (docs/upstream/OPTIONAL-PLUGINS.md:21, planned for multi-agent #6/#7), so the 30-second tree/reorg poll does not exist to guard.

Evidence: FLYBOT_2.0_PR_AUDIT_RESULT.md (owner report, 2026-11-25).

@Birfy

Birfy commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

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

  • main 锚点:d8898cad(2026-11-25T12:20:16Z,2156 blobs)
  • head:4fa0a7d9b8195500ef2ddb8aa422b6f63cf3f9d8,base 未固定
  • 该 PR 改动文件在 main d8898cad 上存在 0 个(git cat-file 逐条核)
  • 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 上评审或 rebase 复用;本 PR 从未在当前线上被评审或验证

@Birfy

Birfy commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

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

  • main 锚点:d8898cad(2026-11-25T12:20:16Z,2156 blobs)
  • head:4fa0a7d9b8195500ef2ddb8aa422b6f63cf3f9d8,base 未固定
  • 该 PR 改动文件在 main d8898cad 上存在 0 个(git cat-file 逐条核)
  • 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 上评审或 rebase 复用;本 PR 从未在当前线上被评审或验证

@Birfy Birfy closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:T2 Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants