Skip to content

perf(polling): pause background refreshes when hidden#400

Open
beruro wants to merge 3 commits into
junyu/hermes-hook-statusfrom
perf/visibility-aware-polling-audit
Open

perf(polling): pause background refreshes when hidden#400
beruro wants to merge 3 commits into
junyu/hermes-hook-statusfrom
perf/visibility-aware-polling-audit

Conversation

@beruro

@beruro beruro commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • centralize recurring frontend backend/status refreshes behind a visibility-aware, sequential polling hook
  • abort stale polling episodes before identity-scoped consumers commit React/Jotai state
  • share system resource metrics across Settings and Sidebar consumers with request coalescing
  • coalesce Browser console/network drain requests and remove obsolete inline-WebView interval plumbing
  • consolidate Git watcher health, polling fallback, and recovery into one state-preserving monitor
  • add the completed 10-layer architecture audit in docs/architecture-audit-2026-07-16/PollingLifecycle.md

Audit findings resolved

The pre-commit architecture audit found and fixed two blocking race classes:

  1. old async polling episodes could write after a dependency/restart-key change
  2. Git watcher restart removed RepoState before recreation, which could destroy fallback/retry metadata on failure

The final re-audit verdict is safe to commit / PR.

Verification

  • pnpm exec eslint on all 36 changed frontend source/test files
  • scoped TypeScript check on all changed frontend files
  • pnpm exec vitest run src/hooks/fileReview src/hooks/platform/useInlineWebview/__tests__/useWebviewCommands.test.ts src/modules/WorkStation/Browser/SessionReplay/__tests__/config.test.ts src/scaffold/NavigationSidebar/connectors/WorkstationSidebarConnector/menuSelection.test.ts — 10 tests passed
  • cargo fmt --manifest-path crates/git/Cargo.toml --check
  • cargo test -p git --lib — 129 tests passed
  • cargo clippy -p git --all-targets -- -D warnings
  • git diff --check
  • pre-commit hooks: lint-staged, scoped TypeScript, and scoped Git Clippy passed

Scope notes

  • This is a stacked PR based on feat(hermes): add native lifecycle hooks for Hermes #386 (junyu/hermes-hook-status) because several touched polling consumers were changed on that branch.
  • It intentionally excludes unrelated updater UX/i18n, imported-history, key-vault, chat-history, and task-kanban work present in the source worktree.
  • It intentionally excludes useDataSourceAutoScan; an independent focus-adaptive implementation landed on develop as 5be17525b while this audit was running.

Dependency

beruro added 2 commits July 17, 2026 00:19
Pre-commit hook ran. Total eslint: 0, total circular: 0
Pre-commit hook ran. Total eslint: 1, total circular: 0
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.

2 participants