ollama - 💡(How to fix) Fix cmd/tui: upgrade bubbletea / lipgloss to v2? [1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15692Fetched 2026-04-19 15:04:10
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Root Cause

v2 removes the package-level init() in bubbletea that calls lipgloss.HasDarkBackground(). That init is the source of #15597 (5s OSC 11 timeout on ollama ls in a PTY) — it fires on every invocation because bubbletea is in the binary's import graph. No in-module workaround can run before it, since Go orders independent-package inits alphabetically by import path and github.com/ollama/... sorts after github.com/charmbracelet/.... Separately, v1 is now frozen.

Fix Action

Fix / Workaround

v2 removes the package-level init() in bubbletea that calls lipgloss.HasDarkBackground(). That init is the source of #15597 (5s OSC 11 timeout on ollama ls in a PTY) — it fires on every invocation because bubbletea is in the binary's import graph. No in-module workaround can run before it, since Go orders independent-package inits alphabetically by import path and github.com/ollama/... sorts after github.com/charmbracelet/.... Separately, v1 is now frozen.

  • New vanity domain charm.land/ replaces github.com/charmbracelet/….
  • bubbletea v2.0.0 shipped in Feb 2026; current patch is v2.0.6.
  • compat.AdaptiveColor is a shim; a follow-up could move to the idiomatic lipgloss.LightDark helper.
  • Interactive flows (launcher menu, signin, selector, confirm) need manual verification — not cleanly unit-testable.
RAW_BUFFERClick to expand / collapse

Is a PR to migrate cmd/tui from bubbletea/lipgloss v1 to v2 wanted?

Motivation

v2 removes the package-level init() in bubbletea that calls lipgloss.HasDarkBackground(). That init is the source of #15597 (5s OSC 11 timeout on ollama ls in a PTY) — it fires on every invocation because bubbletea is in the binary's import graph. No in-module workaround can run before it, since Go orders independent-package inits alphabetically by import path and github.com/ollama/... sorts after github.com/charmbracelet/.... Separately, v1 is now frozen.

Scope

~8 files in cmd/tui/, roughly 300–500 line diff. The ollama TUI uses a narrow subset of the APIs — no mouse, paste, alt-screen, program options, or removed commands are touched. Breaking changes that apply:

  • Import paths → charm.land/bubbletea/v2, charm.land/lipgloss/v2
  • View() stringView() tea.View
  • tea.KeyMsg (struct) → tea.KeyPressMsg; msg.Typemsg.Code; msg.Runesmsg.Text
  • lipgloss.AdaptiveColor{…}compat.AdaptiveColor{Light: lipgloss.Color(…), Dark: lipgloss.Color(…)}
  • Tests using tea.KeyMsg{…} literals need the new field names

Considerations

  • New vanity domain charm.land/ replaces github.com/charmbracelet/….
  • bubbletea v2.0.0 shipped in Feb 2026; current patch is v2.0.6.
  • compat.AdaptiveColor is a shim; a follow-up could move to the idiomatic lipgloss.LightDark helper.
  • Interactive flows (launcher menu, signin, selector, confirm) need manual verification — not cleanly unit-testable.

Happy to send the PR. If a v2 migration is already planned or in flight, let me know and I'll close this out.

extent analysis

TL;DR

Migrate cmd/tui from bubbletea/lipgloss v1 to v2 to resolve the 5s OSC 11 timeout issue and to utilize the latest version of the libraries.

Guidance

  • Verify the compatibility of the new version with the existing codebase, focusing on the breaking changes mentioned, such as import paths, View() return type, and tea.KeyMsg struct changes.
  • Update the import paths to charm.land/bubbletea/v2 and charm.land/lipgloss/v2 in the affected files.
  • Manually test interactive flows, including the launcher menu, signin, selector, and confirm, to ensure they work as expected after the migration.
  • Consider a follow-up PR to replace compat.AdaptiveColor with the idiomatic lipgloss.LightDark helper for better consistency with the library's recommendations.

Example

No specific code example is provided due to the nature of the issue, but an example of updating tea.KeyMsg to tea.KeyPressMsg might look like changing tea.KeyMsg{Runes: 'a'} to tea.KeyPressMsg{Text: 'a'}.

Notes

The migration involves a significant number of changes (~300-500 line diff), and thorough testing, especially of interactive components, is crucial to ensure the TUI works correctly after the update.

Recommendation

Apply the workaround by migrating to v2, as it not only resolves the mentioned issue but also brings the codebase up to date with the latest library versions, which is beneficial for future maintenance and compatibility.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

ollama - 💡(How to fix) Fix cmd/tui: upgrade bubbletea / lipgloss to v2? [1 participants]