feat: auto-refresh model list when stale - #91
pi-claw-agent[bot] wants to merge 2 commits into
Conversation
Independent Agent review: changes requestedReview round 1/2 for The staleness helper, setting (default 30, minimum 0 = disabled), in-flight sharing, and failure tolerance are sound, but the auto refresh only runs for one of the model-list surfaces. The native VS Code model picker paths still present an unrefreshed registry list, so the issue requirement (refresh when the model list is opened after N minutes) is only partially met. Findings
Reviewer checks
Generated by the independent sandboxed Reviewer Agent. The PR still requires human review and merge. |
Agent review repair 1Addressed both findings. (1) The staleness guard now covers every model-list entry point: pickModel() awaits ensureModelListFresh() (which also covers pickSessionModel, the /model slash command, and the legacy webview pickModel message) in addition to buildStatusPickerOptions(), and a successful refresh rebuilds cycleModels from the fresh registry so model cycling sees current data. (2) The refresh timestamp is now process-wide (shared module state with get/mark/reset helpers) instead of per-PiService, so sibling sessions honor the same N-minute window while the per-instance in-flight promise still de-duplicates concurrent opens. Tests cover the shared clock and the expanded wiring. Independent Agent review will run on the updated commit. The PR still requires human review and merge. |
Independent Agent review: approvedReview round 2/2 for Both round-1 findings are resolved. The staleness guard now runs on every model-list surface: pickModel() awaits ensureModelListFresh() (covering the Pi: Switch Model / pickSessionModel commands and the webview pickModel / /model path) alongside buildStatusPickerOptions(), and a successful refresh rebuilds cycleModels from the fresh registry so cycling sees current data. The refresh timestamp moved to a shared module-level clock (get/mark/reset helpers) while the per-instance in-flight promise still de-duplicates concurrent opens, so sibling sessions honor one N-minute window. Pure staleness/max-age rules and the shared clock are unit tested, wiring assertions cover both guards and the cycle rebuild, and all validation passes. Reviewer checks
Generated by the independent sandboxed Reviewer Agent. The PR still requires human review and merge. |
Summary
Added pi-on-code.modelListRefreshMinutes (number, default 30, minimum 0 = disabled). Opening the model list now checks staleness through a pure helper and refreshes the provider registry (modelRegistry.refresh) before building the picker items when the cached list is older than the window; concurrent opens share a single in-flight refresh and a failure is logged without breaking the picker.
Validation
Closes #90