[PR #15972] ui: ensure thinking timer is closed on client disconnects #77673

Open
opened 2026-05-05 10:20:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15972
Author: @krasilovalex
Created: 5/5/2026
Status: 🔄 Open

Base: mainHead: fix/merge-thinking-timeout


📝 Commits (1)

  • 418c346 ui: ensure thinking timer is closed on client disconnects

📊 Changes

1 file changed (+15 additions, -14 deletions)

View changed files

📝 app/ui/ui.go (+15 -14)

📄 Description

This PR resolves the TODO (jmorganca) in app/ui/ui.go regarding incomplete thinking timers.

Previously, if a client disconnected or the request was cancelled, the c.Chat loop would return early, bypassing the cleanup logic at the bottom of the function. By moving this logic into a defer block above the loop, we guarantee that the thinking timer is gracefully closed during both standard completions and early exits (errors/disconnects).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15972 **Author:** [@krasilovalex](https://github.com/krasilovalex) **Created:** 5/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/merge-thinking-timeout` --- ### 📝 Commits (1) - [`418c346`](https://github.com/ollama/ollama/commit/418c346b3e8dea48cb23c0c67ecf08e18251d9b3) ui: ensure thinking timer is closed on client disconnects ### 📊 Changes **1 file changed** (+15 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `app/ui/ui.go` (+15 -14) </details> ### 📄 Description This PR resolves the TODO (jmorganca) in app/ui/ui.go regarding incomplete thinking timers. Previously, if a client disconnected or the request was cancelled, the c.Chat loop would return early, bypassing the cleanup logic at the bottom of the function. By moving this logic into a defer block above the loop, we guarantee that the thinking timer is gracefully closed during both standard completions and early exits (errors/disconnects). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 10:20:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77673