Repository navigation
fix(pi): remove stale models after successful discovery - #16602
RobertoVillegas wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused provider-registry bug fix that removes stale Pi extension models after completed discovery while preserving cached models when discovery is incomplete. The production change is small, isolated, and accompanied by targeted regression coverage for inventory and cache behavior. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe provider registry now removes missing cached Pi models after completed discovery. It retains cached models when a Pi probe is incomplete. Tests cover inventory replacement and persistence across refreshes and registry restarts. ChangesPi model inventory
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Stale Pi models should be removed after completed discovery and preserved when discovery is incomplete. No actionable merge-blocking risk remains after normal checks. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change removes outdated choices after completed discovery without adding permissions or expanding access. Failed or incomplete discovery preserves the last known choices. No material security risk was identified in the changed behavior. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Closing as a duplicate of #15079, which I missed in the initial search. Both PRs fix the same Pi inventory retention rule; #15079 also validates malformed RPC inventories before treating discovery as authoritative and already covers cache persistence and restart behavior. My reproduction with pi-cursor-sdk/Composer confirms the same defect on nightly fd1c338. No separate fix is needed here. |
Problem
After uninstalling a Pi provider extension, its models remain selectable in T3 Code even after refreshing Pi and restarting T3. Pi no longer reports those models, so selecting them fails.
Reproduced on macOS arm64 with Pi 1.0.4 and T3 Code Nightly
0.0.46-nightly.20261006.2735(fd1c3386c4d6):pi-cursor-sdkin Pi and let T3 discover its models.pi --list-models composerreports no matching models.~/.t3/caches/pi.jsonstill contains 246cursor/…entries, including 15 Composer variants.Removing only that cache with T3 fully closed resolves the stale list. Removing the plugin's own model cache did not.
ProviderRegistryalways retains missing discovered models for Pi, then persists the merged list again. A refresh therefore cannot remove models from an uninstalled extension.Fix
Treat completed Pi discovery as authoritative, including successful discovery with no usable models. Pi reports authenticated/ready for usable models and unauthenticated/warning for an empty inventory. Failed or interactive discovery keeps unknown auth; those partial snapshots still retain the last known models.
The existing capability merge and custom-model handling are unchanged. No cache migration, manual cleanup, UI change, or other provider behavior change is needed: the next successful Pi refresh removes the stale entries.
This is a focused fix for an obvious refresh defect, submitted under the small bug-fix exception in CONTRIBUTING.md.
Verification
Added four focused regression tests covering removed extension models, successful empty discovery, incomplete discovery, and cache persistence through failed refreshes and registry restarts.
pnpm exec vp test run apps/server/src/provider/ProviderRegistry.test.ts apps/server/src/provider/PiProvider.test.ts apps/server/src/provider/providerStatusCache.test.ts— 68 tests passed.pnpm --filter t3 typecheck— passed.vp fmt --check,vp lint, andgit diff --check— passed.The packaged app was used to establish the original failure and verify the cache-removal workaround; the patched backend is verified through focused tests, not a rebuilt desktop app. No repo-wide checks were run.
AI assistance: OpenAI
gpt-6.1-solin Pi coding-agent.