Repository: JanDeDobbeleer/oh-my-posh
Pull request #6478 (2025-05-29 17:53:37)

fix(upgrade): disable auto upgrade when loading async
### Prerequisites

- [x] I have read and understood the [contributing guide][CONTRIBUTING.md].
- [x] The commit message follows the [conventional commits][cc] guidelines.
- [x] Tests for the changes have been added (for bug fixes / features).
- [x] Docs have been added/updated (for bug fixes / features).

### Description

<!---

Tips:

If you're not comfortable with working with Git,
we're working a guide (https://ohmyposh.dev/docs/contributing/git) to help you out.
Oh My Posh advises GitKraken (https://www.gitkraken.com/invite/nQmDPR9D) as your preferred cross platform Git GUI power tool.

-->

[CONTRIBUTING.md]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/CONTRIBUTING.md
[cc]: https://www.conventionalcommits.org/en/v1.0.0/#summary



Patch:
diff --git a/src/config/config.go b/src/config/config.go
index 022257a6..2c9a3440 100644
--- a/src/config/config.go
+++ b/src/config/config.go
@@ -116,7 +116,10 @@ func (cfg *Config) Features(env runtime.Environment) shell.Features {
 		feats = append(feats, shell.FTCSMarks)
 	}
 
-	feats = append(feats, cfg.UpgradeFeatures(env)...)
+	// do not enable upgrade features when async is enabled
+	if !slices.Contains(feats, shell.Async) {
+		feats = append(feats, cfg.upgradeFeatures(env)...)
+	}
 
 	if cfg.ErrorLine != nil || cfg.ValidLine != nil {
 		log.Debug("error or valid line enabled")
@@ -166,7 +169,7 @@ func (cfg *Config) Features(env runtime.Environment) shell.Features {
 	return feats
 }
 
-func (cfg *Config) UpgradeFeatures(env runtime.Environment) shell.Features {
+func (cfg *Config) upgradeFeatures(env runtime.Environment) shell.Features {
 	feats := shell.Features{}
 
 	if _, OK := env.Cache().Get(upgrade.CACHEKEY); OK && !cfg.Upgrade.Force {
diff --git a/website/docs/installation/upgrade.mdx b/website/docs/installation/upgrade.mdx
index 3e086dd5..2a8aed2d 100644
--- a/website/docs/installation/upgrade.mdx
+++ b/website/docs/installation/upgrade.mdx
@@ -29,6 +29,11 @@ Auto upgrade will never upgrade major versions. This is to avoid introducing bre
 without explicit user acknowledgement.
 :::
 
+:::warning
+Upgrade features are never enabled when you have `async` loading enabled in your configuration
+and the shell you're using supports it.
+:::
+
 | Name       |   Type    | Default | Description                                                                                                                                                                                                                |
 | ---------- | :-------: | :-----: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
 | `notice`   | `boolean` | `false` | enable displaying the upgrade notice on shell start, only checks based on `interval`                                                                                                                                       |


Test patch:
diff --git a/src/config/config_test.go b/src/config/config_test.go
index 6a84c9d4..c44a4f25 100644
--- a/src/config/config_test.go
+++ b/src/config/config_test.go
@@ -189,7 +189,7 @@ func TestUpgradeFeatures(t *testing.T) {
 			},
 		}
 
-		got := cfg.UpgradeFeatures(env)
+		got := cfg.upgradeFeatures(env)
 		assert.Equal(t, tc.ExpectedFeats, got, tc.Case)
 	}
 }