Skip to content

feat: add ability to disable providers auto-update from catwalk - #866

Merged
andreynering merged 3 commits into
mainfrom
charm-570-offline-mode
Sep 12, 2025
Merged

andreynering merged 3 commits into
mainfrom
charm-570-offline-mode

Conversation

@andreynering

@andreynering andreynering commented Aug 22, 2025 •

Copy link
Copy Markdown
Member

Some people reported that they can't access Catwalk due to corporate restrictions on internet access, etc.

This PR adds the ability to disable Catwalk. Once disabled, Crush will use the latest available providers from the library, which might be outdated, but should still work if the Crush version is enough up-to-date.

Disabling providers updates

Disabling via ENV:

env CRUSH_DISABLE_PROVIDER_AUTO_UPDATE=1 crush

Disabling via config:

// ~/.config/crush/crush.json
{
  "options": {
    "disable_provider_auto_update": true
  }
}

Manually updating providers

# Update providers remotely from Catwalk
crush update-providers

# Update providers from a custom URL
crush update-providers https://example.com/

# Update providers from a local file
crush update-providers /path/to/local-providers.json

# Update providers from embedded version
crush update-providers embedded
Screenshots

Success output:

Screenshot 2025-09-11 at 17 13 27

Error output:

Screenshot 2025-09-11 at 17 13 39

@andreynering andreynering self-assigned this Aug 22, 2025
@andreynering
andreynering requested a review from a team as a code owner August 22, 2025 18:32
@andreynering
andreynering requested review from bashbunni and removed request for a team August 22, 2025 18:32
Comment thread internal/config/config.go Outdated
@jamestrew

This comment was marked as resolved.

@billysan

Copy link
Copy Markdown

hi guys anything shaking with this? 🙏ðŸŧ

@meowgorithm

meowgorithm commented Sep 5, 2025 •

Copy link
Copy Markdown
Member

Thanks for your patience with this one, everyone—we do plan on merging this one soon.

@andreynering andreynering changed the title feat: allow to disable catwalk / "offline mode" feat: add ability to disable providers auto-update from catwalk Sep 10, 2025
@andreynering
andreynering requested review from Copilot and removed request for bashbunni September 10, 2025 21:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the ability to disable automatic provider updates from the Catwalk service, addressing corporate network restrictions and allowing offline usage. When disabled, Crush uses cached or embedded providers instead of fetching from remote sources.

Key changes:

  • Added configuration option to disable provider auto-updates via environment variable or config file
  • Implemented update-providers command for manual provider management
  • Refactored provider loading logic to respect the disable flag and handle offline scenarios

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
schema.json Added disable_providers_auto_update boolean field to configuration schema
internal/config/config.go Added DisableProvidersAutoUpdate field to Options struct
internal/config/load.go Added environment variable parsing for the disable flag
internal/config/provider.go Refactored provider loading with disable logic and added UpdateProviders function
internal/config/provider_test.go Updated test calls to include new autoUpdateDisabled parameter
internal/config/provider_empty_test.go Updated test calls to include new autoUpdateDisabled parameter
internal/cmd/update_providers.go New command implementation for manual provider updates
internal/cmd/root.go Added update-providers command to CLI
internal/tui/components/dialogs/models/models.go Updated provider loading call to pass config
internal/tui/components/dialogs/models/list.go Updated provider loading calls to pass config
internal/tui/components/chat/splash/splash.go Updated provider loading call to pass config

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread internal/config/provider.go
Comment thread internal/config/provider.go
@bbrodriges

Copy link
Copy Markdown
Contributor

It would be really great if this PR could be merged

@andreynering
andreynering force-pushed the charm-570-offline-mode branch 2 times, most recently from adb0e27 to aeb71ff Compare September 11, 2025 20:28
@andreynering

Copy link
Copy Markdown
Member Author

This is ready to be reviewed.

I suggest to test locally the different scenarios. (I tested carefully myself and for me it's stable).

Also, review the README content and let me know if it's clear.

Comment thread internal/config/config.go Outdated
Comment on lines +43 to +58
// NOTE(@andreynering): This style is more-or-less copied from Fang's
// error message, adapted for success.
headerStyle := lipgloss.NewStyle().
Foreground(charmtone.Butter).
Background(charmtone.Guac).
Bold(true).
Padding(0, 1).
Margin(1).
MarginLeft(2).
SetString("SUCCESS")
textStyle := lipgloss.NewStyle().
MarginLeft(2).
SetString("Providers updated successfully.")

fmt.Printf("%s\n%s\n\n", headerStyle.Render(), textStyle.Render())
return nil

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have this natively on Fang maybe.

Basically, a function to print success (maybe warning, info, ...) messages in the same style as the error message in case an error is returned.

@meowgorithm

Copy link
Copy Markdown
Member

It would be really great if this PR could be merged

We're very close. We'll most likely merge tomorrow and cut a release same day.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
@jamestrew

Copy link
Copy Markdown
Contributor

I hate to hold this up anymore but testing this, I have a slight concern, particularly for new users. Is that by default, if you can't access the catwalk service, you looks like you still just get hit with an error.

âŊ crush

   ERROR

  Failed to load providers: failed to make request: Get "https://catwalk.charm.sh/providers": dial tcp: lookup
  catwalk.charm.sh: no such host.

so one would need to know about setting CRUSH_DISABLE_PROVIDERS_AUTO_UPDATE=1.

I think it would be helpful to either communicate the existence of this option to users in the error message, or fallback to enabling CRUSH_DISABLE_PROVIDERS_AUTO_UPDATE automatically if access to catwalk fails.

@andreynering
andreynering force-pushed the charm-570-offline-mode branch 4 times, most recently from e1d5e92 to d50785d Compare September 12, 2025 18:16
@andreynering

Copy link
Copy Markdown
Member Author

Hey @jamestrew.

That was a great suggestion. What about this?

Screenshot 2025-09-12 at 15 11 53

@jamestrew

Copy link
Copy Markdown
Contributor

Hey @jamestrew.

That was a great suggestion. What about this?

Screenshot 2025-09-12 at 15 11 53

That looks good to me 👍

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread internal/config/load.go Outdated
Comment thread internal/config/provider.go Outdated
Comment thread schema.json
Comment thread internal/config/load.go Outdated
Comment thread schema.json Outdated
@andreynering
andreynering merged commit 04b5710 into main Sep 12, 2025
17 checks passed
@andreynering
andreynering deleted the charm-570-offline-mode branch September 12, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offline Mode

9 participants