xonecas.io
60255
Zn

Zoea-Nova / commit f0416b6

Remove unreliable rate limiting and improve logging

- Remove token bucket rate limiter (golang.org/x/time/rate) from all providers
- Delete rate limiting config fields and validation
- Remove 524 lines of rate limiting code and tests
- Add Info-level logging for LLM requests (start, success, failure)
- Fix MCP retry delays for SpaceMolt rate limits (2s/5s/10s instead of 200ms/400ms/800ms)
- Add 429-specific logging to distinguish rate limits from other errors
- All tests pass, full visibility without debug mode

xonecas2026-02-09 f0416b606f80ecdded7540ae585fb39ccd36433c parent 6d47f1b

34 files changed

This diff is too big to show in full. The first 1000 lines are below, and every file is listed with its counts.

.gitignore+1−0
@@ -21,3 +21,4 @@ Thumbs.db
2121
2222 accounts-backup.sql
2323 coverage-tui.out
24+/zoea
cmd/zoea/main.go+2−2
@@ -237,7 +237,7 @@ func initProviders(cfg *config.Config, creds *config.Credentials) *provider.Regi
237237 // Detect provider type by endpoint
238238 if strings.Contains(provCfg.Endpoint, "localhost:11434") || strings.Contains(provCfg.Endpoint, "/ollama") {
239239 // Ollama-based provider
240- factory := provider.NewOllamaFactory(name, provCfg.Endpoint, provCfg.RateLimit, provCfg.RateBurst)
240+ factory := provider.NewOllamaFactory(name, provCfg.Endpoint)
241241 registry.RegisterFactory(name, factory)
242242 } else if strings.Contains(provCfg.Endpoint, "opencode.ai") {
243243 // OpenCode-based provider
@@ -248,7 +248,7 @@ func initProviders(cfg *config.Config, creds *config.Credentials) *provider.Regi
248248 }
249249 apiKey := creds.GetAPIKey(keyName)
250250 if apiKey != "" {
251- factory := provider.NewOpenCodeFactory(name, provCfg.Endpoint, apiKey, provCfg.RateLimit, provCfg.RateBurst)
251+ factory := provider.NewOpenCodeFactory(name, provCfg.Endpoint, apiKey)
252252 registry.RegisterFactory(name, factory)
253253 }
254254 }
config.toml+0−10
@@ -7,22 +7,16 @@ default_provider = "ollama-qwen"
77 endpoint = "http://localhost:11434"
88 model = "qwen3:8b"
99 temperature = 0.7
10-rate_limit = 2.0
11-rate_burst = 3
1210
1311 [providers.ollama-qwen-small]
1412 endpoint = "http://localhost:11434"
1513 model = "qwen3:4b"
1614 temperature = 0.7
17-rate_limit = 2.0
18-rate_burst = 3
1915
2016 [providers.ollama-llama]
2117 endpoint = "http://localhost:11434"
2218 model = "llama3.1:8b"
2319 temperature = 0.7
24-rate_limit = 2.0
25-rate_burst = 3
2620
2721 # OpenCode Zen providers (cloud)
2822 [providers.zen-nano]
@@ -30,16 +24,12 @@ endpoint = "https://opencode.ai/zen/v1"
3024 model = "gpt-5-nano"
3125 api_key_name = "opencode_zen"
3226 temperature = 0.7
33-rate_limit = 1.0
34-rate_burst = 2
3527
3628 [providers.zen-pickle]
3729 endpoint = "https://opencode.ai/zen/v1"
3830 model = "big-pickle"
3931 api_key_name = "opencode_zen"
4032 temperature = 0.7
41-rate_limit = 1.0
42-rate_burst = 2
4333
4434 [mcp]
4535 upstream = "https://game.spacemolt.com/mcp"
documentation/architecture/INITIAL_IMPLEMENTATION_DESIGN.md+1−5
@@ -54,7 +54,7 @@ Scrollable conversation viewport showing full message history with role-based st
5454
5555 ## Configuration
5656
57-- **Environment Variables:** Runtime overrides (`ZOEA_MAX_MYSES`, `ZOEA_MCP_ENDPOINT`, `ZOEA_OLLAMA_ENDPOINT`, `ZOEA_OLLAMA_MODEL`, `ZOEA_OLLAMA_TEMPERATURE`, `ZOEA_OLLAMA_RATE_LIMIT`, `ZOEA_OLLAMA_RATE_BURST`, `ZOEA_OPENCODE_ENDPOINT`, `ZOEA_OPENCODE_MODEL`, `ZOEA_OPENCODE_TEMPERATURE`, `ZOEA_OPENCODE_RATE_LIMIT`, `ZOEA_OPENCODE_RATE_BURST`).
57+- **Environment Variables:** Runtime overrides (`ZOEA_MAX_MYSES`, `ZOEA_MCP_ENDPOINT`, `ZOEA_OLLAMA_ENDPOINT`, `ZOEA_OLLAMA_MODEL`, `ZOEA_OLLAMA_TEMPERATURE`, `ZOEA_OPENCODE_ENDPOINT`, `ZOEA_OPENCODE_MODEL`, `ZOEA_OPENCODE_TEMPERATURE`).
5858 - **Config File:** `config.toml` in project root for defaults and structure. Parsed via `github.com/BurntSushi/toml`.
5959 - **Credentials:** Stored in `$HOME/.zoea-nova/credentials.json`. Contains API keys for LLM providers. File permissions should be `0600`.
6060
@@ -67,15 +67,11 @@ max_myses = 16
6767 endpoint = "http://localhost:11434"
6868 model = "qwen3:4b"
6969 temperature = 0.7
70-rate_limit = 2.0
71-rate_burst = 3
7270
7371 [providers.opencode_zen]
7472 endpoint = "https://api.opencode.ai/v1"
7573 model = "glm-4.7-free"
7674 temperature = 0.7
77-rate_limit = 10.0
78-rate_burst = 5
7975
8076 [mcp]
8177 upstream = "https://game.spacemolt.com/mcp"
documentation/architecture/RATE_LIMITING_PLAN.md+0−49
@@ -1,49 +0,0 @@
1-# Provider Rate Limiting
2-
3-## Overview
4-
5-Zoea Nova enforces shared request limits per provider to prevent GPU overload (Ollama) and reduce the risk of upstream throttling (OpenCode Zen). Every mysis created with the same provider shares a single limiter.
6-
7-## Implementation
8-
9-- Each provider factory owns a `golang.org/x/time/rate` limiter created at startup.
10-- Providers created by the factory reuse that limiter, so the rate is shared across all myses for that provider.
11-- Requests in `Chat`, `ChatWithTools`, and `Stream` call `limiter.Wait(ctx)` before executing.
12-
13-## Configuration
14-
15-Rate limits are configured per provider in `config.toml`.
16-
17-```toml
18-[providers.ollama]
19-endpoint = "http://localhost:11434"
20-model = "qwen3:4b"
21-temperature = 0.7
22-rate_limit = 2.0
23-rate_burst = 3
24-
25-[providers.opencode_zen]
26-endpoint = "https://api.opencode.ai/v1"
27-model = "glm-4.7-free"
28-temperature = 0.7
29-rate_limit = 10.0
30-rate_burst = 5
31-```
32-
33-## Environment Overrides
34-
35-- `ZOEA_OLLAMA_RATE_LIMIT`
36-- `ZOEA_OLLAMA_RATE_BURST`
37-- `ZOEA_OPENCODE_RATE_LIMIT`
38-- `ZOEA_OPENCODE_RATE_BURST`
39-
40-## Request Flow
41-
42-1. Mysis prepares a request.
43-2. Provider waits on the shared limiter with `limiter.Wait(ctx)`.
44-3. Provider executes the request if the limiter allows it.
45-
46-## Behavior Notes
47-
48-- When the limiter blocks, the call waits until tokens are available or the context is canceled.
49-- Limiter errors are returned to the caller without additional event emission.
documentation/architecture/VERSION_ONE_DESIGN.md+2−5
@@ -275,7 +275,7 @@ This document serves as the **single source of truth** for what Zoea Nova v0.5.0
275275 | **Environment variables** | ❌ Not documented | ✅ 13 vars | ✅ Tested | ⚠️ MISSING | All `ZOEA_*` vars |
276276 | **Credentials file** | ❌ Not documented | ✅ `credentials.json` | ✅ Tested | ⚠️ MISSING | API keys |
277277 | **Default provider** | ❌ Not documented | ✅ `default_provider` | ✅ Tested | ⚠️ MISSING | In swarm section |
278-| **Rate limiting** | ❌ Not documented | ✅ `rate_limit`, `rate_burst` | ✅ Tested | ⚠️ MISSING | Per-provider |
278+
279279 | **Provider auto-detection** | ❌ Not documented | ✅ By endpoint URL | ✅ Tested | ⚠️ MISSING | String matching |
280280 | **Validation rules** | ❌ Not documented | ✅ Comprehensive | ✅ Tested | ⚠️ MISSING | Bounds checking |
281281
@@ -289,9 +289,7 @@ This document serves as the **single source of truth** for what Zoea Nova v0.5.0
289289 - **Implementation:** `~/.zoea-nova/credentials.json` with 0600 permissions
290290 - **Fix:** Document in README.md and configuration guide
291291
292-3. **Rate Limiting Not Documented**
293- - **Implementation:** Per-provider `rate_limit` and `rate_burst` settings
294- - **Fix:** Document in configuration guide
292+
295293
296294 ---
297295
@@ -388,7 +386,6 @@ This document serves as the **single source of truth** for what Zoea Nova v0.5.0
388386
389387 9. Fix or remove flaky E2E tests
390388 10. Add MCP offline mode tool tests
391-11. Add provider rate limiting tests
392389
393390 ---
394391
documentation/current/KNOWN_ISSUES.md+1−1
@@ -40,7 +40,7 @@ Active todo list of known issues, bugs, and planned improvements for Zoea Nova.
4040
4141 - [ ] **Investigate Ollama timeout errors** - Occasional "context deadline exceeded" errors when calling Ollama chat completions
4242 - **Error:** `Post "http://localhost:11434/v1/chat/completions": context deadline exceeded`
43- - **Needs:** Root cause analysis (model size, request timeout configuration, rate limiting interaction)
43+ - **Needs:** Root cause analysis (model size, request timeout configuration)
4444 - **Recent evidence (2026-02-05):** Ollama logs show prompt truncation (`limit=32768`, `prompt=41611`) followed by bursts of `400` responses on `/v1/chat/completions` and one `500` response. No corresponding errors in `~/.zoea-nova/zoea.log`.
4545
4646 ### Documentation & Tooling
documentation/current/TODO.md+4−7
@@ -15,13 +15,10 @@
1515
1616 Recommendations
1717
18-1. Fix rate limiter: Share rate.Limiter instances across provider entries with same endpoint/API key
19-2. Cargo management: Add logic to check cargo capacity before mining, trigger dock/sell when full
20-3. POI validation: Require get_poi before mine, use get_system for travel targets (stop hallucinating names)
21-4. Docking sequence: Ensure dock succeeds before calling station services (buy, sell, missions)
22-5. Increase iteration limit: From 10 to 15-20 to reduce turn overhead for complex tasks
23-6. Add jitter to login: Prevent simultaneous requests from multiple Myses hitting rate limits
24- The system is stable and efficient, but the rate limiting bug and low mining success rate (4.3%) are the primary blockers to swarm effectiveness.
18+1. Cargo management: Add logic to check cargo capacity before mining, trigger dock/sell when full
19+2. POI validation: Require get_poi before mine, use get_system for travel targets (stop hallucinating names)
20+3. Docking sequence: Ensure dock succeeds before calling station services (buy, sell, missions)
21+4. Increase iteration limit: From 10 to 15-20 to reduce turn overhead for complex tasks
2522
2623 7. Refactor OpenCode Zen provider factory: Make endpoint selection intelligent based on model type
2724 - Reference: https://opencode.ai/docs/zen/#models
documentation/guides/OPENCODE_ZEN_MODELS.md+0−2
@@ -21,8 +21,6 @@ These models are free during their beta period:
2121 endpoint = "https://opencode.ai/zen/v1"
2222 model = "glm-4.7-free"
2323 temperature = 0.7
24-rate_limit = 10.0
25-rate_burst = 5
2624 ```
2725
2826 **Important:** The endpoint must be `https://opencode.ai/zen/v1` (not `https://api.opencode.ai/...`).
go.mod+4−5
@@ -7,7 +7,11 @@ require (
77 github.com/charmbracelet/bubbles v0.21.1
88 github.com/charmbracelet/bubbletea v1.3.10
99 github.com/charmbracelet/lipgloss v1.1.0
10+ github.com/charmbracelet/x/exp/golden v0.0.0-20260204111555-7642919e0bee
11+ github.com/charmbracelet/x/exp/teatest v0.0.0-20260204111555-7642919e0bee
1012 github.com/google/uuid v1.6.0
13+ github.com/mattn/go-runewidth v0.0.19
14+ github.com/muesli/termenv v0.16.0
1115 github.com/rs/zerolog v1.34.0
1216 github.com/sashabaranov/go-openai v1.41.2
1317 modernc.org/sqlite v1.44.3
@@ -20,8 +24,6 @@ require (
2024 github.com/charmbracelet/colorprofile v0.4.1 // indirect
2125 github.com/charmbracelet/x/ansi v0.11.5 // indirect
2226 github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
23- github.com/charmbracelet/x/exp/golden v0.0.0-20260204111555-7642919e0bee // indirect
24- github.com/charmbracelet/x/exp/teatest v0.0.0-20260204111555-7642919e0bee // indirect
2527 github.com/charmbracelet/x/term v0.2.2 // indirect
2628 github.com/clipperhouse/displaywidth v0.9.0 // indirect
2729 github.com/clipperhouse/stringish v0.1.1 // indirect
@@ -32,10 +34,8 @@ require (
3234 github.com/mattn/go-colorable v0.1.13 // indirect
3335 github.com/mattn/go-isatty v0.0.20 // indirect
3436 github.com/mattn/go-localereader v0.0.1 // indirect
35- github.com/mattn/go-runewidth v0.0.19 // indirect
3637 github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
3738 github.com/muesli/cancelreader v0.2.2 // indirect
38- github.com/muesli/termenv v0.16.0 // indirect
3939 github.com/ncruces/go-strftime v1.0.0 // indirect
4040 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
4141 github.com/rivo/uniseg v0.4.7 // indirect
@@ -43,7 +43,6 @@ require (
4343 golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
4444 golang.org/x/sys v0.38.0 // indirect
4545 golang.org/x/text v0.28.0 // indirect
46- golang.org/x/time v0.14.0 // indirect
4746 modernc.org/libc v1.67.6 // indirect
4847 modernc.org/mathutil v1.7.1 // indirect
4948 modernc.org/memory v1.11.0 // indirect
go.sum+0−6
@@ -18,8 +18,6 @@ github.com/charmbracelet/x/ansi v0.11.5 h1:NBWeBpj/lJPE3Q5l+Lusa4+mH6v7487OP8K0r
1818 github.com/charmbracelet/x/ansi v0.11.5/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
1919 github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
2020 github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
21-github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ=
22-github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
2321 github.com/charmbracelet/x/exp/golden v0.0.0-20260204111555-7642919e0bee h1:SMCd7a1C8imaDNbsOxyOnC1iJj6i6gDQJCiXZgxZ4T8=
2422 github.com/charmbracelet/x/exp/golden v0.0.0-20260204111555-7642919e0bee/go.mod h1:V8n/g3qVKNxr2FR37Y+otCsMySvZr601T0C7coEP0bw=
2523 github.com/charmbracelet/x/exp/teatest v0.0.0-20260204111555-7642919e0bee h1:cT1warvOzf2ORyg3g9NJdu8kPdj/7XnGkrC7Sk8scdU=
@@ -88,12 +86,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8886 golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8987 golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
9088 golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
91-golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
92-golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
9389 golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
9490 golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
95-golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
96-golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
9791 golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
9892 golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
9993 modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis=
internal/config/config.go+0−9
@@ -31,8 +31,6 @@ type ProviderConfig struct {
3131 Model string `toml:"model"`
3232 APIKeyName string `toml:"api_key_name"`
3333 Temperature float64 `toml:"temperature"`
34- RateLimit float64 `toml:"rate_limit"`
35- RateBurst int `toml:"rate_burst"`
3634 }
3735
3836 // MCPConfig holds MCP proxy settings.
@@ -111,13 +109,6 @@ func validateProviderConfig(name string, cfg ProviderConfig) []error {
111109 errs = append(errs, fmt.Errorf("providers.%s.temperature=%v must be between 0.0 and 2.0", name, cfg.Temperature))
112110 }
113111
114- if cfg.RateLimit <= 0 {
115- errs = append(errs, fmt.Errorf("providers.%s.rate_limit=%v must be greater than 0", name, cfg.RateLimit))
116- }
117- if cfg.RateBurst < 1 {
118- errs = append(errs, fmt.Errorf("providers.%s.rate_burst=%d must be at least 1", name, cfg.RateBurst))
119- }
120-
121112 return errs
122113 }
123114
internal/config/config_test.go+0−127
@@ -23,8 +23,6 @@ max_myses = 32
2323 endpoint = "http://custom:11434"
2424 model = "mistral"
2525 temperature = 0.7
26-rate_limit = 2.0
27-rate_burst = 3
2826
2927 [mcp]
3028 upstream = "https://custom.mcp/endpoint"
@@ -61,8 +59,6 @@ max_myses = 16
6159 endpoint = "http://localhost:11434"
6260 model = "qwen3:4b"
6361 temperature = 0.5
64-rate_limit = 2.0
65-rate_burst = 3
6662 `
6763 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
6864 t.Fatalf("failed to write test config: %v", err)
@@ -78,38 +74,6 @@ rate_burst = 3
7874 }
7975 }
8076
81-func TestLoadWithRateLimit(t *testing.T) {
82- tmpDir := t.TempDir()
83- configPath := filepath.Join(tmpDir, "config.toml")
84-
85- content := `
86-[swarm]
87-max_myses = 16
88-
89-[providers.ollama]
90-endpoint = "http://localhost:11434"
91-model = "qwen3:4b"
92-temperature = 0.7
93-rate_limit = 3.5
94-rate_burst = 4
95-`
96- if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
97- t.Fatalf("failed to write test config: %v", err)
98- }
99-
100- cfg, err := Load(configPath)
101- if err != nil {
102- t.Fatalf("Load() error: %v", err)
103- }
104-
105- if cfg.Providers["ollama"].RateLimit != 3.5 {
106- t.Errorf("expected rate_limit=3.5, got %v", cfg.Providers["ollama"].RateLimit)
107- }
108- if cfg.Providers["ollama"].RateBurst != 4 {
109- t.Errorf("expected rate_burst=4, got %d", cfg.Providers["ollama"].RateBurst)
110- }
111-}
112-
11377 func TestLoadInvalidTemperature(t *testing.T) {
11478 tmpDir := t.TempDir()
11579 configPath := filepath.Join(tmpDir, "config.toml")
@@ -170,8 +134,6 @@ max_myses = 16
170134 endpoint = "http://localhost:11434"
171135 model = "qwen3:4b"
172136 temperature = 0.7
173-rate_limit = 2.0
174-rate_burst = 3
175137
176138 [mcp]
177139 upstream = "https://default.mcp/endpoint"
@@ -290,8 +252,6 @@ max_myses = 16
290252 endpoint = "http://file-endpoint"
291253 model = "file-model"
292254 temperature = 0.7
293-rate_limit = 2.0
294-rate_burst = 3
295255 `
296256 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
297257 t.Fatalf("failed to write test config: %v", err)
@@ -328,8 +288,6 @@ max_myses = 16
328288 endpoint = "http://localhost:11434"
329289 model = "qwen3:8b"
330290 temperature = 0.7
331-rate_limit = 2.0
332-rate_burst = 3
333291 `
334292 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
335293 t.Fatalf("failed to write test config: %v", err)
@@ -451,85 +409,6 @@ model = "qwen3:4b"
451409 }
452410 }
453411
454-func TestLoadRateLimitBounds(t *testing.T) {
455- tmpDir := t.TempDir()
456- configPath := filepath.Join(tmpDir, "config.toml")
457-
458- tests := []struct {
459- name string
460- rateLimit float64
461- }{
462- {"zero", 0.0},
463- {"negative", -1.0},
464- {"negative_fraction", -0.5},
465- }
466-
467- for _, tt := range tests {
468- t.Run(tt.name, func(t *testing.T) {
469- content := fmt.Sprintf(`
470-[providers.ollama]
471-endpoint = "http://localhost:11434"
472-model = "qwen3:4b"
473-rate_limit = %v
474-`, tt.rateLimit)
475-
476- if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
477- t.Fatalf("failed to write test config: %v", err)
478- }
479-
480- _, err := Load(configPath)
481- if err == nil {
482- t.Fatal("expected validation error for rate_limit <= 0")
483- }
484- if !strings.Contains(err.Error(), "rate_limit") {
485- t.Fatalf("expected rate_limit validation error, got %v", err)
486- }
487- if !strings.Contains(err.Error(), "must be greater than 0") {
488- t.Fatalf("expected bounds message, got %v", err)
489- }
490- })
491- }
492-}
493-
494-func TestLoadRateBurstBounds(t *testing.T) {
495- tmpDir := t.TempDir()
496- configPath := filepath.Join(tmpDir, "config.toml")
497-
498- tests := []struct {
499- name string
500- rateBurst int
501- }{
502- {"zero", 0},
503- {"negative", -1},
504- }
505-
506- for _, tt := range tests {
507- t.Run(tt.name, func(t *testing.T) {
508- content := fmt.Sprintf(`
509-[providers.ollama]
510-endpoint = "http://localhost:11434"
511-model = "qwen3:4b"
512-rate_burst = %d
513-`, tt.rateBurst)
514-
515- if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
516- t.Fatalf("failed to write test config: %v", err)
517- }
518-
519- _, err := Load(configPath)
520- if err == nil {
521- t.Fatal("expected validation error for rate_burst < 1")
522- }
523- if !strings.Contains(err.Error(), "rate_burst") {
524- t.Fatalf("expected rate_burst validation error, got %v", err)
525- }
526- if !strings.Contains(err.Error(), "must be at least 1") {
527- t.Fatalf("expected bounds message, got %v", err)
528- }
529- })
530- }
531-}
532-
533412 func TestLoadDefaultProvider(t *testing.T) {
534413 tmpDir := t.TempDir()
535414 configPath := filepath.Join(tmpDir, "config.toml")
@@ -543,8 +422,6 @@ default_provider = "ollama-qwen"
543422 endpoint = "http://localhost:11434"
544423 model = "qwen3:8b"
545424 temperature = 0.7
546-rate_limit = 2.0
547-rate_burst = 3
548425 `
549426 if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
550427 t.Fatalf("failed to write test config: %v", err)
@@ -572,8 +449,6 @@ max_myses = 16
572449 endpoint = "http://localhost:11434"
573450 model = "qwen3:8b"
574451 temperature = 0.7
575-rate_limit = 2.0
576-rate_burst = 3
577452
578453 [mcp]
579454 upstream = "https://mcp.example.com"
@@ -616,8 +491,6 @@ max_myses = 16
616491 endpoint = "http://localhost:11434"
617492 model = "qwen3:8b"
618493 temperature = 0.7
619-rate_limit = 2.0
620-rate_burst = 3
621494 `
622495 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
623496 t.Fatalf("failed to write test config: %v", err)
internal/core/commander_async_test.go+3−6
@@ -9,7 +9,6 @@ import (
99 "github.com/xonecas/zoea-nova/internal/mcp"
1010 "github.com/xonecas/zoea-nova/internal/provider"
1111 "github.com/xonecas/zoea-nova/internal/store"
12- "golang.org/x/time/rate"
1312 )
1413
1514 func setupCommanderAsyncTest(t *testing.T) (*Commander, *store.Store, *EventBus, func()) {
@@ -53,8 +52,7 @@ func TestCommanderSendMessageAsync(t *testing.T) {
5352 c, _, bus, cleanup := setupCommanderAsyncTest(t)
5453 defer cleanup()
5554
56- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
57- c.registry.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "response", limiter))
55+ c.registry.RegisterFactory("mock", provider.NewMockFactory("mock", "response"))
5856
5957 mysis, _ := c.CreateMysis("async-mysis", "mock")
6058
@@ -99,9 +97,8 @@ func TestCommanderBroadcastAsync(t *testing.T) {
9997 defer cleanup()
10098
10199 // Use separate mocks to avoid any potential contention
102- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
103- c.registry.RegisterFactory("mock1", provider.NewMockFactoryWithLimiter("mock1", "response1", limiter))
104- c.registry.RegisterFactory("mock2", provider.NewMockFactoryWithLimiter("mock2", "response2", limiter))
100+ c.registry.RegisterFactory("mock1", provider.NewMockFactory("mock1", "response1"))
101+ c.registry.RegisterFactory("mock2", provider.NewMockFactory("mock2", "response2"))
105102
106103 a1, err := c.CreateMysis("m1", "mock1")
107104 if err != nil {
internal/core/commander_test.go+4−10
@@ -10,7 +10,6 @@ import (
1010 "github.com/xonecas/zoea-nova/internal/mcp"
1111 "github.com/xonecas/zoea-nova/internal/provider"
1212 "github.com/xonecas/zoea-nova/internal/store"
13- "golang.org/x/time/rate"
1413 )
1514
1615 func setupCommanderTest(t *testing.T) (*Commander, *EventBus, func()) {
@@ -26,9 +25,8 @@ func setupCommanderTest(t *testing.T) (*Commander, *EventBus, func()) {
2625 bus := NewEventBus(100)
2726
2827 reg := provider.NewRegistry()
29- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
30- reg.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "mock response", limiter))
31- reg.RegisterFactory("ollama", provider.NewMockFactoryWithLimiter("ollama", "ollama response", limiter))
28+ reg.RegisterFactory("mock", provider.NewMockFactory("mock", "mock response"))
29+ reg.RegisterFactory("ollama", provider.NewMockFactory("ollama", "ollama response"))
3230
3331 cfg := &config.Config{
3432 Swarm: config.SwarmConfig{
@@ -513,8 +511,7 @@ func TestCommanderLoadMyses(t *testing.T) {
513511 defer bus.Close()
514512
515513 reg := provider.NewRegistry()
516- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
517- reg.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "response", limiter))
514+ reg.RegisterFactory("mock", provider.NewMockFactory("mock", "response"))
518515
519516 cfg := &config.Config{
520517 Swarm: config.SwarmConfig{MaxMyses: 16},
@@ -550,16 +547,13 @@ func TestBroadcastDoesNotBlockOnBusyMysis(t *testing.T) {
550547 defer bus.Close()
551548
552549 reg := provider.NewRegistry()
553- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
554550
555551 // Create a slow provider that will block for 2 seconds
556552 slowProvider := provider.NewMock("slow", "slow response").
557- WithLimiter(limiter).
558553 SetDelay(2 * time.Second)
559554
560555 // Create a fast provider for the other mysis
561- fastProvider := provider.NewMock("fast", "fast response").
562- WithLimiter(limiter)
556+ fastProvider := provider.NewMock("fast", "fast response")
563557
564558 // Register custom factories that return our specific providers
565559 reg.RegisterFactory("slow", &customMockFactory{
internal/core/notifications_test.go+1−3
@@ -10,7 +10,6 @@ import (
1010 "github.com/xonecas/zoea-nova/internal/mcp"
1111 "github.com/xonecas/zoea-nova/internal/provider"
1212 "github.com/xonecas/zoea-nova/internal/store"
13- "golang.org/x/time/rate"
1413 )
1514
1615 // setupNotificationTest creates a test environment for notification testing
@@ -27,8 +26,7 @@ func setupNotificationTest(t *testing.T) (*Commander, *store.Store, *EventBus, f
2726 bus := NewEventBus(100)
2827
2928 reg := provider.NewRegistry()
30- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
31- reg.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "mock response", limiter))
29+ reg.RegisterFactory("mock", provider.NewMockFactory("mock", "mock response"))
3230
3331 cfg := &config.Config{
3432 Swarm: config.SwarmConfig{
internal/core/state_machine_test.go+1−3
@@ -13,7 +13,6 @@ import (
1313 "github.com/xonecas/zoea-nova/internal/mcp"
1414 "github.com/xonecas/zoea-nova/internal/provider"
1515 "github.com/xonecas/zoea-nova/internal/store"
16- "golang.org/x/time/rate"
1716 )
1817
1918 // setupStateMachineTest creates a minimal test environment for state transition testing.
@@ -30,8 +29,7 @@ func setupStateMachineTest(t *testing.T) (*Commander, func()) {
3029 bus := NewEventBus(100)
3130
3231 reg := provider.NewRegistry()
33- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
34- reg.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "mock response", limiter))
32+ reg.RegisterFactory("mock", provider.NewMockFactory("mock", "mock response"))
3533
3634 cfg := &config.Config{
3735 Swarm: config.SwarmConfig{
internal/core/tick_integration_test.go+1−3
@@ -9,7 +9,6 @@ import (
99 "github.com/xonecas/zoea-nova/internal/mcp"
1010 "github.com/xonecas/zoea-nova/internal/provider"
1111 "github.com/xonecas/zoea-nova/internal/store"
12- "golang.org/x/time/rate"
1312 )
1413
1514 // setupTickTest creates a test environment for tick testing
@@ -26,8 +25,7 @@ func setupTickTest(t *testing.T) (*Commander, *store.Store, *EventBus, func()) {
2625 bus := NewEventBus(100)
2726
2827 reg := provider.NewRegistry()
29- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
30- reg.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "mock response", limiter))
28+ reg.RegisterFactory("mock", provider.NewMockFactory("mock", "mock response"))
3129
3230 cfg := &config.Config{
3331 Swarm: config.SwarmConfig{
internal/integration/broadcast_sender_test.go+1−3
@@ -9,7 +9,6 @@ import (
99 "github.com/xonecas/zoea-nova/internal/core"
1010 "github.com/xonecas/zoea-nova/internal/provider"
1111 "github.com/xonecas/zoea-nova/internal/store"
12- "golang.org/x/time/rate"
1312 )
1413
1514 func setupIntegrationCommander(t *testing.T) (*core.Commander, *store.Store, func()) {
@@ -25,8 +24,7 @@ func setupIntegrationCommander(t *testing.T) (*core.Commander, *store.Store, fun
2524 bus := core.NewEventBus(100)
2625
2726 reg := provider.NewRegistry()
28- limiter := rate.NewLimiter(rate.Limit(1000), 1000)
29- reg.RegisterFactory("mock", provider.NewMockFactoryWithLimiter("mock", "mock response", limiter))
27+ reg.RegisterFactory("mock", provider.NewMockFactory("mock", "mock response"))
3028
3129 cfg := &config.Config{
3230 Swarm: config.SwarmConfig{
internal/integration/mysis_creation_zen_nano_test.go+2−2
@@ -49,14 +49,14 @@ func TestCreateMysisWithZenNano(t *testing.T) {
4949 t.Logf("Processing provider: %s (endpoint: %s)", name, provCfg.Endpoint)
5050
5151 if provCfg.Endpoint == "http://localhost:11434" {
52- factory := provider.NewOllamaFactory(name, provCfg.Endpoint, provCfg.RateLimit, provCfg.RateBurst)
52+ factory := provider.NewOllamaFactory(name, provCfg.Endpoint)
5353 registry.RegisterFactory(name, factory)
5454 t.Logf(" ✓ Registered as Ollama: %s", name)
5555 } else if provCfg.Endpoint == "https://opencode.ai/zen/v1" {
5656 apiKey := creds.GetAPIKey("opencode_zen")
5757 t.Logf(" API key for opencode_zen: %s", apiKey)
5858 if apiKey != "" {
59- factory := provider.NewOpenCodeFactory(name, provCfg.Endpoint, apiKey, provCfg.RateLimit, provCfg.RateBurst)
59+ factory := provider.NewOpenCodeFactory(name, provCfg.Endpoint, apiKey)
6060 registry.RegisterFactory(name, factory)
6161 t.Logf(" ✓ Registered as OpenCode: %s", name)
6262 } else {
internal/integration/zen_nano_failure_test.go+2−2
@@ -46,14 +46,14 @@ func TestZenNanoWithProductionConfig(t *testing.T) {
4646
4747 for name, provCfg := range cfg.Providers {
4848 if provCfg.Endpoint == "http://localhost:11434" {
49- factory := provider.NewOllamaFactory(name, provCfg.Endpoint, provCfg.RateLimit, provCfg.RateBurst)
49+ factory := provider.NewOllamaFactory(name, provCfg.Endpoint)
5050 registry.RegisterFactory(name, factory)
5151 registeredCount++
5252 t.Logf("Registered Ollama: %s", name)
5353 } else if provCfg.Endpoint == "https://opencode.ai/zen/v1" {
5454 apiKey := creds.GetAPIKey("opencode_zen")
5555 if apiKey != "" {
56- factory := provider.NewOpenCodeFactory(name, provCfg.Endpoint, apiKey, provCfg.RateLimit, provCfg.RateBurst)
56+ factory := provider.NewOpenCodeFactory(name, provCfg.Endpoint, apiKey)
5757 registry.RegisterFactory(name, factory)
5858 registeredCount++
5959 t.Logf("Registered OpenCode: %s", name)
internal/mcp/proxy.go+34−6
@@ -50,7 +50,8 @@ var (
5050 ErrToolRetryExhausted = errors.New("mcp tool call failed after retries")
5151 )
5252
53-var toolRetryDelays = []time.Duration{200 * time.Millisecond, 400 * time.Millisecond, 800 * time.Millisecond}
53+// Retry delays increased to respect SpaceMolt's "Try again in 5 seconds" rate limit
54+var toolRetryDelays = []time.Duration{2 * time.Second, 5 * time.Second, 10 * time.Second}
5455
5556 // NewProxy creates a new MCP proxy.
5657 func NewProxy(upstream UpstreamClient) *Proxy {
@@ -187,11 +188,24 @@ func (p *Proxy) callUpstreamWithRetry(ctx context.Context, name string, args int
187188 for attempt := 0; attempt <= len(toolRetryDelays); attempt++ {
188189 if attempt > 0 {
189190 delay := toolRetryDelays[attempt-1]
190- log.Warn().
191- Str("tool", name).
192- Int("attempt", attempt).
193- Dur("delay", delay).
194- Msg("Retrying MCP tool call after error")
191+
192+ // Check if error is a 429 rate limit
193+ is429 := lastErr != nil && (strings.Contains(lastErr.Error(), "429") || strings.Contains(lastErr.Error(), "Rate limited"))
194+
195+ if is429 {
196+ log.Warn().
197+ Str("tool", name).
198+ Int("attempt", attempt).
199+ Dur("delay", delay).
200+ Err(lastErr).
201+ Msg("MCP tool rate limited - waiting before retry")
202+ } else {
203+ log.Warn().
204+ Str("tool", name).
205+ Int("attempt", attempt).
206+ Dur("delay", delay).
207+ Msg("Retrying MCP tool call after error")
208+ }
195209
196210 select {
197211 case <-time.After(delay):
@@ -202,6 +216,13 @@ func (p *Proxy) callUpstreamWithRetry(ctx context.Context, name string, args int
202216
203217 result, err := p.upstream.CallTool(ctx, name, args)
204218 if err == nil {
219+ // Log successful call at Info level for visibility
220+ if attempt > 0 {
221+ log.Info().
222+ Str("tool", name).
223+ Int("attempt", attempt+1).
224+ Msg("MCP tool call succeeded after retry")
225+ }
205226 return result, nil
206227 }
207228
@@ -212,6 +233,13 @@ func (p *Proxy) callUpstreamWithRetry(ctx context.Context, name string, args int
212233 lastErr = err
213234 }
214235
236+ // Log final failure with more context
237+ log.Error().
238+ Str("tool", name).
239+ Int("total_attempts", len(toolRetryDelays)+1).
240+ Err(lastErr).
241+ Msg("MCP tool call failed after all retries")
242+
215243 return nil, fmt.Errorf("%w: %v", ErrToolRetryExhausted, lastErr)
216244 }
217245
internal/provider/factory.go+4−10
@@ -1,45 +1,39 @@
11 package provider
22
3-import "golang.org/x/time/rate"
4-
53 type OllamaFactory struct {
64 name string
75 endpoint string
8- limiter *rate.Limiter
96 }
107
11-func NewOllamaFactory(name string, endpoint string, rateLimit float64, rateBurst int) *OllamaFactory {
8+func NewOllamaFactory(name string, endpoint string) *OllamaFactory {
129 return &OllamaFactory{
1310 name: name,
1411 endpoint: endpoint,
15- limiter: rate.NewLimiter(rate.Limit(rateLimit), rateBurst),
1612 }
1713 }
1814
1915 func (f *OllamaFactory) Name() string { return f.name }
2016
2117 func (f *OllamaFactory) Create(model string, temperature float64) Provider {
22- return NewOllamaWithTemp(f.name, f.endpoint, model, temperature, f.limiter)
18+ return NewOllamaWithTemp(f.name, f.endpoint, model, temperature)
2319 }
2420
2521 type OpenCodeFactory struct {
2622 name string
2723 endpoint string
2824 apiKey string
29- limiter *rate.Limiter
3025 }
3126
32-func NewOpenCodeFactory(name string, endpoint, apiKey string, rateLimit float64, rateBurst int) *OpenCodeFactory {
27+func NewOpenCodeFactory(name string, endpoint, apiKey string) *OpenCodeFactory {
3328 return &OpenCodeFactory{
3429 name: name,
3530 endpoint: endpoint,
3631 apiKey: apiKey,
37- limiter: rate.NewLimiter(rate.Limit(rateLimit), rateBurst),
3832 }
3933 }
4034
4135 func (f *OpenCodeFactory) Name() string { return f.name }
4236
4337 func (f *OpenCodeFactory) Create(model string, temperature float64) Provider {
44- return NewOpenCodeWithTemp(f.name, f.endpoint, model, f.apiKey, temperature, f.limiter)
38+ return NewOpenCodeWithTemp(f.name, f.endpoint, model, f.apiKey, temperature)
4539 }
internal/provider/factory_test.go+0−49
@@ -1,49 +0,0 @@
1-package provider
2-
3-import "testing"
4-
5-func TestOllamaFactorySharesLimiter(t *testing.T) {
6- factory := NewOllamaFactory("ollama-test", "http://example.com", 1.0, 2)
7-
8- p1 := factory.Create("model-a", 0.7)
9- p2 := factory.Create("model-b", 0.5)
10-
11- ollama1, ok := p1.(*OllamaProvider)
12- if !ok {
13- t.Fatalf("expected OllamaProvider, got %T", p1)
14- }
15- ollama2, ok := p2.(*OllamaProvider)
16- if !ok {
17- t.Fatalf("expected OllamaProvider, got %T", p2)
18- }
19-
20- if ollama1.limiter == nil || ollama2.limiter == nil {
21- t.Fatal("expected non-nil rate limiters")
22- }
23- if ollama1.limiter != ollama2.limiter {
24- t.Fatal("expected shared limiter across Ollama providers")
25- }
26-}
27-
28-func TestOpenCodeFactorySharesLimiter(t *testing.T) {
29- factory := NewOpenCodeFactory("zen-test", "https://api.opencode.ai/v1", "test-key", 5.0, 3)
30-
31- p1 := factory.Create("model-a", 0.7)
32- p2 := factory.Create("model-b", 0.5)
33-
34- opencode1, ok := p1.(*OpenCodeProvider)
35- if !ok {
36- t.Fatalf("expected OpenCodeProvider, got %T", p1)
37- }
38- opencode2, ok := p2.(*OpenCodeProvider)
39- if !ok {
40- t.Fatalf("expected OpenCodeProvider, got %T", p2)
41- }
42-
43- if opencode1.limiter == nil || opencode2.limiter == nil {
44- t.Fatal("expected non-nil rate limiters")
45- }
46- if opencode1.limiter != opencode2.limiter {
47- t.Fatal("expected shared limiter across OpenCode providers")
48- }
49-}
internal/provider/mock.go+1−32
@@ -4,8 +4,6 @@ import (
44 "context"
55 "sync"
66 "time"
7-
8- "golang.org/x/time/rate"
97 )
108
119 // MockProvider is a test provider that returns predefined responses.
@@ -17,7 +15,6 @@ type MockProvider struct {
1715 toolCalls []ToolCall
1816 streamErr error
1917 chatErr error
20- limiter *rate.Limiter
2118 reasoning string
2219 delay time.Duration
2320 }
@@ -33,22 +30,16 @@ func NewMock(name, response string) *MockProvider {
3330 type MockFactory struct {
3431 name string
3532 response string
36- limiter *rate.Limiter
3733 }
3834
3935 func NewMockFactory(name, response string) *MockFactory {
4036 return &MockFactory{name: name, response: response}
4137 }
4238
43-func NewMockFactoryWithLimiter(name, response string, limiter *rate.Limiter) *MockFactory {
44- return &MockFactory{name: name, response: response, limiter: limiter}
45-}
46-
4739 func (f *MockFactory) Name() string { return f.name }
4840
4941 func (f *MockFactory) Create(model string, temperature float64) Provider {
50- p := NewMock(f.name, f.response)
51- return p.WithLimiter(f.limiter)
42+ return NewMock(f.name, f.response)
5243 }
5344
5445 // WithChatError sets an error to return from Chat.
@@ -82,13 +73,6 @@ func (p *MockProvider) WithReasoning(reasoning string) *MockProvider {
8273 return p
8374 }
8475
85-func (p *MockProvider) WithLimiter(limiter *rate.Limiter) *MockProvider {
86- p.mu.Lock()
87- defer p.mu.Unlock()
88- p.limiter = limiter
89- return p
90-}
91-
9276 func (p *MockProvider) SetDelay(delay time.Duration) *MockProvider {
9377 p.mu.Lock()
9478 defer p.mu.Unlock()
@@ -111,11 +95,6 @@ func (p *MockProvider) Name() string {
11195
11296 // Chat returns the predefined response or error.
11397 func (p *MockProvider) Chat(ctx context.Context, messages []Message) (string, error) {
114- if p.limiter != nil {
115- if err := p.limiter.Wait(ctx); err != nil {
116- return "", err
117- }
118- }
11998 if err := p.waitDelay(ctx); err != nil {
12099 return "", err
121100 }
@@ -130,11 +109,6 @@ func (p *MockProvider) Chat(ctx context.Context, messages []Message) (string, er
130109
131110 // ChatWithTools returns the predefined response or tool calls.
132111 func (p *MockProvider) ChatWithTools(ctx context.Context, messages []Message, tools []Tool) (*ChatResponse, error) {
133- if p.limiter != nil {
134- if err := p.limiter.Wait(ctx); err != nil {
135- return nil, err
136- }
137- }
138112 if err := p.waitDelay(ctx); err != nil {
139113 return nil, err
140114 }
@@ -153,11 +127,6 @@ func (p *MockProvider) ChatWithTools(ctx context.Context, messages []Message, to
153127
154128 // Stream returns the predefined response as a single chunk.
155129 func (p *MockProvider) Stream(ctx context.Context, messages []Message) (<-chan StreamChunk, error) {
156- if p.limiter != nil {
157- if err := p.limiter.Wait(ctx); err != nil {
158- return nil, err
159- }
160- }
161130 if err := p.waitDelay(ctx); err != nil {
162131 return nil, err
163132 }
internal/provider/ollama.go+18−15
@@ -13,7 +13,6 @@ import (
1313
1414 "github.com/rs/zerolog/log"
1515 openai "github.com/sashabaranov/go-openai"
16- "golang.org/x/time/rate"
1716 )
1817
1918 // OllamaProvider implements the Provider interface for Ollama.
@@ -24,7 +23,6 @@ type OllamaProvider struct {
2423 httpClient *http.Client
2524 model string
2625 temperature float64
27- limiter *rate.Limiter
2826 }
2927
3028 var ollamaRetryDelays = []time.Duration{5 * time.Second, 10 * time.Second, 15 * time.Second}
@@ -32,10 +30,10 @@ var ollamaRetryDelays = []time.Duration{5 * time.Second, 10 * time.Second, 15 *
3230 // NewOllama creates a new Ollama provider.
3331 // Ollama exposes an OpenAI-compatible API at /v1.
3432 func NewOllama(endpoint, model string) *OllamaProvider {
35- return NewOllamaWithTemp("ollama", endpoint, model, 0.7, nil)
33+ return NewOllamaWithTemp("ollama", endpoint, model, 0.7)
3634 }
3735
38-func NewOllamaWithTemp(name string, endpoint, model string, temperature float64, limiter *rate.Limiter) *OllamaProvider {
36+func NewOllamaWithTemp(name string, endpoint, model string, temperature float64) *OllamaProvider {
3937 config := openai.DefaultConfig("")
4038 baseURL := strings.TrimRight(endpoint, "/") + "/v1"
4139 config.BaseURL = baseURL
@@ -47,7 +45,6 @@ func NewOllamaWithTemp(name string, endpoint, model string, temperature float64,
4745 httpClient: &http.Client{},
4846 model: model,
4947 temperature: temperature,
50- limiter: limiter,
5148 }
5249 }
5350
@@ -222,10 +219,12 @@ func (p *OllamaProvider) createChatCompletion(ctx context.Context, req ollamaCha
222219 }
223220 }
224221
225- if p.limiter != nil {
226- if err := p.limiter.Wait(ctx); err != nil {
227- return nil, err
228- }
222+ // Log at Info level for first attempt, Debug for retries
223+ if attempt == 0 {
224+ log.Info().
225+ Str("provider", "ollama").
226+ Str("model", p.model).
227+ Msg("Ollama request started")
229228 }
230229
231230 httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(body))
@@ -284,12 +283,22 @@ func (p *OllamaProvider) createChatCompletion(ctx context.Context, req ollamaCha
284283 return nil, fmt.Errorf("decode response: %w", err)
285284 }
286285
286+ // Log successful request at Info level for visibility
287+ log.Info().
288+ Str("provider", "ollama").
289+ Str("model", p.model).
290+ Int("status", resp.StatusCode).
291+ Int("attempt", attempt+1).
292+ Msg("Ollama request successful")
293+
287294 return &decoded, nil
288295 }
289296
290297 log.Error().
291298 Str("provider", "ollama").
299+ Str("model", p.model).
292300 Int("max_retries", maxRetries).
Cut short: this commit's diff is over 1000 lines.
internal/provider/opencode.go+22−14
Cut short: this commit's diff is over 1000 lines.
internal/provider/opencode_test.go+2−2
Cut short: this commit's diff is over 1000 lines.
internal/provider/provider_name_test.go+9−9
Cut short: this commit's diff is over 1000 lines.
internal/provider/provider_test.go+0−21
Cut short: this commit's diff is over 1000 lines.
internal/provider/registry_bug_test.go+2−4
Cut short: this commit's diff is over 1000 lines.
internal/provider/streaming_test.go+0−86
Cut short: this commit's diff is over 1000 lines.
internal/tui/input_reset_test.go+3−8
Cut short: this commit's diff is over 1000 lines.
internal/tui/tui_test.go+6−8
Cut short: this commit's diff is over 1000 lines.