Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

feat(coding-agent): flush registerProvider immediately, add unregisterProvider#1669

Closed
aliou wants to merge 1 commit intobadlogic:mainfrom
aliou:worktree/ext-register-provider-flush
Closed

feat(coding-agent): flush registerProvider immediately, add unregisterProvider#1669
aliou wants to merge 1 commit intobadlogic:mainfrom
aliou:worktree/ext-register-provider-flush

Conversation

@aliou
Copy link
Contributor

@aliou aliou commented Feb 27, 2026

Problem

pi.registerProvider() pushed to a pendingProviderRegistrations queue that was only flushed once during bindCore() at startup. Any call after that (e.g. from a command handler following a setup flow) sat dead in the queue until the next /reload.

Changes

model-registry.ts — Added ModelRegistry.unregisterProvider(name): removes the provider from registeredProviders, clears its API key, then calls refresh() so built-in models that were overridden are restored.

extensions/types.ts — Added registerProvider and unregisterProvider fields to ExtensionRuntimeState so the runner can swap them out after bind. Added pi.unregisterProvider() to ExtensionAPI.

extensions/loader.tscreateExtensionRuntime() initialises registerProvider as a queue-push closure and unregisterProvider as a queue-removal closure. createExtensionAPI delegates both to the runtime instead of touching the queue directly.

extensions/runner.ts — In bindCore(), after flushing the pending queue, both functions are replaced with direct ModelRegistry calls. From that point every pi.registerProvider() / pi.unregisterProvider() call takes effect immediately.

docs/extensions.md — Updated pi.registerProvider section to document the immediate-flush behaviour; added pi.unregisterProvider section with example.

CHANGELOG.md — Added Added and Fixed entries under [Unreleased].

@github-actions
Copy link
Contributor

Hi @aliou, thanks for your interest in contributing!

We ask new contributors to open an issue first before submitting a PR. This helps us discuss the approach and avoid wasted effort.

Next steps:

  1. Open an issue describing what you want to change and why (keep it concise, write in your human voice, AI slop will be closed)
  2. Once a maintainer approves with lgtm, you'll be added to the approved contributors list
  3. Then you can submit your PR

This PR will be closed automatically. See https://github.com/badlogic/pi-mono/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions bot closed this Feb 27, 2026
@badlogic badlogic reopened this Feb 27, 2026
@aliou
Copy link
Contributor Author

aliou commented Feb 27, 2026

For more context, i noticed when using two extensions together:

Without this, the providers model wouldn't be accessible after the apertures updates it.

@aliou aliou force-pushed the worktree/ext-register-provider-flush branch from 975de88 to 2ea1530 Compare February 27, 2026 15:35
@badlogic badlogic closed this in 2f55890 Feb 27, 2026
@badlogic
Copy link
Owner

Merged into main with fixes: queue unregister now removes all matching entries (not just first), types/docs aligned, OAuth/API registrations reset on refresh, tests added. Thanks @aliou!

@aliou
Copy link
Contributor Author

aliou commented Feb 27, 2026

Thanks!

@aliou aliou deleted the worktree/ext-register-provider-flush branch February 27, 2026 21:22
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