on main help sign in
fix: handle OpenAI compat type correctly in TestConnection
commit7d14abb965dcdf461ab0ca47981c49ce6ddd5055 authorKujtim Hoxha <kujtimii.h@gmail.com> dateMon 20 Oct 2025, 12:02 (1 year ago) parent47c5fca
3 files changed+16−2
internal/agent/agent.go+10 internal/agent/templates/summary.md+5−1 internal/config/config.go+1−1
internal/agent/agent.go+10
@@ -430,6 +430,16 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy
430430 if summarizeErr := a.Summarize(genCtx, call.SessionID, call.ProviderOptions); summarizeErr != nil {
431431 return nil, summarizeErr
432432 }
433+ // if the agent was not done...
434+ if len(currentAssistant.ToolCalls()) > 0 {
435+ existing, ok := a.messageQueue.Get(call.SessionID)
436+ if !ok {
437+ existing = []SessionAgentCall{}
438+ }
439+ call.Prompt = fmt.Sprintf("The previous session was interrupted because it got too long, the initial user request was: `%s`", call.Prompt)
440+ existing = append(existing, call)
441+ a.messageQueue.Set(call.SessionID, existing)
442+ }
433443 }
434444
435445 // release active request before processing queued messages
internal/agent/templates/summary.md+5−1
@@ -10,4 +10,8 @@ Focus on information that would be helpful for continuing the conversation, incl
1010- Any context that would be needed to continue working on the task
1111- What needs to be done next
1212
13−Your summary should be comprehensive enough to provide context but concise enough to be quickly understood.
13+Your summary should be comprehensive enough to provide context to be quickly understood.
14+
15+It is very important to keep context of files that are important and strategy you are following.
16+
17+It is very important to have the next steps clearly defined.
internal/config/config.go+1−1
@@ -542,7 +542,7 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error {
542542 headers := make(map[string]string)
543543 apiKey, _ := resolver.ResolveValue(c.APIKey)
544544 switch c.Type {
545− case catwalk.TypeOpenAI:
545+ case catwalk.TypeOpenAI, catwalk.TypeOpenAICompat:
546546 baseURL, _ := resolver.ResolveValue(c.BaseURL)
547547 if baseURL == "" {
548548 baseURL = "https://api.openai.com/v1"