[codex] Skip auto-update probes already in flight#498
Conversation
|
Stack note for maintainers/agents: Recommended #487 merge order:
This PR has no hard dependency on #499 or #500 and is the smallest behavioral guard in the stack. It is the best first merge because it prevents redundant background work before the backend-level limits are reviewed. #490 is separate from this stack and can merge anytime. |
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR updates the app’s auto-update probe scheduler to avoid launching redundant background probes for providers that are already in-flight (loading), aligning background refresh behavior with the existing manual refresh guardrails and supporting the broader resource-budget work in #487.
Changes:
- Add an
isPluginLoadingpredicate to the probe hook surface area (useProbe→useProbeAutoUpdate) so the auto-update interval can skip busy providers. - Update auto-update scheduling to only start batches for idle providers, while still advancing
autoUpdateNextAteven if all providers are busy. - Extend hook-level tests and adjust App integration tests to model initial probe completion prior to auto-update.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/hooks/app/use-probe.ts | Exposes isPluginLoading based on current probe state for use by auto-update scheduling. |
| src/hooks/app/use-probe-auto-update.ts | Filters enabled provider IDs to idle ones before starting an auto-update batch; keeps schedule advancing when none are idle. |
| src/hooks/app/use-probe-auto-update.test.ts | Adds coverage for skipping loading providers and rescheduling when all are loading. |
| src/App.test.tsx | Updates auto-update integration tests to simulate initial probe completion before interval-driven refresh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
dd27e5a to
6e41496
Compare
|
Addressed the review feedback in the latest push:
Verified locally with |
robinebers
left a comment
There was a problem hiding this comment.
LGTM. Clean focused change. The synchronous pluginStatesRef update via updatePluginStates is the right way to make isPluginLoading actually correct on the next interval tick. Tests cover the partial-idle and all-loading branches. Verified all 78 App tests + new hook tests pass locally.
Summary
loadingWhy
This is a small first slice of #487. If a provider probe is slow or stuck, the fixed auto-update interval should not start another probe for that same provider on top of the existing one. The app already uses
loadingto prevent repeated manual refreshes; this applies the same resource-budget guard to background auto-updates.The change does not alter the configured refresh interval, provider plugin runtime, or manual refresh behavior. It only avoids redundant auto-update work for providers that are still in flight.
Validation
node ./node_modules/vitest/vitest.mjs run src/hooks/app/use-probe-auto-update.test.tsnode ./node_modules/vitest/vitest.mjs run src/App.test.tsx -t "auto-update"node ./node_modules/vitest/vitest.mjs runbun run buildThe full Vitest run passes. Existing App tests still print Tauri store mock stderr, but the suite exits successfully.
Closes part of #487.
Summary by cubic
Skip auto-update probes already in flight and keep probe state in sync so loading checks are accurate. Only idle providers run; the schedule still advances when all providers are busy. Part of #487.
loading.pluginStatesRefcurrent when setting loading/errors soisPluginLoadingreflects changes immediately; wireisPluginLoadingintouse-probe-auto-updateand update tests (App timers, initial batch completion, and newuse-probe-statecoverage).Written for commit 6e41496. Summary will update on new commits. Review in cubic