diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-17 11:28:19 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-17 11:28:19 +0200 |
| commit | 6f1c8bf7a36eb7044ed7aad30f84664cbbf0d303 (patch) | |
| tree | dd2ac6e1433177fb59c167a12fa0b4b91132f34a /internal/lsp/llm_client_registry.go | |
| parent | 10562cc510f64d5ac38aeb76f03e18eb76cca40f (diff) | |
Fix bugs, remove duplication, and clean up code quality issues
- Log swallowed JSON unmarshal errors in stats and LSP handlers
- Fix debug log file handle leak in tmuxedit (return closer from initDebugLog)
- Check f.Close() errors on write paths in promptstore and tmuxedit
- Fix cacheGet TOCTOU race by using single write lock
- Fix readInput to use passed stdin reader instead of os.Stdin.Stat()
- Remove 45 'moved to' comment tombstones from lsp/handlers.go
- Deduplicate canonicalProvider wrappers (use llmutils.CanonicalProvider directly)
- Remove SetWindow side effect from stats.TakeSnapshot (pure read now)
- Move duplicated splitLines to textutil.SplitLinesBytes
- Collapse StatusSink.SetGlobal 10 params into GlobalStatus struct
- Simplify LRU touchLocked to in-place delete-and-append
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'internal/lsp/llm_client_registry.go')
| -rw-r--r-- | internal/lsp/llm_client_registry.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/lsp/llm_client_registry.go b/internal/lsp/llm_client_registry.go index 53fa25f..6b9c722 100644 --- a/internal/lsp/llm_client_registry.go +++ b/internal/lsp/llm_client_registry.go @@ -6,6 +6,7 @@ import ( "codeberg.org/snonux/hexai/internal/appconfig" "codeberg.org/snonux/hexai/internal/llm" + "codeberg.org/snonux/hexai/internal/llmutils" "codeberg.org/snonux/hexai/internal/logging" ) @@ -25,9 +26,9 @@ func newLLMClientRegistry() llmClientRegistry { } func (r *llmClientRegistry) applyOptions(client llm.Client, configuredProvider string) { - provider := canonicalProvider(configuredProvider) + provider := llmutils.CanonicalProvider(configuredProvider) if client != nil { - if name := canonicalProvider(client.Name()); name != "" { + if name := llmutils.CanonicalProvider(client.Name()); name != "" { provider = name } } @@ -45,13 +46,13 @@ func (r *llmClientRegistry) current() llm.Client { } func (r *llmClientRegistry) clientFor(spec requestSpec, cfg appconfig.App, build llmClientBuilder) llm.Client { - provider := canonicalProvider(spec.provider) + provider := llmutils.CanonicalProvider(spec.provider) r.clientsMu.RLock() baseProvider := r.llmProvider baseClient := r.llmClient if baseClient != nil && strings.TrimSpace(baseProvider) == "" { - baseProvider = canonicalProvider(baseClient.Name()) + baseProvider = llmutils.CanonicalProvider(baseClient.Name()) } if provider == "" { provider = baseProvider |
