ace-overseer 0.31.3 → 0.31.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: 872eb06e332d582a4bbbed22da951b8d59dc850d92c31dd7dc45889118a77baa
4
- data.tar.gz: 0da0a500821be6201f7d3f125dd5f4388e7359e6e02108643712a35b8ac01062
3
+ metadata.gz: d3a56abb156f1d4c2c0a8d3342637b515514de934ded1057f4891ed50deb8dfa
4
+ data.tar.gz: be1e80207d1402fe0008b7b574344b25e17b4d55fb7c259cf2f1c3d1b3aa5ed4
5
5
  SHA512:
6
- metadata.gz: 60e7d3c0051d3f22a0f96a1acafaf9bfe180a0dcd5cf51eeecd7361cc1772c830650077dcbfa8475bf9a121a277f7d5319d65246ff011866e4979d5fe48cd0df
7
- data.tar.gz: 5f630cff41890f4ac02b81e5e5ed36bb828b833d4dd7f98704062868365f603e957e58a0fc9c0d081756d5b8da8047a3a31e87052e6c80cedc80ecdd3ba7f1af
6
+ metadata.gz: 2756e928c3d58a0f56eab504ce468f45543252c75aac72e627d7abe08e4f303dbcff3bb13d85324f8522f54098857226f5b51c225cd8e24684f36a5bfb57e3d2
7
+ data.tar.gz: 17adfc899350ed9132bba358c7258d1f7db117468435165dae76b54411b6de758b8a0c371371be677011c92dcf147b60dfc085e67a5e00204ec57958fa39d18a
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.5] - 2026-11-17
11
+
12
+ ### Changed
13
+
14
+ - 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.
15
+
16
+ ## [0.31.4] - 2026-11-17
17
+
18
+ ### Fixed
19
+
20
+ - Eyes readiness no longer permanently refuses a coordinator session when a wake (or any queued user turn) is injected before the first assistant completion: the branch scan continues past an intervening user turn and readiness then requires a later completed assistant turn plus a binding-known healthy snapshot (recovery semantics); without that later proof the scan stays fail-closed and assistant errors during initialization are still rejected.
21
+
10
22
  ## [0.31.3] - 2026-11-16
11
23
 
12
24
  ### Fixed
data/docs/usage.md CHANGED
@@ -594,3 +594,15 @@ 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, healthy source evidence and the existing completed-turn
603
+ contract. Legacy sessions remain readable until explicit host cutover; an
604
+ invalid new binding never falls back to old healthy snapshots.
605
+
606
+ Humans and any agent can use ace-watch --actor NAME eyes status/observe, exact
607
+ revision ACK, report processing and resume without starting Pi or a model.
608
+ See ace-wake/README.md and docs/lab-flow.md for the shared owner contract.
@@ -27,10 +27,14 @@ module Ace
27
27
 
28
28
  identity = {"pid" => process["pid"], "startedAt" => process["started_at"]}
29
29
 
30
- # A user prompt in the current branch followed by an assistant
31
- # completed assistant turn before the eyes entry proves more than
32
- # an unrelated Herdr activity transition. Reject an intervening
33
- # user turn or an assistant error during initialization.
30
+ # A user prompt in the current branch followed by a completed
31
+ # assistant turn before the eyes entry proves more than
32
+ # an unrelated Herdr activity transition. An intervening user turn
33
+ # (a wake or queued delivery injected mid-turn, possibly before the
34
+ # first assistant completion) does not invalidate observation by
35
+ # itself: it requires a subsequent completed assistant turn plus a
36
+ # binding-known healthy snapshot (recovery semantics below). An
37
+ # assistant error during initialization still fails closed.
34
38
  prefix = branch[0...eye_index]
35
39
  prompt_index = prefix.rindex do |entry|
36
40
  message = entry.is_a?(Hash) && entry["type"] == "message" ? entry["message"] : nil
@@ -69,7 +73,15 @@ module Ace
69
73
  end
70
74
  message = entry.is_a?(Hash) && entry["type"] == "message" ? entry["message"] : nil
71
75
  next unless message.is_a?(Hash)
72
- return false if message["role"] == "user"
76
+ if message["role"] == "user"
77
+ # Continue the scan instead of rejecting outright: readiness
78
+ # then needs a completed assistant turn AFTER this user turn
79
+ # so the recovery rule can validate the current-binding
80
+ # healthy snapshot. Without that later proof the scan stays
81
+ # fail-closed (complete remains false at the eyes entry).
82
+ complete = false
83
+ next
84
+ end
73
85
  next unless message["role"] == "assistant"
74
86
  if message["stopReason"] == "stop"
75
87
  complete = true
@@ -61,6 +61,8 @@ 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, core_still_current = 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)
@@ -72,7 +74,7 @@ module Ace
72
74
  return false unless @identity.capture(pid) == process && foreground?(executor, pane, pid) && pane_binding(executor, pane) == before
73
75
  final = file.stat
74
76
  named = File.lstat(path)
75
- named.file? && !named.symlink? &&
77
+ (!core_still_current || core_still_current.call) && named.file? && !named.symlink? &&
76
78
  [stat.dev, stat.ino, stat.size, stat.mtime] == [final.dev, final.ino, final.size, final.mtime] &&
77
79
  [stat.dev, stat.ino] == [named.dev, named.ino]
78
80
  rescue Ace::Herdr::ExecutorError, SystemCallError, IOError, JSON::ParserError, ArgumentError, TypeError, KeyError
@@ -83,6 +85,60 @@ module Ace
83
85
 
84
86
  private
85
87
 
88
+ # New adapters persist a binding only. Read the wake owner's current
89
+ # checkpoint for readiness; never keep a second mutable session snapshot.
90
+ # Legacy sessions remain readable until their host-controlled cutover.
91
+ def core_branch(branch, root, uid)
92
+ entry = branch.reverse.find { |row| row["customType"] == EyesEvidence::BINDING }
93
+ binding = entry&.fetch("data", nil)
94
+ return [branch, nil] unless entry
95
+ raise ArgumentError, "invalid wake binding" unless binding.is_a?(Hash)
96
+ return [branch, nil] unless %w[statePath actor target].any? { |key| binding.key?(key) }
97
+
98
+ actor = binding.fetch("actor")
99
+ raise ArgumentError, "invalid actor binding" unless actor.is_a?(String) && actor.match?(/\A[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}\z/)
100
+ expected = File.join(root, ".ace-local/wake", actor, "state.json")
101
+ raise ArgumentError, "foreign actor state" unless binding["ownerCwd"] == root && binding["statePath"] == expected
102
+ %W[#{root}/.ace-local/wake #{root}/.ace-local/wake/#{actor}].each do |directory|
103
+ st = File.lstat(directory)
104
+ raise ArgumentError, "unsafe actor directory" unless st.directory? && !st.symlink? && st.uid == uid && (st.mode & 0o077).zero?
105
+ end
106
+ state, stat = File.open(expected, File::RDONLY | File::NOFOLLOW | File::NONBLOCK) do |file|
107
+ st = file.stat
108
+ raise ArgumentError, "unsafe actor state" unless st.file? && st.uid == uid && (st.mode & 0o077).zero? && st.size <= 16 * 1024 * 1024
109
+ [JSON.parse(file.read, max_nesting: 64, allow_duplicate_key: false), st]
110
+ end
111
+ raise ArgumentError, "actor owner mismatch" unless state.is_a?(Hash) && state["schema"] == "ace.wake.actor/v1" && state["actor"] == actor && state["cwd"] == root
112
+ raise ArgumentError, "invalid actor checkpoints" unless %w[targets runner observerEvidence eyes].all? { |key| state[key].is_a?(Hash) }
113
+ target = state.fetch("targets").fetch(binding.fetch("target"))
114
+ raise ArgumentError, "invalid delivery target" unless target.is_a?(Hash) && target["process"].is_a?(Hash)
115
+ identity = target.fetch("process")
116
+ raise ArgumentError, "adapter process mismatch" unless binding["process"] == {"pid" => identity["pid"], "startedAt" => identity["started_at"]}
117
+ runner = state.fetch("runner")
118
+ raise ArgumentError, "wake runner is not live" unless same_runner?(runner, uid)
119
+ evidence = state.fetch("observerEvidence")
120
+ raise ArgumentError, "invalid source health" unless evidence["sources"].is_a?(Hash) && evidence["sources"].values.all? { |value| value.is_a?(Hash) }
121
+ sources = evidence.fetch("sources").transform_values { |source| source.fetch("status") }
122
+ data = state.fetch("eyes").slice("enabled", "retired", "breaker", "errors", "config")
123
+ data["ownerCwd"] = root
124
+ data["observerEvidence"] = {"process" => binding.fetch("process"),
125
+ "observedAt" => evidence.fetch("observedAt"), "sources" => sources}
126
+ snapshot = {"type" => "custom", "customType" => EyesEvidence::ENTRY, "data" => data}
127
+ still_current = lambda do
128
+ current = File.lstat(expected)
129
+ current.file? && !current.symlink? &&
130
+ [current.dev, current.ino, current.size, current.mtime] == [stat.dev, stat.ino, stat.size, stat.mtime] &&
131
+ same_runner?(runner, uid)
132
+ end
133
+ [branch + [snapshot], still_current]
134
+ end
135
+
136
+ def same_runner?(runner, uid)
137
+ captured = @identity.capture(runner.fetch("pid"))
138
+ captured && captured["uid"] == uid &&
139
+ captured.slice("pid", "uid", "started_at") == runner.slice("pid", "uid", "started_at")
140
+ end
141
+
86
142
  def pane_binding(executor, pane)
87
143
  json = executor.pane_get(pane).parsed_json
88
144
  row = json.is_a?(Hash) && json["result"].is_a?(Hash) ? json["result"]["pane"] : nil
@@ -128,7 +184,7 @@ module Ace
128
184
  result["message"]["content"] = prompt if matched
129
185
  elsif entry["type"] == "custom" && entry["data"].is_a?(Hash)
130
186
  keys = case entry["customType"]
131
- when EyesEvidence::BINDING then %w[ownerCwd process]
187
+ when EyesEvidence::BINDING then %w[ownerCwd process actor statePath target]
132
188
  when EyesEvidence::ENTRY then %w[ownerCwd enabled retired breaker errors config observerEvidence]
133
189
  else []
134
190
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Overseer
5
- VERSION = "0.31.3"
5
+ VERSION = "0.31.5"
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.3
4
+ version: 0.31.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-16 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-support-cli