ace-overseer 0.31.1 → 0.31.2

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: a7bd199f526cd282ebb59d712113fc4d5e3d85231f2bdc0dfc65d3b5a1400e63
4
- data.tar.gz: 671ee238f79bdb4469592b827b6ca89a535c29ebcb435a6bfd15beb294640167
3
+ metadata.gz: 750fbdb5210c418c427622133e9ec63417b0f23524e741a89b5b6660831171c5
4
+ data.tar.gz: b6d3ee6f1608460514d4553cb51389ddc4d90e455b74fde1d611a0e7b50c571e
5
5
  SHA512:
6
- metadata.gz: 9c94a54662c6a9fe25d44a1426c0a4fc8486f812b1e3f889aa2f82749bb5f17232d47b7819e4f3e7181aeede37d25b56b4111942a7fe26fc60a6a3bf1108b3f6
7
- data.tar.gz: b05613ed67ee5edc6c71fed92805e2e08131475be997f1c07d09a2d4a7709968a1fbe7ca185a76d4489777fab91a5be0cdf83be413e248eaf0e7ab7a68d5c28d
6
+ metadata.gz: 9c3d85cea79fd0b413f23fd7739b6be28555a41e5c81502bf35fb71a5e1064ec5ade6b17169d3da0ea3de192a4b270298792f342ab9d35111783f1fa35c822f9
7
+ data.tar.gz: a257b02d741809b4a10001089c993d032d154887d57798d40e1972e755dc5b5382a2564d1a56aee1edfd0da27f25b48020b62601e56dca9288dedf67d2fd1cf4
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.31.2] - 2026-11-15
11
+
12
+ ### Fixed
13
+
14
+ - Recover a refused executor launch through the same assignment after closing its exact orphan shell and confirming the OS session ended. Preserve uncertainty and existing session evidence.
15
+
10
16
  ## [0.31.1] - 2026-11-15
11
17
 
12
18
  ### Fixed
@@ -14,9 +14,11 @@ module Ace::Overseer::Molecules
14
14
  def initialize(executor: Ace::Herdr::Molecules::HerdrExecutor.new, env: ENV,
15
15
  environment: nil, bindings: Ace::Coworker::Molecules::ExecutionBinding.new,
16
16
  brief_factory: nil, readiness: nil, eyes: nil, root_resolver: nil,
17
+ process_identity: Ace::Runtime::Molecules::ProcessIdentity.new,
17
18
  identity_timeout: 10, clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }, sleeper: ->(seconds) { sleep(seconds) })
18
19
  @identity_timeout, @clock, @sleeper = identity_timeout, clock, sleeper
19
20
  @executor, @env, @bindings = executor, env, bindings
21
+ @process_identity = process_identity
20
22
  @environment = environment || SessionEnvironment.new(env: env)
21
23
  @brief_factory = brief_factory || ->(root, path) { Ace::Coworker::Organisms::StartOrchestrator.new(project_root: root).call(config_path: path) }
22
24
  @readiness = readiness || method(:check_eyes!)
@@ -59,10 +61,14 @@ module Ace::Overseer::Molecules
59
61
  unless %w[paused empty].include?(brief.assignment_snapshot&.state.to_s)
60
62
  raise Ace::Overseer::Error, "unconfirmed executor already has assignment activity"
61
63
  end
62
- recover_unprompted(execution, worktree_path, save)
63
- next submit_prompt(execution, brief, save)
64
+ if recover_unprompted(execution, worktree_path, save)
65
+ next submit_prompt(execution, brief, save)
66
+ end
67
+ document.delete("execution")
68
+ save.call
69
+ else
70
+ next reuse(execution, brief, worktree_path, save)
64
71
  end
65
- next reuse(execution, brief, worktree_path, save)
66
72
  end
67
73
  unless %w[paused empty].include?(brief.assignment_snapshot&.state.to_s)
68
74
  raise Ace::Overseer::Error, "unbound assignment is not ready for a new executor"
@@ -185,6 +191,66 @@ module Ace::Overseer::Molecules
185
191
  raw = row["agent_session"]
186
192
  execution["session_path"] = raw["value"] if raw.is_a?(Hash) && raw["kind"] == "path"
187
193
  save.call
194
+ true
195
+ rescue Ace::Herdr::AgentNotFoundError
196
+ retire_unstarted(execution, worktree_path, save)
197
+ false
198
+ end
199
+
200
+ # A refused launch can leave only an allocated shell. Close that exact
201
+ # native terminal before retrying the same assignment, so queued input
202
+ # cannot later start a second worker. Unknown/active evidence stays blocked.
203
+ def retire_unstarted(execution, worktree_path, save)
204
+ raise Ace::Overseer::Error, "started executor cannot be discarded" unless execution["state"] == "launching" && !execution["agent_session"]
205
+ directory = execution["credentials_directory"]
206
+ unless directory && File.directory?(directory) && !File.symlink?(directory) && Dir.glob(File.join(directory, "sessions", "**", "*.jsonl")).empty?
207
+ raise Ace::Overseer::Error, "unconfirmed launch has session evidence; inspect before retrying"
208
+ end
209
+ target = execution["unstarted_retirement"]
210
+ unless target
211
+ tabs = @executor.tab_list.parsed_json&.dig("result", "tabs")
212
+ panes = @executor.pane_list.parsed_json&.dig("result", "panes")
213
+ unless tabs.is_a?(Array) && panes.is_a?(Array) && (tabs + panes).all? { |row| row.is_a?(Hash) }
214
+ raise Ace::Overseer::Error, "unstarted executor inventory is unavailable"
215
+ end
216
+ matching_tabs = tabs.select { |row| row["label"] == execution["agent"] }
217
+ matching = matching_tabs.one? ? panes.select { |row| row["tab_id"] == matching_tabs.first["tab_id"] } : []
218
+ row = matching.one? && matching.first
219
+ unless row && row["cwd"] == worktree_path && row["pane_id"] && row["terminal_id"] && !row["agent"] && !row["agent_session"]
220
+ raise Ace::Overseer::Error, "unstarted executor shell is missing or ambiguous"
221
+ end
222
+ target = row.slice("pane_id", "terminal_id")
223
+ execution["unstarted_retirement"] = target
224
+ save.call
225
+ end
226
+ begin
227
+ row = pane_identity(target.fetch("pane_id"))
228
+ info = @executor.pane_process_info(target.fetch("pane_id")).parsed_json&.dig("result", "process_info")
229
+ unless row["terminal_id"] == target["terminal_id"] && row["cwd"] == worktree_path &&
230
+ !row["agent"] && !row["agent_session"] && shell_only?(info, target["pane_id"])
231
+ raise Ace::Overseer::Error, "unstarted executor terminal changed or is active"
232
+ end
233
+ identity = @process_identity.capture(info.fetch("shell_pid"))
234
+ unless identity && (!target["process_identity"] || target["process_identity"] == identity)
235
+ raise Ace::Overseer::Error, "unstarted executor process identity is unavailable or changed"
236
+ end
237
+ members = @process_identity.session_members(info.fetch("shell_pid"))
238
+ unless members.is_a?(Array) && members.include?(info.fetch("shell_pid"))
239
+ raise Ace::Overseer::Error, "unstarted executor OS session is unavailable"
240
+ end
241
+ target["process_identity"] = identity
242
+ save.call
243
+ @executor.pane_close(target.fetch("pane_id"))
244
+ pane_identity(target.fetch("pane_id"))
245
+ raise Ace::Overseer::Error, "unstarted executor closure is unconfirmed"
246
+ rescue Ace::Herdr::PaneNotFoundError
247
+ # The native owner confirms destruction of the recorded terminal.
248
+ end
249
+ unless @process_identity.generation_status(target["process_identity"])["liveness"] == "ended" &&
250
+ @process_identity.session_members(target.dig("process_identity", "pid")) == []
251
+ raise Ace::Overseer::Error, "unstarted executor process termination is unconfirmed"
252
+ end
253
+ SessionEnvironment.cleanup(directory)
188
254
  end
189
255
 
190
256
  def reuse(execution, brief, worktree_path, save)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Overseer
5
- VERSION = "0.31.1"
5
+ VERSION = "0.31.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-overseer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.1
4
+ version: 0.31.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
@@ -200,7 +200,7 @@ dependencies:
200
200
  version: '0.3'
201
201
  - - ">="
202
202
  - !ruby/object:Gem::Version
203
- version: 0.4.2
203
+ version: 0.4.3
204
204
  type: :runtime
205
205
  prerelease: false
206
206
  version_requirements: !ruby/object:Gem::Requirement
@@ -210,7 +210,7 @@ dependencies:
210
210
  version: '0.3'
211
211
  - - ">="
212
212
  - !ruby/object:Gem::Version
213
- version: 0.4.2
213
+ version: 0.4.3
214
214
  - !ruby/object:Gem::Dependency
215
215
  name: ace-tmux
216
216
  requirement: !ruby/object:Gem::Requirement