ace-overseer 0.31.4 → 0.31.6

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: 34e69489b6b9efe9e75ec3d31d871b36afab9faf0c65180927a40b8d243ddc1e
4
- data.tar.gz: 0e1a7f29c7bc2d8eff0016a687c9a418df0e56dd260e9f791b87b580cee49f06
3
+ metadata.gz: 9a2037c644ffceb3dd00b2bc9005058b1bea2cd3ebd8b328670b118734dbaece
4
+ data.tar.gz: 07a5131a4790b97c205b8914329b149d550289d0fc3aa42dfae9527d128083d0
5
5
  SHA512:
6
- metadata.gz: af91e3c0cdab68a66b9588557d7e92bd90e86aff2f431714bbaa8dfd9f453bb90f02354200dd456f8e334259a51452e21d104fc11051a08d151c8caf8c3e2ccf
7
- data.tar.gz: 8f3b5c6f1982cff1eff25d9347a8620dc8742e4526ffc3f3ec8eb237d1fd0f31dca5466b00adc67ae872109fa03df1a4a8d6e3460e080adaa48969084025eb25
6
+ metadata.gz: a749ab3af7095d31fcb9bb7271d9b42ebe540b620c45e462d0adf8d23d39abdba14628048f8df87e9b832bfd22781c99c3dd24edff577333eb84e5ab19bf7425
7
+ data.tar.gz: cf5767d19264a96a52b91ebb842e2f5c54a830706ebf9138fdfb93121b33b7c48863a30713c3361506d2604fc49f1e4f2c446564374bb5f3edcea79af41178b4
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.31.6] - 2026-11-26
11
+
12
+ ### Fixed
13
+
14
+ - Eyes readiness for binding-only sessions (ace-wake 0.6.0) is provable during an open turn. `work-on` and `process-reports` were refused with "delegation requires the coordinator's active eyes" whenever the coordinator evaluated them inside its own turn, because the checkpoint synthesized as the session's trailing eyes entry was held to the persisted-row rule (a completed assistant turn after the latest user message). The trailing checkpoint now proves live observation once the bound process completed a turn after its binding, by the ordinary freshness window (`observedAt` within cadence + timeoutMs of now) alone: no observation after the latest user message is required, because `ace_eyes status` and `work-on` never acquire one. A session whose only turn is still open, an assistant `error`, a dead runner, degraded sources or stale evidence still fails closed, and legacy persisted rows keep the completed-turn rule.
15
+
16
+ ## [0.31.5] - 2026-11-17
17
+
18
+ ### Changed
19
+
20
+ - Read Eyes readiness from the canonical ace-watch actor checkpoint and verify its live runner and Pi binding. Retain read compatibility for existing Pi sessions until host cutover; an invalid new binding never falls back to stale session evidence.
21
+
10
22
  ## [0.31.4] - 2026-11-17
11
23
 
12
24
  ### Fixed
data/docs/usage.md CHANGED
@@ -594,3 +594,25 @@ Foreground bootstrap pins the two built-in start guides to their packaged
594
594
  files. An explicit custom instruction source remains configurable; missing
595
595
  files block before launching Pi. Project development dependencies do not select
596
596
  the operational runtime when installed mode is chosen.
597
+
598
+ ## CLI-owned Eyes state
599
+
600
+ With ace-wake 0.6.0, ace-watch owns the actor checkpoint; Pi stores only a
601
+ binding to that state. Readiness verifies the live runner, current Pi process,
602
+ private state path and healthy source evidence, and reads the checkpoint as the
603
+ session's trailing eyes entry. The bound process proves initialization with one
604
+ completed assistant turn after its binding; during a later open turn (a new
605
+ commission, then the tool call that runs `work-on`) the checkpoint's current
606
+ observation proves live eyes by the ordinary freshness window alone (`observedAt`
607
+ within cadence + timeoutMs of now). No observation after the latest user
608
+ message is required, because `ace_eyes status` and `work-on` never acquire one,
609
+ so a user turn arriving just after a scheduled observation delegates on the
610
+ first attempt. A session whose only turn is still open, an assistant `error`, a
611
+ dead runner, degraded sources or stale evidence still fails closed. Legacy
612
+ sessions remain readable until explicit host cutover; their persisted eyes rows
613
+ keep the completed-turn rule, and an invalid new binding never falls back to
614
+ old healthy snapshots.
615
+
616
+ Humans and any agent can use ace-watch --actor NAME eyes status/observe, exact
617
+ revision ACK, report processing and resume without starting Pi or a model.
618
+ See ace-wake/README.md and docs/lab-flow.md for the shared owner contract.
@@ -12,7 +12,11 @@ module Ace
12
12
  BINDING = "ace-wake-eyes-binding"
13
13
  BIRTH = /\A(?:linux:[0-9a-f-]{36}:[1-9][0-9]*|darwin:[1-9][0-9]*:[0-9]{1,6})\z/
14
14
 
15
- def self.ready?(branch:, root:, process:, prompt:, required_sources:, now_ms:, expected_config: nil)
15
+ # `checkpoint_entry:` marks the trailing eyes entry as the wake owner's
16
+ # live checkpoint synthesized for this evaluation (binding-only
17
+ # adapters persist no eyes rows) rather than a persisted session row.
18
+ def self.ready?(branch:, root:, process:, prompt:, required_sources:, now_ms:, expected_config: nil,
19
+ checkpoint_entry: false)
16
20
  return false unless branch.is_a?(Array) && root.is_a?(String) && process.is_a?(Hash) &&
17
21
  prompt.is_a?(String) && !prompt.empty? && required_sources.is_a?(Array) &&
18
22
  !required_sources.empty? && required_sources.all? { |name| name.is_a?(String) && !name.empty? } &&
@@ -35,6 +39,12 @@ module Ace
35
39
  # itself: it requires a subsequent completed assistant turn plus a
36
40
  # binding-known healthy snapshot (recovery semantics below). An
37
41
  # assistant error during initialization still fails closed.
42
+ # A persisted eyes row proves observation only through that rule.
43
+ # The live checkpoint additionally proves it during an open turn:
44
+ # once the bound process completed a turn after its binding, its
45
+ # current fresh healthy observation needs no completed turn after
46
+ # the latest user message (`ace_eyes status` and work-on never
47
+ # acquire one), only the ordinary cadence + timeoutMs window.
38
48
  prefix = branch[0...eye_index]
39
49
  prompt_index = prefix.rindex do |entry|
40
50
  message = entry.is_a?(Hash) && entry["type"] == "message" ? entry["message"] : nil
@@ -53,22 +63,25 @@ module Ace
53
63
  required_sources: required_sources, now_ms: now_ms, prompt_at: prompt_at, fresh: true)
54
64
 
55
65
  complete = false
66
+ initialized = false
56
67
  known_bindings = {}
57
68
  branch[0..prompt_index].each do |entry|
58
69
  data = entry.is_a?(Hash) && entry["type"] == "custom" && entry["customType"] == BINDING && entry["data"]
59
70
  known_bindings[data["process"]] = true if data.is_a?(Hash) && data["ownerCwd"] == root && data["process"].is_a?(Hash)
60
71
  end
61
- branch[(prompt_index + 1)..eye_index].each do |entry|
72
+ ((prompt_index + 1)..eye_index).each do |index|
73
+ entry = branch[index]
62
74
  data = entry.is_a?(Hash) && entry["type"] == "custom" && entry["customType"] == BINDING && entry["data"]
63
75
  known_bindings[data["process"]] = true if data.is_a?(Hash) && data["ownerCwd"] == root && data["process"].is_a?(Hash)
64
76
  prior_identity = entry.is_a?(Hash) && entry.dig("data", "observerEvidence", "process")
65
77
  prior_binding = prior_identity.is_a?(Hash) && prior_identity["pid"].is_a?(Integer) &&
66
78
  prior_identity["pid"].positive? && prior_identity["startedAt"].is_a?(String) &&
67
79
  prior_identity["startedAt"].match?(BIRTH) && known_bindings[prior_identity]
68
- if complete && prior_binding && snapshot_healthy?(entry, root: root, identity: prior_identity,
80
+ # The current binding was found in the prefix before the last
81
+ # snapshot; initial proof may precede a process restart.
82
+ proved = complete || (index == eye_index && checkpoint_entry && initialized)
83
+ if proved && prior_binding && snapshot_healthy?(entry, root: root, identity: prior_identity,
69
84
  required_sources: required_sources, now_ms: now_ms, prompt_at: prompt_at, fresh: false)
70
- # The current binding was found in the prefix before the last
71
- # snapshot; initial proof may precede a process restart.
72
85
  return true
73
86
  end
74
87
  message = entry.is_a?(Hash) && entry["type"] == "message" ? entry["message"] : nil
@@ -85,6 +98,9 @@ module Ace
85
98
  next unless message["role"] == "assistant"
86
99
  if message["stopReason"] == "stop"
87
100
  complete = true
101
+ # Initialization is a completed turn of the currently bound
102
+ # process; a turn that preceded its binding proves nothing.
103
+ initialized = true if index > binding_index
88
104
  next
89
105
  end
90
106
  return false unless message["stopReason"] == "toolUse"
@@ -61,18 +61,23 @@ module Ace
61
61
  [stat.dev, stat.ino, stat.size, stat.mtime] == [again.dev, again.ino, again.size, again.mtime]
62
62
  return false unless header["cwd"] == root && header["id"].to_s.downcase == before.fetch("session_id").downcase
63
63
 
64
+ branch, checkpoint = core_branch(branch, root, stat.uid)
65
+
64
66
  eye = branch.reverse.find { |entry| entry["type"] == "custom" && entry["customType"] == EyesEvidence::ENTRY }
65
67
  pid = eye&.dig("data", "observerEvidence", "process", "pid")
66
68
  return false unless pid.is_a?(Integer) && pid.positive? && foreground?(executor, pane, pid)
67
69
  process = @identity.capture(pid)
68
70
  return false unless process && process["uid"] == stat.uid
71
+ # The trailing eyes entry of a binding-only session is the wake
72
+ # owner's live checkpoint, never a row persisted by an earlier turn.
69
73
  return false unless EyesEvidence.ready?(branch: branch, root: root, process: process,
70
- prompt: prompt, required_sources: required_sources, expected_config: expected_config, now_ms: @clock.call)
74
+ prompt: prompt, required_sources: required_sources, expected_config: expected_config, now_ms: @clock.call,
75
+ checkpoint_entry: !checkpoint.nil?)
71
76
  # The owner or its session may change while the file is read.
72
77
  return false unless @identity.capture(pid) == process && foreground?(executor, pane, pid) && pane_binding(executor, pane) == before
73
78
  final = file.stat
74
79
  named = File.lstat(path)
75
- named.file? && !named.symlink? &&
80
+ (!checkpoint || checkpoint.call) && named.file? && !named.symlink? &&
76
81
  [stat.dev, stat.ino, stat.size, stat.mtime] == [final.dev, final.ino, final.size, final.mtime] &&
77
82
  [stat.dev, stat.ino] == [named.dev, named.ino]
78
83
  rescue Ace::Herdr::ExecutorError, SystemCallError, IOError, JSON::ParserError, ArgumentError, TypeError, KeyError
@@ -83,6 +88,62 @@ module Ace
83
88
 
84
89
  private
85
90
 
91
+ # New adapters persist a binding only. Read the wake owner's current
92
+ # checkpoint for readiness; never keep a second mutable session snapshot.
93
+ # Legacy sessions remain readable until their host-controlled cutover.
94
+ # Returns [branch, checkpoint]: nil for a legacy session, otherwise the
95
+ # guard proving the synthesized trailing entry is still current.
96
+ def core_branch(branch, root, uid)
97
+ entry = branch.reverse.find { |row| row["customType"] == EyesEvidence::BINDING }
98
+ binding = entry&.fetch("data", nil)
99
+ return [branch, nil] unless entry
100
+ raise ArgumentError, "invalid wake binding" unless binding.is_a?(Hash)
101
+ return [branch, nil] unless %w[statePath actor target].any? { |key| binding.key?(key) }
102
+
103
+ actor = binding.fetch("actor")
104
+ raise ArgumentError, "invalid actor binding" unless actor.is_a?(String) && actor.match?(/\A[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}\z/)
105
+ expected = File.join(root, ".ace-local/wake", actor, "state.json")
106
+ raise ArgumentError, "foreign actor state" unless binding["ownerCwd"] == root && binding["statePath"] == expected
107
+ %W[#{root}/.ace-local/wake #{root}/.ace-local/wake/#{actor}].each do |directory|
108
+ st = File.lstat(directory)
109
+ raise ArgumentError, "unsafe actor directory" unless st.directory? && !st.symlink? && st.uid == uid && (st.mode & 0o077).zero?
110
+ end
111
+ state, stat = File.open(expected, File::RDONLY | File::NOFOLLOW | File::NONBLOCK) do |file|
112
+ st = file.stat
113
+ raise ArgumentError, "unsafe actor state" unless st.file? && st.uid == uid && (st.mode & 0o077).zero? && st.size <= 16 * 1024 * 1024
114
+ [JSON.parse(file.read, max_nesting: 64, allow_duplicate_key: false), st]
115
+ end
116
+ raise ArgumentError, "actor owner mismatch" unless state.is_a?(Hash) && state["schema"] == "ace.wake.actor/v1" && state["actor"] == actor && state["cwd"] == root
117
+ raise ArgumentError, "invalid actor checkpoints" unless %w[targets runner observerEvidence eyes].all? { |key| state[key].is_a?(Hash) }
118
+ target = state.fetch("targets").fetch(binding.fetch("target"))
119
+ raise ArgumentError, "invalid delivery target" unless target.is_a?(Hash) && target["process"].is_a?(Hash)
120
+ identity = target.fetch("process")
121
+ raise ArgumentError, "adapter process mismatch" unless binding["process"] == {"pid" => identity["pid"], "startedAt" => identity["started_at"]}
122
+ runner = state.fetch("runner")
123
+ raise ArgumentError, "wake runner is not live" unless same_runner?(runner, uid)
124
+ evidence = state.fetch("observerEvidence")
125
+ raise ArgumentError, "invalid source health" unless evidence["sources"].is_a?(Hash) && evidence["sources"].values.all? { |value| value.is_a?(Hash) }
126
+ sources = evidence.fetch("sources").transform_values { |source| source.fetch("status") }
127
+ data = state.fetch("eyes").slice("enabled", "retired", "breaker", "errors", "config")
128
+ data["ownerCwd"] = root
129
+ data["observerEvidence"] = {"process" => binding.fetch("process"),
130
+ "observedAt" => evidence.fetch("observedAt"), "sources" => sources}
131
+ snapshot = {"type" => "custom", "customType" => EyesEvidence::ENTRY, "data" => data}
132
+ still_current = lambda do
133
+ current = File.lstat(expected)
134
+ current.file? && !current.symlink? &&
135
+ [current.dev, current.ino, current.size, current.mtime] == [stat.dev, stat.ino, stat.size, stat.mtime] &&
136
+ same_runner?(runner, uid)
137
+ end
138
+ [branch + [snapshot], still_current]
139
+ end
140
+
141
+ def same_runner?(runner, uid)
142
+ captured = @identity.capture(runner.fetch("pid"))
143
+ captured && captured["uid"] == uid &&
144
+ captured.slice("pid", "uid", "started_at") == runner.slice("pid", "uid", "started_at")
145
+ end
146
+
86
147
  def pane_binding(executor, pane)
87
148
  json = executor.pane_get(pane).parsed_json
88
149
  row = json.is_a?(Hash) && json["result"].is_a?(Hash) ? json["result"]["pane"] : nil
@@ -128,7 +189,7 @@ module Ace
128
189
  result["message"]["content"] = prompt if matched
129
190
  elsif entry["type"] == "custom" && entry["data"].is_a?(Hash)
130
191
  keys = case entry["customType"]
131
- when EyesEvidence::BINDING then %w[ownerCwd process]
192
+ when EyesEvidence::BINDING then %w[ownerCwd process actor statePath target]
132
193
  when EyesEvidence::ENTRY then %w[ownerCwd enabled retired breaker errors config observerEvidence]
133
194
  else []
134
195
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Overseer
5
- VERSION = "0.31.4"
5
+ VERSION = "0.31.6"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-overseer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.4
4
+ version: 0.31.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-17 00:00:00.000000000 Z
10
+ date: 2026-11-26 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ace-support-cli