lex-llm 0.6.13 → 0.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/legion/extensions/llm/connection.rb +7 -0
- data/lib/legion/extensions/llm/provider.rb +5 -0
- data/lib/legion/extensions/llm/version.rb +1 -1
- data/spec/legion/extensions/llm/connection_close_spec.rb +50 -0
- data/spec/legion/extensions/llm/provider_spec.rb +25 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b28d2162e2284642dcbb0e39384957962b8b609aa982c2dc1c085f84f560243f
|
|
4
|
+
data.tar.gz: a68c5e7d429b6ba04c2f431a4140d44c93542993430fe5b36e921347b1d9a728
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a76155cd1c0b1ac8952647afff1ed38728bdb130a241ec4b416b752fd19c07074db18cf787c9dca6f2e4ffe1afe3be144800093837add92311e68a63219593b
|
|
7
|
+
data.tar.gz: 9eeadc0a087bb111ccaaea7feffc55aae57b44a0f60f331b3f7e0b7a43ed75737b70338319b6d1b8aa62de668a41b04b605444a9989e7776b2d315debd59ca38
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.14 - 2026-07-31
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **Connection#close tears down the underlying Faraday connection.** Previously `Connection` had no lifecycle method — persistent HTTP connections were never explicitly closed, causing CLOSE_WAIT socket accumulation when provider peers sent FIN (e.g. during daemon shutdown or provider restarts)
|
|
7
|
+
- **Provider#disconnect closes the connection and clears the reference.** Callers (legion-llm registry shutdown) can now explicitly tear down provider connections during graceful shutdown
|
|
8
|
+
|
|
3
9
|
## 0.6.13 - 2026-07-24
|
|
4
10
|
|
|
5
11
|
### Fixed
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Legion::Extensions::Llm::Connection do
|
|
6
|
+
describe '#close' do
|
|
7
|
+
let(:provider) do
|
|
8
|
+
instance_double(
|
|
9
|
+
Legion::Extensions::Llm::Provider,
|
|
10
|
+
api_base: 'https://example.com',
|
|
11
|
+
configured?: true,
|
|
12
|
+
headers: {}
|
|
13
|
+
)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
let(:config) do
|
|
17
|
+
instance_double(
|
|
18
|
+
Legion::Extensions::Llm::Configuration,
|
|
19
|
+
request_timeout: 300,
|
|
20
|
+
max_retries: 3,
|
|
21
|
+
retry_interval: 0.1,
|
|
22
|
+
retry_interval_randomness: 0.5,
|
|
23
|
+
retry_backoff_factor: 2,
|
|
24
|
+
http_proxy: nil,
|
|
25
|
+
log_regexp_timeout: nil
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'nils out the underlying Faraday connection' do
|
|
30
|
+
conn = described_class.new(provider, config)
|
|
31
|
+
expect(conn.connection).not_to be_nil
|
|
32
|
+
conn.close
|
|
33
|
+
expect(conn.connection).to be_nil
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'is safe to call multiple times' do
|
|
37
|
+
conn = described_class.new(provider, config)
|
|
38
|
+
conn.close
|
|
39
|
+
expect { conn.close }.not_to raise_error
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'calls close on the Faraday connection when supported' do
|
|
43
|
+
conn = described_class.new(provider, config)
|
|
44
|
+
faraday = conn.connection
|
|
45
|
+
allow(faraday).to receive(:close)
|
|
46
|
+
conn.close
|
|
47
|
+
expect(faraday).to have_received(:close)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -717,4 +717,29 @@ RSpec.describe Legion::Extensions::Llm::Provider do
|
|
|
717
717
|
expect(key_v3).to include('schema3')
|
|
718
718
|
end
|
|
719
719
|
end
|
|
720
|
+
|
|
721
|
+
describe '#disconnect' do
|
|
722
|
+
let(:provider_class) do
|
|
723
|
+
Class.new(described_class) do
|
|
724
|
+
def api_base = 'https://test.invalid'
|
|
725
|
+
end
|
|
726
|
+
end
|
|
727
|
+
|
|
728
|
+
let(:provider) do
|
|
729
|
+
provider_class.new({ request_timeout: 60, max_retries: 0,
|
|
730
|
+
retry_interval: 0, retry_backoff_factor: 0,
|
|
731
|
+
retry_interval_randomness: 0 })
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
it 'closes the connection and nils the reference' do
|
|
735
|
+
expect(provider.connection).not_to be_nil
|
|
736
|
+
provider.disconnect
|
|
737
|
+
expect(provider.connection).to be_nil
|
|
738
|
+
end
|
|
739
|
+
|
|
740
|
+
it 'is safe to call multiple times' do
|
|
741
|
+
provider.disconnect
|
|
742
|
+
expect { provider.disconnect }.not_to raise_error
|
|
743
|
+
end
|
|
744
|
+
end
|
|
720
745
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-llm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- LegionIO
|
|
@@ -395,6 +395,7 @@ files:
|
|
|
395
395
|
- spec/legion/extensions/llm/conformance/fixtures/canonical_tools_request.json
|
|
396
396
|
- spec/legion/extensions/llm/conformance/provider_tool_rendering_examples.rb
|
|
397
397
|
- spec/legion/extensions/llm/conformance/provider_translator_examples.rb
|
|
398
|
+
- spec/legion/extensions/llm/connection_close_spec.rb
|
|
398
399
|
- spec/legion/extensions/llm/connection_logging_spec.rb
|
|
399
400
|
- spec/legion/extensions/llm/connection_retry_spec.rb
|
|
400
401
|
- spec/legion/extensions/llm/context_spec.rb
|