ace-llm-providers-cli 0.36.1 → 0.36.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9149be64f8f384f5636b393bfa3cf12f81aa9488e486225ed2966c731ef2a0f
4
- data.tar.gz: 1fe4000a4a8000d49e04796a2eee4030b588cc3ef06babb2080b2e7feb66dedf
3
+ metadata.gz: 4733c90d061027e704b596ac1ac9f3caab0d9288d751b1ce2ff4325d5d6eb1a8
4
+ data.tar.gz: 0b78287affb5166f6c147de66f11c69d1fb73723122204dff8c3570539a60664
5
5
  SHA512:
6
- metadata.gz: 7fc14db03c5a90eae90ec8855bb7bd801d5a75c5174488335b1201bd10d767c4f202eb192008b6a932c3c717e4913df2ae2cdd8650a16ebfd1921d3d50b57687
7
- data.tar.gz: 1f2b33eb5461854fb293d583eebf87d723c0aa2ecd560995a6b05e56f00da0ba8570fedcd9531c853ccd24b055f64129721961d87988fd599378734c18507eca
6
+ metadata.gz: b3e91d89aae045a8e2c41268fc5b55969ca7bfeb9d4fa2f9dd1ef0acfa4631ae3d4427206f878942fa4a10476b1b3afc5eaaa024134b542d6fa2a1dbbf6b4a0a
7
+ data.tar.gz: 80553056699ad4df1fcd1bd41e13df629b29e1a16a571cf499273089d1d48e8d81dd994b09520d38ce60fa391612f89e7097cc6c4b818560a179f7f956cd5677
data/CHANGELOG.md CHANGED
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.36.3] - 2026-11-10
11
+
12
+ ### Fixed
13
+
14
+ - Send Pi prompts through stdin instead of process arguments; drain streams while writing input and retain timeout/no-response evidence.
15
+
16
+ ## [0.36.2] - 2026-10-16
17
+
18
+ ### Fixed
19
+
20
+ - Terminate coding-agent subprocess groups when a caller interrupts a capture, before Open3 waits for the child.
21
+
22
+ - `SafeCapture`: repair the `readiness.nil.` typo (missing `?`) introduced in
23
+ 0.36.0 that raised `NoMethodError` on every successful supervised CLI
24
+ capture before any model call, breaking all CLI-delegating providers
25
+ (codex, agy, claude, pi). Regression tests pin readiness semantics
26
+ (String/nil/unsupervised); signal-classification tests now exercise an
27
+ unsupervised direct child, since the Linux supervisor converts child
28
+ signals to exit status by design.
29
+
10
30
  ## [0.36.1] - 2026-10-01
11
31
 
12
32
  ### Technical
@@ -97,7 +97,7 @@ module Ace
97
97
  # StandardError describing a supervisor-reported child spawn
98
98
  # failure, or nil when the child group started normally.
99
99
  def child_spawn_failure
100
- return nil if supervised != true || readiness.nil.
100
+ return nil if supervised != true || readiness.nil?
101
101
 
102
102
  message = readiness.to_s
103
103
  return nil unless message.start_with?("S")
@@ -145,19 +145,19 @@ module Ace
145
145
  pgid = safe_getpgid(pid)
146
146
  debug_log(provider_name, "spawn pid=#{pid} pgid=#{pgid || "n/a"} invocation=#{invocation_id}")
147
147
 
148
- begin
149
- stdin.write(stdin_data) if stdin_data
150
- rescue Errno::EPIPE
151
- # Subprocess exited before consuming stdin — continue to capture stderr for the real error
152
- end
153
- stdin.close
154
-
155
148
  partial_stdout = +""
156
149
  partial_stderr = +""
157
150
  out_reader = Thread.new { safe_read_stream(stdout, partial_stdout) }
158
151
  err_reader = Thread.new { safe_read_stream(stderr, partial_stderr) }
159
152
  out_reader.report_on_exception = false
160
153
  err_reader.report_on_exception = false
154
+ input_writer = Thread.new do
155
+ stdin.write(stdin_data) if stdin_data
156
+ rescue Errno::EPIPE, IOError
157
+ # The child exited or capture closed its input during cleanup.
158
+ ensure
159
+ stdin.close unless stdin.closed?
160
+ end
161
161
 
162
162
  unless wait_thr.join(normalized_timeout)
163
163
  # Deadline exceeded: kill subprocess group (and descendants), retain partial streams
@@ -203,6 +203,22 @@ module Ace
203
203
  deadline_seconds: normalized_timeout,
204
204
  elapsed_seconds: elapsed_since(started_at)
205
205
  )
206
+ ensure
207
+ # A caller may cancel a worker thread while it waits on a coding
208
+ # agent. Clean up before Open3's block unwinds (which otherwise
209
+ # waits for the still-running child). The capture boundary owns
210
+ # the process group, so consumers must not duplicate this policy.
211
+ if pid && (wait_thr.alive? || $!)
212
+ terminate_subprocess_tree(
213
+ pid: pid, pgid: pgid, provider_name: provider_name, supervised: spawn_result.supervised?
214
+ )
215
+ unless wait_thr.join(5)
216
+ terminate_group_or_pid("KILL", pid, pgid)
217
+ wait_thr.join(5)
218
+ end
219
+ end
220
+ [stdin, stdout, stderr].each { |stream| stream.close unless stream.closed? }
221
+ [input_writer, out_reader, err_reader].compact.each { |thread| thread.join(1) }
206
222
  end
207
223
  end
208
224
 
@@ -296,7 +312,7 @@ module Ace
296
312
  end
297
313
 
298
314
  def terminate_subprocess_tree(pid:, pgid:, provider_name:, supervised: false)
299
- debug_log(provider_name, "timeout cleanup pid=#{pid} pgid=#{pgid || "n/a"}")
315
+ debug_log(provider_name, "capture cleanup pid=#{pid} pgid=#{pgid || "n/a"}")
300
316
  terminate_group_or_pid("TERM", pid, pgid)
301
317
  terminate_group_or_pid("KILL", pid, pgid) unless supervised
302
318
  end
@@ -56,8 +56,8 @@ module Ace
56
56
  )
57
57
  full_prompt = rewrite_skill_commands(full_prompt, working_dir: working_dir)
58
58
 
59
- cmd = build_pi_command(full_prompt, options, system_prompt: system_prompt)
60
- capture = execute_pi_command(cmd, working_dir: working_dir, options: options)
59
+ cmd = build_pi_command(options, system_prompt: system_prompt)
60
+ capture = execute_pi_command(cmd, stdin_data: full_prompt, working_dir: working_dir, options: options)
61
61
  begin
62
62
  capture.raise_unless_success
63
63
  rescue Ace::LLM::ProviderError
@@ -181,15 +181,14 @@ module Ace
181
181
 
182
182
  # Build the pi command array
183
183
  #
184
- # @param full_prompt [String] The complete prompt
185
184
  # @param options [Hash] Generation options
186
185
  # @param system_prompt [String, nil] System prompt for --system-prompt flag
187
186
  # @return [Array<String>] Command array
188
- def build_pi_command(full_prompt, options, system_prompt: nil)
187
+ def build_pi_command(options, system_prompt: nil)
189
188
  cmd = ["pi"]
190
189
 
191
190
  # Print mode (non-interactive, one-shot)
192
- cmd << "-p" << full_prompt.to_s
191
+ cmd << "-p"
193
192
 
194
193
  # No session (stateless)
195
194
  cmd << "--no-session"
@@ -273,12 +272,12 @@ module Ace
273
272
  [parts[0], parts[1]]
274
273
  end
275
274
 
276
- def execute_pi_command(cmd, timeout: nil, working_dir: nil, options: {})
275
+ def execute_pi_command(cmd, stdin_data:, timeout: nil, working_dir: nil, options: {})
277
276
  timeout_val = timeout || @options[:timeout] || 120
278
277
  Molecules::SafeCapture.call(
279
278
  cmd,
280
279
  timeout: timeout_val,
281
- stdin_data: "",
280
+ stdin_data: stdin_data,
282
281
  chdir: working_dir,
283
282
  env: options[:subprocess_env],
284
283
  command_prefix: options[:subprocess_command_prefix],
@@ -310,13 +309,10 @@ module Ace
310
309
  raise capture.provider_error("Pi CLI failed: #{error_msg}")
311
310
  end
312
311
 
313
- text, usage, finish_reason = parse_ndjson(capture.stdout)
314
- if text.to_s.strip.empty?
315
- # Clean exit without a final response: an incomplete session,
316
- # not a completed answer.
317
- raise capture.with_no_response_evidence(
318
- Ace::LLM::ProviderError.new("Pi CLI produced no final message")
319
- )
312
+ begin
313
+ text, usage, finish_reason = parse_ndjson(capture.stdout)
314
+ rescue Ace::LLM::ProviderError => error
315
+ raise capture.with_no_response_evidence(error)
320
316
  end
321
317
  response = {"usage" => normalize_usage(usage), "finish_reason" => finish_reason}
322
318
 
@@ -4,7 +4,7 @@ module Ace
4
4
  module LLM
5
5
  module Providers
6
6
  module CLI
7
- VERSION = "0.36.1"
7
+ VERSION = "0.36.3"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-llm-providers-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.1
4
+ version: 0.36.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-10-01 00:00:00.000000000 Z
10
+ date: 2026-11-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ace-llm