fix: clean up OAuth token cache on provider deletion#7908
fix: clean up OAuth token cache on provider deletion#7908jh-block merged 3 commits intoblock:mainfrom
Conversation
d0f5db7 to
e4c94c2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0f5db7f81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
crates/goose/src/providers/init.rs
Outdated
| @@ -79,6 +79,16 @@ async fn init_registry() -> RwLock<ProviderRegistry> { | |||
| registry.register::<VeniceProvider, _>(|m| Box::pin(VeniceProvider::from_env(m)), false); | |||
| registry.register::<XaiProvider, _>(|m| Box::pin(XaiProvider::from_env(m)), false); | |||
| }); | |||
| // Register cleanup functions for providers with cached state | |||
| registry.set_cleanup( | |||
| "githubcopilot", | |||
There was a problem hiding this comment.
Register Copilot cleanup under the actual provider name
The cleanup hook is registered for "githubcopilot", but the provider is keyed as "github_copilot" in its metadata and registry entry, so cleanup_provider("github_copilot") never finds this callback. In the UI/API deletion flow (which passes provider.name), GitHub Copilot token cache cleanup is silently skipped, so deleting and reconfiguring Copilot can still reuse stale OAuth state.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f40eb6e — changed "githubcopilot" to "github_copilot" to match the actual provider registry key.
|
|
||
| // Clean up provider-specific cache files (e.g., OAuth tokens) before removing config | ||
| if let Err(e) = | ||
| tokio::runtime::Handle::current().block_on(goose::providers::cleanup_provider(selected_id)) |
There was a problem hiding this comment.
Remove sync block_on call from provider deletion path
This uses tokio::runtime::Handle::current().block_on(...) inside the configure command flow, which already runs on Tokio; calling block_on from within an active runtime can panic at runtime. As a result, selecting “Remove Custom Provider” can crash the CLI before deletion/cleanup completes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f40eb6e — made remove_provider() and configure_custom_provider_dialog() async, replacing block_on with .await.
e4c94c2 to
4365b60
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4365b6011f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| return createSseClient({ | ||
| ...opts, | ||
| body: opts.body as BodyInit | null | undefined, | ||
| headers: opts.headers as unknown as Record<string, string>, |
There was a problem hiding this comment.
Pass serialized body to SSE requests
makeSseFn stopped passing serializedBody into createSseClient, but createSseClient builds RequestInit with body: options.serializedBody, so SSE POST payloads are now dropped. This breaks the desktop chat path where useChatStream calls reply() with session_id and user_message: /reply receives an empty/malformed body and cannot deserialize ChatRequest, so streaming replies fail.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This diff is from the upstream rebase (auto-generated client.gen.ts by @hey-api/openapi-ts), not from this PR. No changes needed on our end.
There was a problem hiding this comment.
after rebasing or merging in main, you need to just generate-openapi so that the generated files are based on the combination of your changes and main.
Can you rebase or merge main and run that? You don't need to manually resolve the conflicts on the generated files when rebasing/merging, just run the generator and it will replace the files with correct versions
There was a problem hiding this comment.
Done — rebased on main and ran just generate-openapi with the correct @hey-api/openapi-ts v0.93.0. just check-openapi-schema, cargo check, and tsc --noEmit all pass. Should be good now.
…ation When deleting an OAuth provider (e.g., GitHub Copilot, Databricks), cached token files on disk were not removed, causing re-configuration to silently reuse stale tokens without opening a browser for fresh authorization. Adds a provider cleanup mechanism via the registry: providers can register a static cleanup function that removes their cache files. Called from the UI, backend API, and CLI before config keys are deleted. Closes block#7890 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
- Fix provider name from "githubcopilot" to "github_copilot" to match the actual registry key - Make remove_provider() and configure_custom_provider_dialog() async to avoid block_on panic inside tokio runtime Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
f40eb6e to
3406a75
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
3406a75 to
9fe0201
Compare
…ct-ui * origin/main: docs: add Remote Access section with Telegram Gateway documentation (#7955) fix: update webmcp blog post metadata image URL (#7967) fix: clean up OAuth token cache on provider deletion (#7908) fix: hard-coded tool call id in code mode callback (#7939) Fix SSE parsers to accept optional space after data: prefix (#7929) docs: add GOOSE_INPUT_LIMIT to config-files.md (#7961) Add WebMCP for Beginners blog post (#7957) Fix download manager (#7933) # Conflicts: # ui/desktop/src/api/index.ts # ui/desktop/src/api/sdk.gen.ts
* main: (32 commits) Revert message flush & test (block#7966) docs: add Remote Access section with Telegram Gateway documentation (block#7955) fix: update webmcp blog post metadata image URL (block#7967) fix: clean up OAuth token cache on provider deletion (block#7908) fix: hard-coded tool call id in code mode callback (block#7939) Fix SSE parsers to accept optional space after data: prefix (block#7929) docs: add GOOSE_INPUT_LIMIT to config-files.md (block#7961) Add WebMCP for Beginners blog post (block#7957) Fix download manager (block#7933) Improve the formatting of tool calls, show thinking, treat Reasoning and Thinking as the same thing (sorry Kant) (block#7626) don't imply running builds all the time in AGENTS.md (block#7865) fix: unregister goosed child process's listener (block#7956) feat: adversarial agent for preventing leaking of info and more (block#7948) Update contributing.md (block#7927) docs: add credit balance monitoring section (block#7952) docs: add Cerebras provider to supported providers list (block#7953) docs: add TUI client documentation to ACP clients guide (block#7950) fix: removed double dash in pnpm command (block#7951) docs: polish ACP docs (block#7946) claude adaptive thinking (block#7944) ...
Summary
POST /config/providers/{name}/cleanup), and CLI before config keys are deletedTest plan
~/.config/goose/githubcopilot/info.jsonexists after configurationinfo.jsonis removed from diskcargo buildandcargo testpassnpx tsc --noEmit)Closes #7890
🤖 Generated with Claude Code