You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workflow: a hidden window keeps the stage's 2 s store poll, and coming back waits for a tick - #3365
plugins/workflow/client.js:2197 armed the stage's store poll as a bare setInterval(() => { ... void refresh() }, 2000) — no visibility check and no visibilitychange listener. refresh() is a full workflow/state read of the store (including the widened heldLimit page), so a Workflow stage left open in a background window kept reading the host every 2 s for as long as any run was live (activeCount > 0) or a read error was on screen; and coming back to the window showed rows up to 2 s stale, because nothing read at the moment the page became visible again. plugins/timeline/client.js:70 already declines to poll while visible() is false, and the social surface has the same rule (#3315, #3327); this was the last surface that ignored it.
Red first
plugins/workflow/test/client.test.js on this branch, with the fix not yet written — a hidden document, a live run, then the armed timer fired:
not ok 249 - a hidden page stops the poll and a visible one reads again at once
error: |-
a hidden page does not read the store again
2 !== 1
expected: 1
actual: 2
# tests 545
# pass 544
# fail 1
After the fix, the same command: # tests 545 / # pass 545 / # fail 0.
Fix
pollWhileVisible(fn, ms) (+30/−3): a hidden page arms no interval at all, not one whose tick would be dropped; on visibilitychange back to visible the interval is cleared and re-armed and then read once at once — keeping the old interval would carry the time it had already burned, so the next read would land early instead of a full ms after the page came back; the cleanup removes both the listener and the timer.
The stage effect now returns that cleanup instead of owning setInterval/clearInterval. One read per tick, the failed-read retry and the read-only write suppression (#2222) are unchanged, and the visible cadence stays 2000 ms.
docs/subsystems/workflow.md client row records the rule; changelog.d/3361.fixed.md is the user-visible entry.
Ran
TZ=UTC npm --prefix plugins/workflow test → 545 tests, 545 pass, 0 fail, 0 skipped (exit 0), at this tip's tree.
Red first: the same command before the fix → 545 tests, 544 pass, 1 fail, original above.
node scripts/lint-plugins.mjs workflow → 16 warnings, 0 errors (the baseline count; the new test adds no warning).
node .github/scripts/changelog.mjs check → fragments well formed; node core/scripts/check-arch-docs.mjs with ARCH_DOCS_BASE=bab1fe96 → OK (4 changed files).
Not run / environment
TZ=UTC npm run verify exits 1 at the core suite on one test, core/test/bench-preflight.test.js:88bench.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 (core lint 0 errors, arch-docs OK, plugin lint 0 errors, build-client --check, ds-bot-patches check + canonical).
No UI face: the change is when a poll runs, not what the panel draws, so there are no before/after screenshots.
Tier: T2 (plugins/** per .github/agent/risk-rules.json) — risk-tier: T2. No UI face.
Checkpoint
{
"pr": 3365, "claim": "Dev-5", "issue": 3361,
"summary": "The Workflow stage polled `workflow/state` every 2 s from a window nobody was looking at, and coming back showed rows up to 2 s stale. The poll now arms no interval at all while the page is hidden, clears and re-arms it when the page becomes visible again, and reads once at once at that moment. One read per tick, the failed-read retry and the read-only write suppression are unchanged, the visible cadence stays 2000 ms, and unloading removes both the timer and the listener.",
"files": ["plugins/workflow/client.js", "plugins/workflow/test/client.test.js", "docs/subsystems/workflow.md", "changelog.d/3361.fixed.md"],
"checks": { "ran": "TZ=UTC npm --prefix plugins/workflow test; node scripts/lint-plugins.mjs workflow; node core/scripts/check-arch-docs.mjs", "result": "green", "at": "bd5818c2105e51b611ac7f55c1bba5e8bf148829" },
"next": "none — ready for review"
}
@Birfy — verdict request for this tip, once: bd5818c2105e51b611ac7f55c1bba5e8bf148829.
Fixes #3361, base bab1fe963b65913f5cd1021d30e6598a7f571627 (= live main), 4 files +84/−4, 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 bd5818c2105e), which is exactly 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 Workflow stage armed its 2 s workflow/state store poll as a bare setInterval (plugins/workflow/client.js:2197), so a hidden window kept reading and a tab that came back waited out the tick; it now goes through pollWhileVisible — hidden arms no timer, returning reads once at once and re-arms, cleanup clears timer and listener.
Red-first evidence in the body: plugins/workflow/test/client.test.js is 545 tests / 544 pass / 1 fail before the fix (a hidden page does not read the store again, expected 1 actual 2), 545/545/0 after; lint-plugins workflow 16 warnings / 0 errors (baseline); arch-docs OK (4).
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/workflow/** + docs: 0 of 4 paths exist at 2.0 main. The workflow plugin is deliberately not imported (docs/upstream/OPTIONAL-PLUGINS.md:22), and the nearest 2.0 concept, features/team-runs, is a server-side DAG over native turns — not a client board with a 2-second store poll, so the fixed timer has no counterpart.
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
risk:T2Risk tier T2 (host/plugin code or an unnamed path), set by the controller from the diff
2 participants
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.
Fixes #3361
Owner: Dev-5
Written-by: FlyBot Dev-5
Bot: FlyBot Dev-5
Reviewer: Birfy
What is wrong
plugins/workflow/client.js:2197armed the stage's store poll as a baresetInterval(() => { ... void refresh() }, 2000)— no visibility check and novisibilitychangelistener.refresh()is a fullworkflow/stateread of the store (including the widenedheldLimitpage), so a Workflow stage left open in a background window kept reading the host every 2 s for as long as any run was live (activeCount > 0) or a read error was on screen; and coming back to the window showed rows up to 2 s stale, because nothing read at the moment the page became visible again.plugins/timeline/client.js:70already declines to poll whilevisible()is false, and the social surface has the same rule (#3315,#3327); this was the last surface that ignored it.Red first
plugins/workflow/test/client.test.json this branch, with the fix not yet written — a hidden document, a live run, then the armed timer fired:After the fix, the same command:
# tests 545 / # pass 545 / # fail 0.Fix
pollWhileVisible(fn, ms)(+30/−3): a hidden page arms no interval at all, not one whose tick would be dropped; onvisibilitychangeback to visible the interval is cleared and re-armed and then read once at once — keeping the old interval would carry the time it had already burned, so the next read would land early instead of a fullmsafter the page came back; the cleanup removes both the listener and the timer.setInterval/clearInterval. One read per tick, the failed-read retry and the read-only write suppression (#2222) are unchanged, and the visible cadence stays 2000 ms.docs/subsystems/workflow.mdclient row records the rule;changelog.d/3361.fixed.mdis the user-visible entry.Ran
TZ=UTC npm --prefix plugins/workflow test→ 545 tests, 545 pass, 0 fail, 0 skipped (exit 0), at this tip's tree.node scripts/lint-plugins.mjs workflow→ 16 warnings, 0 errors (the baseline count; the new test adds no warning).node .github/scripts/changelog.mjs check→ fragments well formed;node core/scripts/check-arch-docs.mjswithARCH_DOCS_BASE=bab1fe96→ OK (4 changed files).Not run / environment
TZ=UTC npm run verifyexits 1 at the core suite on one test,core/test/bench-preflight.test.js:88bench.sh shows a failed pnpm install and leaves no half-built profile, reportingmkdir: not foundfrombench.sh:91. Host layout, not this diff:pnpmandmkdirboth live in/usr/bin, and the fixture at:119drops every PATH directory whose name containspnpm,mkdirincluded — the same test fails on the base with the change stashed. Every step before the core suite is green (core lint 0 errors,arch-docsOK, plugin lint 0 errors,build-client --check,ds-bot-patches check+canonical).Tier: T2 (
plugins/**per.github/agent/risk-rules.json) —risk-tier: T2. No UI face.Checkpoint
{ "pr": 3365, "claim": "Dev-5", "issue": 3361, "summary": "The Workflow stage polled `workflow/state` every 2 s from a window nobody was looking at, and coming back showed rows up to 2 s stale. The poll now arms no interval at all while the page is hidden, clears and re-arms it when the page becomes visible again, and reads once at once at that moment. One read per tick, the failed-read retry and the read-only write suppression are unchanged, the visible cadence stays 2000 ms, and unloading removes both the timer and the listener.", "files": ["plugins/workflow/client.js", "plugins/workflow/test/client.test.js", "docs/subsystems/workflow.md", "changelog.d/3361.fixed.md"], "checks": { "ran": "TZ=UTC npm --prefix plugins/workflow test; node scripts/lint-plugins.mjs workflow; node core/scripts/check-arch-docs.mjs", "result": "green", "at": "bd5818c2105e51b611ac7f55c1bba5e8bf148829" }, "next": "none — ready for review" }