Skip to content

Conversation

@wpfleger96
Copy link
Collaborator

@wpfleger96 wpfleger96 commented Oct 27, 2025

This PR adds runtime access to provider names by introducing a simple name field and instance method to the Provider trait. This enables session management code to identify which provider is currently in use, laying the groundwork for provider/model configuration persistence across session resumption.

Session management code interacts with providers as trait objects (&dyn Provider). To persist provider/model configuration when saving a session, we need to identify which provider is currently in use. Previously, provider metadata was only accessible via static methods, which can't be called on trait objects. This blocked the ability to save and restore the correct provider during session resumption.

The implementation adds a simple name field to each provider that gets initialized from their static metadata. For standard providers (like OpenAI, Anthropic), the name comes directly from their metadata. For custom providers (like "custom_deepseek"), the name is their custom identifier—not their underlying engine's name. This ensures custom providers are correctly distinguished from their base implementations.

Implementation details:

  • Added get_name(&self) -> &str instance method to Provider trait
  • Updated all 21 provider implementations to store and return a name: String field
  • Standard providers initialize with name: Self::metadata().name
  • Custom providers receive their name via from_custom_config(model, config, provider_name)
  • Declarative provider registration passes the custom provider's name to ensure proper identification
  • Updated all 7 mock providers in tests to implement the new trait method

Relates to #5358

@wpfleger96 wpfleger96 changed the title Enable runtime access to provider metadata Enable runtime access to provider name Oct 27, 2025
@wpfleger96 wpfleger96 force-pushed the wpfleger/persist-provider-config branch from 3f58307 to 239c4a4 Compare October 27, 2025 22:00
@wpfleger96 wpfleger96 merged commit 4d8c91e into main Oct 28, 2025
14 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/persist-provider-config branch October 28, 2025 18:21
michaelneale added a commit that referenced this pull request Oct 29, 2025
* main: (30 commits)
  feat: add goose powered ai culinary innovation studio prompt to library (#5423)
  removing golang/temporal building
  testing tetrate with sonnet (#5428)
  Add Recipes Test Script (#5420)
  Don't die on strange chars (#5415)
  fix: allow subagent to run in parent --no-session mode (#5384)
  docs: analyze tool (#5418)
  fix: gracefully close goosed listening port (#5321)
  move history txt to state dir (#5410)
  Dont exit silently when storing api key fails (#5260)
  Make reply use the API (#5389)
  Fix/icon ii (#5413)
  Enable runtime access to provider name (#5399)
  fix: ensure trailing newline in files created by `text_editor` tool (#5336)
  docs: September 2025 Community All-Stars (#5411)
  make supports_cache_control async to avoid block in place (#5362)
  Send all the logs we output (#5363)
  Recipe variables (#5365)
  Feat/add mermaid chart rendering (#5377)
  Set up Datadog metrics for prompt injection detection (#5385)
  ...
katzdave added a commit that referenced this pull request Nov 3, 2025
* 'main' of github.com:block/goose: (132 commits)
  Fix/icon ii (#5413)
  Enable runtime access to provider name (#5399)
  fix: ensure trailing newline in files created by `text_editor` tool (#5336)
  docs: September 2025 Community All-Stars (#5411)
  make supports_cache_control async to avoid block in place (#5362)
  Send all the logs we output (#5363)
  Recipe variables (#5365)
  Feat/add mermaid chart rendering (#5377)
  Set up Datadog metrics for prompt injection detection (#5385)
  fix: restore --resume functionality for most recent session (#5401)
  Gemini again (#5390)
  docs(prompt-library): add github-issue-labeler intermediate prompt (#5374)
  docs: add Linux and Windows paths to uninstall section (#5371)
  fix: --session-id shouldn't work without --resume, but --name should (#5360)
  Auto-compact Threshold UI improvements (#5354)
  Filter preserved user messages to be text only. (#5391)
  include sessionId in tool request (#5394)
  feat: add PR Impact Analyzer prompt (#5375)
  docs: add blog post on configuring goose for team environments (#5380)
  migrating back with new chatrecall non underscore name (#5223)
  ...
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 2025
Signed-off-by: Blair Allan <Blairallan@icloud.com>
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.

3 participants