ace-assign 0.73.3 → 0.73.5

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: 45be50d0b2c69c0fbd74f7bc18161dd3be7b65bde526fae3f68d23a409cb345a
4
- data.tar.gz: a2cb8e240e447a5776d32b2c94ecb8e049ce88b8380c301d8c1c3703aadcaa67
3
+ metadata.gz: af4b497476e8f0a2605d3d15b1c8cd7bcfb1bb69d0fd358ec157bc18e6e42d13
4
+ data.tar.gz: 992ebc5fadfc6b79bea229c2d07619805ea5198c96719c23d99fe3bd355e200a
5
5
  SHA512:
6
- metadata.gz: eed439377cd352ba27bd4cece400a9410d19d4be74980b5667b07fa1303f979f064fa52c529410c667602151a6a5fdcccd20b298120a4f7e01e70781eeadac97
7
- data.tar.gz: 8a32679865c9cf087d550d728d4d8bbdbbd8a25fbd49821568d28bb6606043a94a5dab8085a4dcb6b39822aa3fa9861d6f24268946001d2b0f1d668a0c7dccb0
6
+ metadata.gz: 3a559925ce7391c7dfba7465a8b2f845f441529f9826ed16aff1cf42aab8d123f4c0f82a60f07e53ff221208a189d563292824445d297ccf6285d285e0de8210
7
+ data.tar.gz: 13991011045924104f4452b16bc85bb098070e81f61d4589a2deba413ce9bea427d60073d40ce8509af0c78f26cfeb6757e785eab9346b6d998b89451fd17aee
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.73.5] - 2026-11-17
11
+
12
+ ### Fixed
13
+
14
+ - Managed-recovery eligibility (`QueueState#recovery_eligible?` and the `recovery` field of `ace-assign status --format json`) no longer requires every pending step to be a linked retry: a failed assignment with a pending linked retry stays recovery-eligible when every other pending step sorts strictly after the first pending linked retry in step-sequence order — downstream steps (e.g. a publish-approval gate) are legitimately gated behind the retried work and do not defeat recovery. Pending work that is not a linked retry — including an unlinked retry of a done step — sorting at or before the retry point still defeats eligibility, and failed history, active-step exclusion, and the required pending linked retry are unchanged. That step-sequence ordering uses the canonical `Atoms::StepSorter` numeric order — the same order the queue scanner establishes — so verbatim unpadded job.yaml numbers (e.g. `"10"`) compare correctly against padded retry numbers (e.g. `"040"`) instead of raw String ordering misclassifying earlier work as downstream.
15
+ - `QueueState#recovery_eligible?` and the `recovery` field of `ace-assign status --format json` no longer crash with `NoMethodError` when a pending step has no step number (operator-created unnumbered `*.st.md` strays scan in with `number: nil`; review finding 8yfzdwqm): unorderable steps are excluded from the retry-boundary comparison — they neither establish nor defeat eligibility, the first-retry anchor is chosen among numbered linked retries only, a failed assignment with a pending linked retry stays recovery-eligible with a stray present, and pending non-retry work at or before the retry point still defeats eligibility.
16
+
17
+ ## [0.73.4] - 2026-11-16
18
+
19
+ ### Fixed
20
+
21
+ - A terminal aggregate containing failed steps now reports the `failed` assignment state instead of `completed`, so an unsuccessful leg can never masquerade as a finished predecessor (terminal-failed assignments therefore reappear in `ace-assign list`, which hides completed work, and stay fail-closed non-prunable — `assignment still failed` — until recovered). Expose managed-recovery eligibility (failed state whose only pending steps are linked retries of failed steps — recovery is per-retry, so a second unresolved failure keeps the aggregate `failed` after one recovery run until it too is retried) through `QueueState#recovery_eligible?` and the `recovery` field of `ace-assign status --format json`; the compact status preview shows the failed history of a terminal failed aggregate. A recovered aggregate — every step terminal and every failed step holding a done linked retry — truthfully reports `completed` again (recovered-success exit; failed step rows stay failed), and `status --format json` steps now carry `added_by` for linkage verification. Under `status --scope`, the reported `state` and `recovery` reflect the scoped subtree (the endpoint's pre-existing scoped semantics). Retrying a retry is refused with the original step named, keeping retry linkage one-level by construction.
22
+
10
23
  ## [0.73.3] - 2026-11-12
11
24
 
12
25
  ### Fixed
data/docs/usage.md CHANGED
@@ -142,7 +142,9 @@ ace-assign add --yaml add-task.yml --after 010 --child
142
142
 
143
143
  ### `ace-assign retry STEP_REF`
144
144
 
145
- Retry a failed step by creating a new linked step.
145
+ Retry a failed step by creating a new linked step (a pending sibling linked by
146
+ `added_by: retry_of:NNN`; the failed original is preserved). Retrying a retry is
147
+ refused — retry the original step named in the error.
146
148
 
147
149
  ```bash
148
150
  ace-assign retry 040
@@ -192,6 +194,22 @@ ace-assign finish 020 --message report.md --assignment abc123
192
194
  Keep the failed step intact; add a retry or a fix step, then continue. Do not
193
195
  delete steps to hide a failure.
194
196
 
197
+ Aggregate states and managed recovery: a terminal aggregate containing failed
198
+ steps reports `failed`, never `completed` (so it also stays visible in `list`
199
+ and fail-closed non-prunable). Once a failed step has a pending linked retry
200
+ and every other pending step sorts strictly after the first pending linked
201
+ retry in step-sequence order (canonical `StepSorter` order), the assignment
202
+ is recovery-eligible (`status --format json` exposes `assignment.recovery`)
203
+ and the overseer may re-enter it as an explicit managed recovery on the SAME
204
+ assignment — downstream steps (e.g. a publish-approval gate) gated behind the
205
+ retried work do not defeat eligibility, while pending work that is not a
206
+ linked retry sorting at or before the retry point still does. When every
207
+ failed step holds a done linked retry, the aggregate reports `completed`
208
+ again (recovered success — the failed rows stay `failed` for history) and
209
+ `status --format json` steps carry `added_by` for linkage verification. Under
210
+ `--scope`, `state` and `recovery` reflect the scoped subtree, matching the
211
+ endpoint's scoped semantics.
212
+
195
213
  ### Multi-assignment management
196
214
 
197
215
  Use `ace-assign list --all` and `ace-assign select` to switch between open
@@ -58,7 +58,7 @@ module Ace
58
58
  fork_root = target.scope&.strip
59
59
  if fork_root && result[:state].subtree_complete?(fork_root)
60
60
  puts "Fork subtree #{fork_root} completed."
61
- elsif result[:state].complete?
61
+ elsif result[:state].assignment_state == :completed
62
62
  puts "Assignment completed! All steps done."
63
63
  else
64
64
  puts "No active step selected."
@@ -92,7 +92,8 @@ module Ace
92
92
  assignment: {
93
93
  id: assignment.id,
94
94
  name: assignment.name,
95
- state: state.assignment_state.to_s
95
+ state: state.assignment_state.to_s,
96
+ recovery: state.recovery_eligible?
96
97
  },
97
98
  steps: state.steps.map { |step| step_to_h(step) },
98
99
  active_steps: active_steps.map { |step| step_to_h(step, effective_fork_provider: effective_fork_provider_for(step, scoped_fork_metadata_step(state, step, target.scope, scope_root))) },
@@ -111,6 +112,7 @@ module Ace
111
112
  number: step.number,
112
113
  name: step.name,
113
114
  status: step.status.to_s,
115
+ added_by: step.added_by,
114
116
  skill: step.skill,
115
117
  workflow: step.workflow,
116
118
  context: step.context,
@@ -161,7 +163,7 @@ module Ace
161
163
  details << "Active: #{step_refs(active_steps)}"
162
164
  elsif next_step
163
165
  details << "Next: #{next_step.number} #{next_step.name}"
164
- elsif state.complete?
166
+ elsif state.assignment_state == :completed
165
167
  details << "Next: complete"
166
168
  end
167
169
 
@@ -277,7 +279,7 @@ module Ace
277
279
  effective_fork_provider = effective_fork_provider_for(view.next_step, scoped_fork_step)
278
280
  puts "Fork Provider: #{effective_fork_provider}" if effective_fork_provider
279
281
  print_scoped_fork_pid_info(scoped_fork_step)
280
- elsif view.scoped_state.complete?
282
+ elsif view.scoped_state.assignment_state == :completed
281
283
  puts
282
284
  puts "Assignment completed!"
283
285
  end
@@ -110,8 +110,14 @@ module Ace
110
110
  #
111
111
  # States (checked in priority order):
112
112
  # - :empty - No steps in queue
113
- # - :completed - All steps complete (done or failed)
114
- # - :failed - Has failed step(s) but NOT all complete (stuck)
113
+ # - :completed - Successful completion (all steps done), or a
114
+ # recovered success: every step terminal and every
115
+ # failed step has a done linked retry (the failed
116
+ # rows themselves stay failed for history)
117
+ # - :failed - Has failed step(s) not recovered by a done linked
118
+ # retry; failures are never summarized away, not
119
+ # even when every step has already reached a
120
+ # terminal status (an unsuccessful terminal state)
115
121
  # - :running - Has active step(s) with recent activity (< 1 hour)
116
122
  # - :stalled - Has active step(s) but all are stale (> 1 hour)
117
123
  # - :paused - Has pending but no active step (interrupted)
@@ -119,7 +125,7 @@ module Ace
119
125
  # @return [Symbol] Assignment state
120
126
  def assignment_state
121
127
  return :empty if empty?
122
- return :completed if complete?
128
+ return :completed if complete? && (failed.empty? || recovered?)
123
129
  return :failed if failed.any?
124
130
  return :running if active_steps.any? && recently_active?
125
131
  return :stalled if active_steps.any?
@@ -127,6 +133,75 @@ module Ace
127
133
  :paused
128
134
  end
129
135
 
136
+ # Truthful recovered-success verdict (aggregate level only): every
137
+ # step is terminal and every failed step has a done linked retry.
138
+ # The failed step rows keep their failed status — history is
139
+ # preserved; the aggregate reports that the failed work has a
140
+ # done outcome, so a recovered leg can leave the failed state
141
+ # through the normal lifecycle (handoff, outcome, discovery).
142
+ #
143
+ # @return [Boolean]
144
+ def recovered?
145
+ return false unless complete?
146
+
147
+ failed.all? { |step| recovered_failure?(step) }
148
+ end
149
+
150
+ # Whether the failed step has at least one done linked retry.
151
+ #
152
+ # @param step [Step] failed step
153
+ # @return [Boolean]
154
+ def recovered_failure?(step)
155
+ steps.any? { |other| other.retry? && other.status == :done && other.retry_of == step.number }
156
+ end
157
+
158
+ # Pending steps that are linked retries of failed steps.
159
+ #
160
+ # @return [Array<Step>] Pending linked retries in queue order
161
+ def pending_linked_retries
162
+ failed_numbers = failed.map(&:number)
163
+ pending.select { |step| step.retry? && failed_numbers.include?(step.retry_of) }
164
+ end
165
+
166
+ # Managed-recovery eligibility (read-only truth for explicit
167
+ # recovery selection by the overseer): the assignment reached an
168
+ # unsuccessful terminal state — failed steps, nothing active —
169
+ # and the owner recorded a pending linked retry of a failed step
170
+ # while every other pending step sorts strictly after the first
171
+ # pending linked retry in step-sequence order (canonical
172
+ # Atoms::StepSorter order — the same order the queue scanner
173
+ # establishes; downstream steps legitimately gated behind the
174
+ # retried work do not defeat recovery). Eligibility never
175
+ # reinterprets the aggregate: the failed history stays failed; the
176
+ # pending linked retry is the owner's explicit re-entry decision.
177
+ # Pending work that is not a linked retry — including an unlinked
178
+ # retry of a done step — sorting at or before the retry point means
179
+ # the queue is not simply "failed step retried, downstream waiting"
180
+ # and defeats eligibility.
181
+ #
182
+ # Unnumbered steps — operator-created stray files whose filenames
183
+ # carry no step number (StepFileParser -> number: nil) — are
184
+ # unorderable in step-sequence terms: they neither establish nor
185
+ # defeat eligibility and never crash the check; the retry boundary
186
+ # is decided among numbered steps only (review finding 8yfzdwqm).
187
+ #
188
+ # @return [Boolean]
189
+ def recovery_eligible?
190
+ return false if failed.empty?
191
+ return false if active_steps.any?
192
+
193
+ linked = pending_linked_retries
194
+ return false if linked.empty?
195
+
196
+ numbered_linked = linked.select { |step| step.number }
197
+ return false if numbered_linked.empty?
198
+
199
+ first_retry = numbered_linked.min_by { |step| Atoms::StepSorter.number_key(step.number) }
200
+ pending.reject { |step| linked.include?(step) }
201
+ .reject { |step| step.number.nil? }
202
+ .none? { |step| Atoms::StepSorter.compare(step.number, first_retry.number) <= 0 }
203
+ end
204
+
130
205
  # Check if any active step has recent activity.
131
206
  # @param threshold [Integer] Seconds since started_at to consider active (default: 1 hour)
132
207
  # @return [Boolean]
@@ -414,6 +414,15 @@ module Ace
414
414
  # Find the step to retry
415
415
  original = state.find_by_number(step_ref.to_s)
416
416
  raise StepErrors::NotFound, "Step #{step_ref} not found in queue" unless original
417
+ # Keep retry linkage one-level by construction: a retry of a
418
+ # retry would create transitive chains the managed-recovery
419
+ # linkage (and the recovered-success verdict) cannot see. The
420
+ # original failed step is the unit of failure — point the
421
+ # operator at it.
422
+ if original.retry?
423
+ raise StepErrors::InvalidState,
424
+ "Step #{original.number} is itself a retry of #{original.retry_of}; retry the original step #{original.retry_of} instead"
425
+ end
417
426
  validate_retry_scope!(state, original, fork_root)
418
427
 
419
428
  # Get existing numbers
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Assign
5
- VERSION = "0.73.3"
5
+ VERSION = "0.73.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-assign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.73.3
4
+ version: 0.73.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-12 00:00:00.000000000 Z
10
+ date: 2026-11-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ace-llm-providers-cli