Skip to content

Add support for customizable timeout for AI-generated commit messages #867

@seeseemelk

Description

@seeseemelk

When using Ollama to generate commit messages, some larger files take a bit longer to generate the commit message for. For especially large files, this can result in a timeout:

Failed to generate commit message: System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait(CancellationToken cancellationToken)
   at SourceGit.Models.OpenAIService.Chat(String prompt, String question, CancellationToken cancellation)
   at SourceGit.Commands.GenerateCommitMessage.GenerateChangeSummary(Change change)
   at SourceGit.Commands.GenerateCommitMessage.Result()
   at SourceGit.Views.AIAssistant.<OnOpened>b__2_0()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
--- End of stack trace from previous location ---

   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait(CancellationToken cancellationToken)
   at SourceGit.Models.OpenAIService.Chat(String prompt, String question, CancellationToken cancellation)
   at SourceGit.Commands.GenerateCommitMessage.GenerateChangeSummary(Change change)
   at SourceGit.Commands.GenerateCommitMessage.Result()

It would be nice if this timeout can be configured or even turned off completely.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions