@junghanacs/entwurf 0.16.0 → 0.16.1
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.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +125 -0
- package/README.md +8 -11
- package/demo/README.md +1 -1
- package/docs/setup-clean-host.md +24 -10
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/acp/backend-adapter.js +19 -10
- package/package.json +8 -8
- package/pi-extensions/lib/acp/backend-adapter.ts +19 -9
- package/pi-extensions/lib/acp/backend.ts +125 -7
- package/pi-extensions/lib/acp/claude-acp-launch.js +100 -0
- package/run.sh +108 -32
- package/scripts/check-acp-launch-namespace.ts +127 -0
- package/scripts/check-acp-prompt-lifecycle.ts +145 -2
- package/scripts/check-copilot-birth-hook.ts +28 -1
- package/scripts/check-gate-qualification.ts +3 -2
- package/scripts/check-omp-fresh-preflight.ts +27 -0
- package/scripts/check-setup-qualification.sh +40 -2
- package/scripts/copilot-bridge-oracle.sh +14 -6
- package/scripts/fake-copilot-vendor.sh +4 -2
- package/scripts/mutants/acp-launch-namespace.json +34 -0
- package/scripts/mutants/acp-prompt-lifecycle.json +67 -2
- package/scripts/mutants/copilot-birth.json +3 -5
- package/scripts/mutants/pack-install.json +2 -2
- package/scripts/mutants/setup-verdict.json +35 -0
- package/scripts/omp-config-xdev.py +310 -0
- package/scripts/omp-config-xdev.sh +76 -0
- package/scripts/omp-tool-surface.py +61 -10
- package/scripts/raw-acp-child-exit-measure/README.md +285 -0
- package/scripts/raw-acp-child-exit-measure/acp-turn-population.py +89 -0
- package/scripts/raw-acp-child-exit-measure/reaper-correlation.py +47 -0
- package/scripts/smoke-setup-verdict.sh +48 -3
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Raw measurement — the ACP Claude child that leaves at exit 0 (#72)
|
|
2
|
+
|
|
3
|
+
Receipts for the 2026-09-01 diagnosis pass on
|
|
4
|
+
[#72](https://github.com/junghan0611/entwurf/issues/72). Everything below was read
|
|
5
|
+
off pi session transcripts and vendor `dist/` on the named hosts. Nothing here is
|
|
6
|
+
a repair. The **cause is closed** — see §"ANSWERED": the child is shot by
|
|
7
|
+
`acp-zombie-reaper.service`, a timer installed on oracle for a *different*
|
|
8
|
+
harness's bug. The four retired candidates below stay because they are what
|
|
9
|
+
cleared the ground for it.
|
|
10
|
+
|
|
11
|
+
Evidence grade is on every claim. `measured here` names the file the row came
|
|
12
|
+
from; `read at <path:line>` names source that was read, not run.
|
|
13
|
+
|
|
14
|
+
- `reaper-correlation.py` — lines the anomalous turns up against this host's
|
|
15
|
+
reaper SIGTERM events. Zero events on a host without the unit; that null is
|
|
16
|
+
itself the receipt for the split.
|
|
17
|
+
- `acp-turn-population.py` — run per host, `> acp-pop-<host>.json`. One row per
|
|
18
|
+
ACP-backed assistant turn: outcome class, new-vs-reuse, tool-call count,
|
|
19
|
+
totalTokens, child age, and whether the previous child had already died between
|
|
20
|
+
turns. Re-runnable; the numbers below are its output.
|
|
21
|
+
|
|
22
|
+
## The signature, from logs rather than a screen
|
|
23
|
+
|
|
24
|
+
The #72 handoff carried the signature as quotes read off Termux screenshots. This
|
|
25
|
+
pass re-read it from the host's own transcript, which is the receipt a screenshot
|
|
26
|
+
is not.
|
|
27
|
+
|
|
28
|
+
Measured here — `oracle:~/.pi/agent/sessions/--home-junghan-nixos-config--/2026-08-31T09-50-53-520Z_01a0573a-9a50-78f2-bbb3-d833d5df50b8.jsonl`,
|
|
29
|
+
records **173 / 175 / 177**, field `message.errorMessage`. Byte-identical to the
|
|
30
|
+
screenshots plus one line they cut off (`(Use \`node --trace-warnings ...\`)`).
|
|
31
|
+
|
|
32
|
+
Child transcripts, measured here — `oracle:~/.pi/agent/claude-config-overlay/projects/-home-junghan-nixos-config/`
|
|
33
|
+
`a190b806-91a3-4d74-a760-668ae60d57f2.jsonl`, `c798f097-9b28-432d-af2c-e9f73ef023ce.jsonl`,
|
|
34
|
+
`b40bce08-3556-42fa-b358-76b09212632f.jsonl`. Lifetimes 1177s / 957s / 983s.
|
|
35
|
+
|
|
36
|
+
thinkpad holds **no** sample: all three sessionIds are absent from its
|
|
37
|
+
`~/.pi/agent/sessions` and overlay `projects` (measured here, 2026-09-01).
|
|
38
|
+
|
|
39
|
+
## Three readings the handoff carried that the sources do not support
|
|
40
|
+
|
|
41
|
+
1. **"All three samples are new children, not retained reuse."** Record 173 opens
|
|
42
|
+
with `[acp: reusing live session]` — it is a reuse turn. The `resume=none` in
|
|
43
|
+
the stderr tail is the *child's own spawn line*, and that buffer is
|
|
44
|
+
session-scoped by design, so it outlives the turn and says nothing about it
|
|
45
|
+
(read at `pi-extensions/lib/acp/backend.ts:207-212`, `:1206-1210`). The split
|
|
46
|
+
is 1 reuse + 2 new.
|
|
47
|
+
|
|
48
|
+
2. **"`[tool:start] Terminal` is where it fails."** `Terminal` is the placeholder
|
|
49
|
+
*title* the vendor gives a `Bash` tool call whose `input.command` has not
|
|
50
|
+
finished streaming (read at
|
|
51
|
+
`node_modules/@agentclientprotocol/claude-agent-acp/dist/tools.js:38`). Every
|
|
52
|
+
Bash call opens that way, in successful turns too. The real shape is: the last
|
|
53
|
+
`tool:start` has no matching `tool:done`.
|
|
54
|
+
|
|
55
|
+
3. **"`[Request interrupted by user for tool use]` in the child transcript."**
|
|
56
|
+
It lands 0.2–0.4s *before* pi seals the turn — it is `dispose()`'s abort
|
|
57
|
+
artifact, the same misattribution the 2026-08-20 issue comment already named,
|
|
58
|
+
in its `for tool use` variant. Consequence, not cause.
|
|
59
|
+
|
|
60
|
+
## Four candidate causes, retired by counterexample
|
|
61
|
+
|
|
62
|
+
| candidate | retired by | receipt |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| the `CLAUDE_SDK_CAN_USE_TOOL_SHADOWED` warning | child `a190b806` printed it at spawn (`11:33:24Z`), then delivered a **successful** turn (record 171, `stopReason=stop`, `11:34:32Z`), then died on the next turn (record 173). The tail is the last 1000 chars of the session-scoped buffer and holds only the spawn lines, so nothing else was written across that success. | oracle session jsonl, records 171/173 + child transcript |
|
|
65
|
+
| the `bypassPermissions` config overlay | `~/.pi/agent/claude-config-overlay/settings.json` is **byte-identical** on thinkpad and oracle. thinkpad: 0 exit-0 deaths in 507 turns. The overlay is a constant across the split. | `cat` on each host, 2026-09-01 |
|
|
66
|
+
| context size | oracle **successes** reached `totalTokens` 416111 — above all three failures (382174 / 390831 / 404972). thinkpad successes reach 494431. | population output |
|
|
67
|
+
| tool-call volume in one turn | on oracle no success exceeded 39 tool starts while all four failures were 47/73/61/67 — but thinkpad succeeds at 138, 111, 89, 78. Real correlation inside oracle; refuted as a cause. | population output |
|
|
68
|
+
|
|
69
|
+
Elapsed time has no *constant* — lifetimes 1177s / 957s / 983s (+969.9s for the
|
|
70
|
+
2026-08-20 sample) share no value — but it is the axis after all: every one is
|
|
71
|
+
over the reaper's 900s floor (§"ANSWERED"). Read this row as "no constant", not
|
|
72
|
+
as "age is irrelevant". The 2026-07-30
|
|
73
|
+
`prompt timed out after 600000ms` turns are a **different, already-removed**
|
|
74
|
+
failure and the classifier keeps them in their own bucket so they cannot be
|
|
75
|
+
folded in.
|
|
76
|
+
|
|
77
|
+
## The population
|
|
78
|
+
|
|
79
|
+
| host | ACP turns | EXIT0 mid-turn | died between turns | max starts on a success | max totalTokens on a success | pi |
|
|
80
|
+
|---|---|---|---|---|---|---|
|
|
81
|
+
| oracle (aarch64, 4 cores) | 360 | **4** | **4** | 39 | 416111 | 0.84.3 |
|
|
82
|
+
| thinkpad (x86_64) | 507 | **0** | **0** | 138 | 494431 | 0.84.3 at collection; 0.84.4 since |
|
|
83
|
+
|
|
84
|
+
All four oracle EXIT0 turns are `claude-opus-5` (44 opus-5 turns on that host).
|
|
85
|
+
thinkpad ran 340 opus-5 turns with none. So the model is not the discriminator
|
|
86
|
+
either.
|
|
87
|
+
|
|
88
|
+
**What the split is bounded by, so it is not read as "the host is cursed":** same
|
|
89
|
+
pi (0.84.3 at collection), same node (v24.18.1), same
|
|
90
|
+
`@agentclientprotocol/claude-agent-acp` 0.70.0, same ACP SDK 1.3.0, byte-identical
|
|
91
|
+
overlay. Claude CLI differs by a patch (oracle 2.1.245 / thinkpad 2.1.241) and the
|
|
92
|
+
architecture differs (aarch64 / x86_64). Neither is the discriminator: it is the
|
|
93
|
+
`acp-zombie-reaper` timer that exists only on oracle (§"ANSWERED").
|
|
94
|
+
|
|
95
|
+
The thinkpad rows were collected under pi 0.84.3 and that host is now on 0.84.4,
|
|
96
|
+
so any further thinkpad rows belong in a separate bucket.
|
|
97
|
+
|
|
98
|
+
## Where the exit(0) comes from
|
|
99
|
+
|
|
100
|
+
Read at `node_modules/@agentclientprotocol/claude-agent-acp/dist/index.js:81-95`:
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
async function shutdown() { await agent.dispose().catch(...); process.exit(0); }
|
|
104
|
+
connection.closed.then(shutdown);
|
|
105
|
+
process.on("SIGTERM", shutdown);
|
|
106
|
+
process.on("SIGINT", shutdown);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Three paths, one exit code. `exit 0, no signal` is what all three produce, so the
|
|
110
|
+
exit fact `df7525f` preserved cannot by itself say which fired.
|
|
111
|
+
|
|
112
|
+
entwurf's side saw a close carrying **no reason** — a clean stdout EOF rather than
|
|
113
|
+
an errored stream (read at `pi-extensions/lib/acp/backend.ts:355-365`). So the
|
|
114
|
+
child went first; pi did not close it.
|
|
115
|
+
|
|
116
|
+
## ANSWERED (2026-09-01, oracle) — it is SIGTERM, from a timer on this host
|
|
117
|
+
|
|
118
|
+
The open question below is closed. It was not derivable from the artifacts the
|
|
119
|
+
previous pass had; it is derivable from one this pass added — **the host's own
|
|
120
|
+
systemd user journal**, which no reading had opened.
|
|
121
|
+
|
|
122
|
+
Measured here — `journalctl --user -b 0` on oracle, and `reaper-correlation.py`,
|
|
123
|
+
which re-derives the table below from `acp-pop-oracle.json` plus that journal:
|
|
124
|
+
|
|
125
|
+
| turn (UTC) | kind | nearest reap | delta |
|
|
126
|
+
|---|---|---|---|
|
|
127
|
+
| 2026-08-31T11:53:01.452Z | EXIT0 | 11:53:01Z pid=1107102 | **0.5s** |
|
|
128
|
+
| 2026-08-31T12:09:26.272Z | EXIT0 | 12:09:26Z pid=1147382 | **0.3s** |
|
|
129
|
+
| 2026-08-31T12:25:52.596Z | EXIT0 | 12:25:52Z pid=1162114 | **0.6s** |
|
|
130
|
+
| 2026-08-20T09:19:52.107Z | EXIT0 | 09:19:52Z pid=3872971 | **0.1s** |
|
|
131
|
+
| 2026-08-31T06:13:15.421Z | between | 06:00:52Z pid=382085 | 743.4s idle |
|
|
132
|
+
| 2026-08-31T06:35:07.230Z | between | 06:29:52Z pid=413476 | 315.2s idle |
|
|
133
|
+
| 2026-08-31T12:56:18.364Z | between | 12:43:52Z pid=1176076 | 746.4s idle |
|
|
134
|
+
|
|
135
|
+
**The pid closes it.** `(node:<pid>)` in the stderr tail is what node's
|
|
136
|
+
`emitWarning` stamps with the emitting process's OWN pid — so the #72 signature
|
|
137
|
+
carried the child's pid all along. Measured here, by `\(node:(\d+)\)` over the
|
|
138
|
+
same `message.errorMessage` fields, against the journal's reaping lines:
|
|
139
|
+
|
|
140
|
+
| record | node pid in the tail | pid the reaper SIGTERMed | reap (KST) |
|
|
141
|
+
|---|---|---|---|
|
|
142
|
+
| 173 | 1107102 | **1107102** | 20:53:01 |
|
|
143
|
+
| 175 | 1147382 | **1147382** | 21:09:26 |
|
|
144
|
+
| 177 | 1162114 | **1162114** | 21:25:52 |
|
|
145
|
+
|
|
146
|
+
Identical in all three. Timestamp agreement alone would leave coincidence and
|
|
147
|
+
reverse-causation open; pid identity does not. Note what this costs the earlier
|
|
148
|
+
readings: the warning line retired as a candidate cause was, the whole time,
|
|
149
|
+
naming the killer.
|
|
150
|
+
|
|
151
|
+
**All four EXIT0 turns land inside one second of a SIGTERM this host sent on
|
|
152
|
+
purpose.** The three surviving `between` rows are the first turn after a reap
|
|
153
|
+
that killed an idle child — the operator never sees those, pi just opens a new
|
|
154
|
+
one. That is **7 turns carrying 8 flags** (2026-08-20 is EXIT0 and `between` at
|
|
155
|
+
once), not eight turns — the table has seven rows and the prose must match it.
|
|
156
|
+
|
|
157
|
+
**Extended to 12/12 across two boots** (measured by fable, oracle, 2026-09-01,
|
|
158
|
+
independent re-extraction). boot -1's journal survives and covers 2026-07-02 to
|
|
159
|
+
08-16, so the samples that PREDATE this boot close too:
|
|
160
|
+
|
|
161
|
+
| sample | node pid in tail | reap | delta |
|
|
162
|
+
|---|---|---|---|
|
|
163
|
+
| 2026-07-30T11:04:23.555Z — **the sample that opened #72** | 3662184 | Jul 30 20:04:23 | 0.555s |
|
|
164
|
+
| 2026-08-16T10:16:51.415Z — the original field report | 501006 | Aug 16 19:16:51 | ~0s |
|
|
165
|
+
| 2026-08-07T08:23:23.559Z (CLOSED-other) | — | 17:23:23 | 0.559s |
|
|
166
|
+
| 2026-08-07T08:41:23.544Z (CLOSED-other) | — | 17:41:23 | 0.544s |
|
|
167
|
+
|
|
168
|
+
So every anomalous termination in the population — EXIT0 4 + between 4 +
|
|
169
|
+
CLOSED-other 4 — corresponds to a reap. **The founding sample and the last
|
|
170
|
+
sample have one cause.** The reaper script's mtime is 2026-04-18, earlier than
|
|
171
|
+
every sample.
|
|
172
|
+
|
|
173
|
+
**Evidence grade, stated honestly.** The rows with a pid in a transcript
|
|
174
|
+
(173/175/177, 07-30, 08-16) are pid+timestamp double-locked. The four
|
|
175
|
+
`between`/prior-child deaths (382085, 413476, 1176076, 3857303) rest on
|
|
176
|
+
**journal alone** — a between-turn death leaves no stderr tail to carry a pid.
|
|
177
|
+
Timestamp, lifetime and mechanism all agree, but that is a weaker grade and is
|
|
178
|
+
labelled as such rather than folded into the locked set.
|
|
179
|
+
|
|
180
|
+
The killer, read at `/home/junghan/openclaw/scripts/acp-zombie-reaper.sh`, driven
|
|
181
|
+
by `~/.config/systemd/user/acp-zombie-reaper.timer` (`OnUnitActiveSec=5min`,
|
|
182
|
+
`ACP_REAPER_AGE_SECS=900`):
|
|
183
|
+
|
|
184
|
+
```sh
|
|
185
|
+
mapfile -t stale_acp < <(ps -eo pid,etimes,user,args --no-headers |
|
|
186
|
+
awk -v age="$AGE_SECS" '$2 > age && $0 ~ /claude-agent-acp/ ...')
|
|
187
|
+
...
|
|
188
|
+
kill_pid "$pid" TERM # → process.on("SIGTERM", shutdown) → dispose() → exit(0)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
So of the three exit-0 doors, it is **SIGTERM**. Every downstream fact follows:
|
|
192
|
+
exit 0 with no signal recorded (the handler catches it and leaves cleanly), the
|
|
193
|
+
reasonless stdout EOF, and the `[Request interrupted by user...]` line as
|
|
194
|
+
`dispose()`'s abort artifact.
|
|
195
|
+
|
|
196
|
+
**Why nothing in the previous pass could see it.** The reaper matches on the
|
|
197
|
+
process *name*, and entwurf's ACP child carries the same name as the one acpx
|
|
198
|
+
leaks. It is a workaround for a **different harness's** bug (openclaw acpx 0.5.3,
|
|
199
|
+
upstream PR #245) that fires on any `claude-agent-acp` older than 900s. Its own
|
|
200
|
+
comment states the assumption that fails here — *"Legitimate ACP turns complete
|
|
201
|
+
well under 60s"* — which is true of a turn and false of entwurf's **retained**
|
|
202
|
+
child, whose age is the age of the *session*. A session older than 15 minutes is
|
|
203
|
+
shot at, every 5 minutes, forever.
|
|
204
|
+
|
|
205
|
+
This also names the host discriminator the previous pass left open, and retires
|
|
206
|
+
the last of the elapsed-time reading: lifetimes 1177s / 957s / 983s / 969.9s have
|
|
207
|
+
no constant because the axis is not a constant but a **floor** — every one of
|
|
208
|
+
them is over 900. The script lives in `~/openclaw/scripts/`, installed on oracle
|
|
209
|
+
by hand; it is not in `nixos-config`, so thinkpad never had it. That is the whole
|
|
210
|
+
of the 4-vs-0 split. Not the architecture, not the Claude CLI patch level.
|
|
211
|
+
|
|
212
|
+
**What this does NOT say.** It is not an entwurf defect, and the fix is not in
|
|
213
|
+
this repo's runtime: a correctly working child was shot by an unrelated janitor.
|
|
214
|
+
What #72 may still owe is *diagnosis* — the turn's error text says the child
|
|
215
|
+
"ended (exit code 0)" and gives the operator nothing to distinguish a clean
|
|
216
|
+
external kill from a vendor fault. Any such change is still bounded by the
|
|
217
|
+
issue's repair fence (no timeout, no blind replay, no watcher/supervisor/retry).
|
|
218
|
+
Disposition is GLG's.
|
|
219
|
+
|
|
220
|
+
Repair candidates for the reaper itself, none of them taken here (it is another
|
|
221
|
+
project's file on GLG's operating host):
|
|
222
|
+
|
|
223
|
+
- narrow Phase 1 the way Phase 2 already is — it reaps orphan `claude` only when
|
|
224
|
+
`PPID == 1`, while Phase 1 reaps *any* `claude-agent-acp` by age alone. A child
|
|
225
|
+
with a live parent is somebody's working session.
|
|
226
|
+
- raise `ACP_REAPER_AGE_SECS` above a plausible session lifetime (a palliative,
|
|
227
|
+
not a fix — it only moves the floor).
|
|
228
|
+
- retire the unit if acpx PR #245 has landed upstream.
|
|
229
|
+
|
|
230
|
+
## The open question, stated so it is measurable
|
|
231
|
+
|
|
232
|
+
> Which of the three exit-0 paths fires — `connection.closed`, `SIGTERM`, or
|
|
233
|
+
> `SIGINT`?
|
|
234
|
+
|
|
235
|
+
It is not derivable from the artifacts we have. It **is** separable from outside
|
|
236
|
+
by whether a signal was delivered. Any probe for that is a launch-seam change and
|
|
237
|
+
therefore GLG's decision, and it owes its own gate cell plus a mutant that dies
|
|
238
|
+
for the right reason before it is worth anything.
|
|
239
|
+
|
|
240
|
+
That question is answered above (SIGTERM). This section is kept as the record
|
|
241
|
+
of how it was stated before it was closed.
|
|
242
|
+
|
|
243
|
+
## The repair, measured on the host that produced the failure
|
|
244
|
+
|
|
245
|
+
The launcher (`pi-extensions/lib/acp/claude-acp-launch.js`) is a claim about two
|
|
246
|
+
things a unit gate cannot see: what `ps` shows, and what a real signal does.
|
|
247
|
+
Reproduced here on oracle, 2026-09-01 — run it again with the block below.
|
|
248
|
+
|
|
249
|
+
```sh
|
|
250
|
+
mkfifo /tmp/f
|
|
251
|
+
node pi-extensions/lib/acp/claude-acp-launch.js < /tmp/f 2> /tmp/live.err &
|
|
252
|
+
NPID=$!; exec 3> /tmp/f; sleep 2
|
|
253
|
+
tr '\0' ' ' < /proc/$NPID/cmdline; echo
|
|
254
|
+
# the janitor's own Phase 1 selector, with the age threshold forced to 0
|
|
255
|
+
ps -eo pid,etimes,user,args --no-headers -p $NPID |
|
|
256
|
+
awk -v age=0 '$2 > age && $0 ~ /claude-agent-acp/ && $0 !~ /awk/ { print "MATCH " $1 }'
|
|
257
|
+
kill -TERM $NPID; wait $NPID; echo "exit code: $?"; cat /tmp/live.err
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Output:
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
node pi-extensions/lib/acp/claude-acp-launch.js
|
|
264
|
+
<- no MATCH line: the selector finds nothing
|
|
265
|
+
exit code: 0
|
|
266
|
+
ENTWURF_ACP_LAUNCH_SIGNAL=SIGTERM
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Three facts, in the order they matter:
|
|
270
|
+
|
|
271
|
+
1. **`/proc/<pid>/cmdline` carries no vendor name.** The vendor runs, but as an
|
|
272
|
+
`import` inside this process — so the string the janitor scans is ours.
|
|
273
|
+
2. **The janitor's own awk, with `age` forced to 0 so every process qualifies,
|
|
274
|
+
selects nothing.** Not "would probably not match": its selector, run against
|
|
275
|
+
the real `ps` row.
|
|
276
|
+
3. **A real SIGTERM still ends at exit 0** — the vendor's handler is intact and
|
|
277
|
+
nothing was made signal-immune — **and the frame is on stderr.** That line is
|
|
278
|
+
what the backend lifts into `launch observed SIGTERM before child exit`, which
|
|
279
|
+
is the fact this whole investigation had to reconstruct from a journal.
|
|
280
|
+
|
|
281
|
+
Independently reproduced by a second session (fable, oracle, 2026-09-01), which
|
|
282
|
+
also confirmed the adjacent paths: stdin EOF alone exits 0 (the `connection.closed`
|
|
283
|
+
door, live), a SIGTERM arriving 0.15s into the import still terminates (the sink
|
|
284
|
+
guard stands down and the re-raised signal lands), and a launcher copied outside
|
|
285
|
+
the repo exits 1 rather than degrading.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Population of ACP turns from a host's pi session transcripts — the #72 receipt.
|
|
3
|
+
|
|
4
|
+
Reads every `~/.pi/agent/sessions/*/*.jsonl` and emits ONE row per assistant turn
|
|
5
|
+
that carried an entwurf ACP lifecycle notice. The point is to compare turns that
|
|
6
|
+
FAILED with a clean child exit(0) against turns that SUCCEEDED on the same host,
|
|
7
|
+
so a candidate cause (context size, tool-call volume, elapsed time, a stderr
|
|
8
|
+
warning) can be retired by a counterexample instead of by argument.
|
|
9
|
+
|
|
10
|
+
The classifier is deliberately narrow:
|
|
11
|
+
|
|
12
|
+
EXIT0 stopReason=error, "ACP connection closed", "exit code 0"
|
|
13
|
+
— the #72 shape: the child left cleanly while owing an answer.
|
|
14
|
+
CLOSED-other same close, no exit fact preserved (pre-df7525f evidence loss).
|
|
15
|
+
ERR-other any other error, INCLUDING the retired 600s `prompt timed out`
|
|
16
|
+
turns. Those are a different, already-removed failure — the
|
|
17
|
+
classifier keeps them separate so they cannot be folded in.
|
|
18
|
+
OK the turn answered.
|
|
19
|
+
|
|
20
|
+
`between` marks a turn whose notice says the PREVIOUS child had already ended at
|
|
21
|
+
exit 0 between turns. Those deaths are invisible to the operator (pi just opens a
|
|
22
|
+
new child), so counting them is what shows that the user-visible failure is a
|
|
23
|
+
RACE with an in-flight prompt, not a distinct failure mode.
|
|
24
|
+
|
|
25
|
+
Run it on each host and diff the two outputs; a cause must survive both.
|
|
26
|
+
|
|
27
|
+
python3 acp-turn-population.py > acp-pop-<host>.json
|
|
28
|
+
"""
|
|
29
|
+
import json, sys, os, glob, datetime
|
|
30
|
+
|
|
31
|
+
rows = []
|
|
32
|
+
for f in glob.glob(os.path.expanduser("~/.pi/agent/sessions/*/*.jsonl")):
|
|
33
|
+
prev_end = None
|
|
34
|
+
spawn = None
|
|
35
|
+
try:
|
|
36
|
+
lines = open(f, encoding="utf-8", errors="replace").readlines()
|
|
37
|
+
except OSError:
|
|
38
|
+
continue
|
|
39
|
+
for line in lines:
|
|
40
|
+
# Cheap prefilter: the vast majority of records are not assistant turns.
|
|
41
|
+
if '"assistant"' not in line:
|
|
42
|
+
continue
|
|
43
|
+
try:
|
|
44
|
+
o = json.loads(line)
|
|
45
|
+
except ValueError:
|
|
46
|
+
continue
|
|
47
|
+
if o.get("type") != "message":
|
|
48
|
+
continue
|
|
49
|
+
m = o.get("message") or {}
|
|
50
|
+
if m.get("role") != "assistant":
|
|
51
|
+
continue
|
|
52
|
+
c = m.get("content") or []
|
|
53
|
+
# The lifecycle notice is what marks a turn as ACP-backed at all.
|
|
54
|
+
notices = [b.get("text", "").strip() for b in c if b.get("textSignature") == "entwurf:lifecycle-notice-v1"]
|
|
55
|
+
if not notices:
|
|
56
|
+
continue
|
|
57
|
+
ts = o.get("timestamp")
|
|
58
|
+
t = datetime.datetime.fromisoformat(ts.replace("Z", "+00:00"))
|
|
59
|
+
newchild = any("preparing claude session" in n for n in notices)
|
|
60
|
+
if newchild:
|
|
61
|
+
spawn = t
|
|
62
|
+
texts = [b.get("text") for b in c if isinstance(b.get("text"), str)]
|
|
63
|
+
# "Terminal" is only the vendor's placeholder TITLE for a Bash call whose
|
|
64
|
+
# `input.command` has not finished streaming, so a start is one tool call.
|
|
65
|
+
starts = sum(1 for x in texts if x.startswith("\n[tool:start]"))
|
|
66
|
+
dones = sum(1 for x in texts if x.startswith("\n[tool:done]") or x.startswith("\n[tool:failed]"))
|
|
67
|
+
em = m.get("errorMessage") or ""
|
|
68
|
+
if m.get("stopReason") != "error":
|
|
69
|
+
kind = "OK"
|
|
70
|
+
elif "ACP connection closed" in em and "exit code 0" in em:
|
|
71
|
+
kind = "EXIT0"
|
|
72
|
+
elif "ACP connection closed" in em:
|
|
73
|
+
kind = "CLOSED-other"
|
|
74
|
+
else:
|
|
75
|
+
kind = "ERR-other"
|
|
76
|
+
rows.append(dict(
|
|
77
|
+
f=os.path.basename(f), ts=ts, kind=kind,
|
|
78
|
+
reuse=any("reusing live session" in n for n in notices),
|
|
79
|
+
newchild=newchild,
|
|
80
|
+
between=any("ended between turns" in n for n in notices),
|
|
81
|
+
starts=starts, dones=dones,
|
|
82
|
+
idle=(t - prev_end).total_seconds() if prev_end else None,
|
|
83
|
+
age=(t - spawn).total_seconds() if spawn else None,
|
|
84
|
+
tt=(m.get("usage") or {}).get("totalTokens"),
|
|
85
|
+
model=m.get("model"),
|
|
86
|
+
))
|
|
87
|
+
prev_end = t
|
|
88
|
+
|
|
89
|
+
json.dump(rows, sys.stdout)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Correlate anomalous ACP turns against this host's reaper SIGTERM events — #72.
|
|
3
|
+
|
|
4
|
+
The population script says WHICH turns died at exit 0. This one says WHY, on a
|
|
5
|
+
host that runs `acp-zombie-reaper.service`: it lines every EXIT0 / between-turn
|
|
6
|
+
row up against the systemd user journal's reaping events and prints the delta.
|
|
7
|
+
|
|
8
|
+
python3 acp-turn-population.py > acp-pop-<host>.json
|
|
9
|
+
python3 reaper-correlation.py acp-pop-<host>.json
|
|
10
|
+
|
|
11
|
+
An EXIT0 turn whose delta is under a second was killed by that SIGTERM. A
|
|
12
|
+
`between` row's delta is the idle gap since the reap that killed the previous
|
|
13
|
+
child — the operator never sees those, pi just opens a new one.
|
|
14
|
+
|
|
15
|
+
Hosts without the reaper unit produce zero reap events; that is the expected
|
|
16
|
+
output on thinkpad and is itself the receipt for the host split.
|
|
17
|
+
"""
|
|
18
|
+
import json, re, sys, datetime, subprocess
|
|
19
|
+
|
|
20
|
+
pop = sys.argv[1] if len(sys.argv) > 1 else "acp-pop-oracle.json"
|
|
21
|
+
rows = json.load(open(pop))
|
|
22
|
+
|
|
23
|
+
out = subprocess.run(
|
|
24
|
+
["journalctl", "--user", "-b", "0", "--no-pager"],
|
|
25
|
+
capture_output=True, text=True,
|
|
26
|
+
).stdout
|
|
27
|
+
reaps = []
|
|
28
|
+
for line in out.splitlines():
|
|
29
|
+
m = re.search(r"\[acp-reaper (\S+)\] reaping (\d+) stale.*: (.+)$", line)
|
|
30
|
+
if m:
|
|
31
|
+
t = datetime.datetime.fromisoformat(m.group(1)).astimezone(datetime.timezone.utc)
|
|
32
|
+
reaps.append((t, m.group(3).strip()))
|
|
33
|
+
|
|
34
|
+
print(f"reaper SIGTERM events in this boot: {len(reaps)}")
|
|
35
|
+
if not reaps:
|
|
36
|
+
print("no reaper on this host — nothing to correlate")
|
|
37
|
+
sys.exit(0)
|
|
38
|
+
|
|
39
|
+
print(f"{'turn (UTC)':26} {'kind':13} {'between':8} {'nearest reap':22} {'delta(s)':>9}")
|
|
40
|
+
for r in rows:
|
|
41
|
+
if r["kind"] != "EXIT0" and not r["between"]:
|
|
42
|
+
continue
|
|
43
|
+
t = datetime.datetime.fromisoformat(r["ts"].replace("Z", "+00:00"))
|
|
44
|
+
best = min(reaps, key=lambda x: abs((x[0] - t).total_seconds()))
|
|
45
|
+
d = (t - best[0]).total_seconds()
|
|
46
|
+
print(f"{r['ts']:26} {r['kind']:13} {str(r['between']):8} "
|
|
47
|
+
f"{best[0].strftime('%Y-%m-%dT%H:%M:%SZ'):22} {d:>9.1f} pid={best[1]}")
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
# gate. This fixture drives the REAL `run.sh setup` end to end in a sandbox and
|
|
8
8
|
# pins exactly the #86 C1 acceptance cells:
|
|
9
9
|
#
|
|
10
|
-
# S-1 all-harness-absent → core PASS, pi/claude/agy SKIP, computed green,
|
|
10
|
+
# S-1 all-harness-absent → core PASS, pi/claude/agy/copilot/omp SKIP, computed green,
|
|
11
11
|
# zero harness writes, credential store untouched
|
|
12
12
|
# S-2 pi below floor → detected FAIL (never SKIP), nonzero, no Pi wiring
|
|
13
13
|
# S-3 pi at floor → presence completes project+user wiring, green,
|
|
14
14
|
# credential store still byte-identical
|
|
15
15
|
# S-4 agy detected+corrupt→ named component FAIL + NON-GREEN + nonzero exit,
|
|
16
16
|
# core and later components still attempted
|
|
17
|
+
# S-8 omp present → the four omp units compose (birth/MCP/tools.xdev
|
|
18
|
+
# setting/receiver), states exist, second run idempotent
|
|
17
19
|
# S-5 installed mode → the installed-vs-source branch is a NAMED verdict
|
|
18
20
|
# printed before anything else, and never reaches
|
|
19
21
|
# the source pnpm bootstrap
|
|
@@ -25,7 +27,8 @@
|
|
|
25
27
|
# below-floor and false-green shapes as living end-to-end evidence.
|
|
26
28
|
#
|
|
27
29
|
# Deterministic: no model, no network, no cost. Presence probes are pinned via
|
|
28
|
-
# PI_BIN / CLAUDE_BIN / AGY_BIN (the same hermetic seam
|
|
30
|
+
# PI_BIN / CLAUDE_BIN / AGY_BIN / COPILOT_BIN / OMP_BIN (the same hermetic seam
|
|
31
|
+
# smoke-agy-install-state
|
|
29
32
|
# uses), and every write root is sandboxed: HOME, XDG roots, the pi agent dir,
|
|
30
33
|
# and the dev-bin dir. The source bootstrap (`pnpm install --frozen-lockfile`)
|
|
31
34
|
# runs against the ALREADY-INSTALLED checkout, which is a verified no-op under a
|
|
@@ -64,7 +67,7 @@ mkdir -p "$HOME" "$PI_CODING_AGENT_DIR" "$SB/bin" "$SB/harness"
|
|
|
64
67
|
# Presence pins: default every harness to a definitely-absent path; each cell
|
|
65
68
|
# re-pins what it needs. Production leaves these unset.
|
|
66
69
|
ABSENT="$SB/harness/definitely-absent"
|
|
67
|
-
export PI_BIN="$ABSENT" CLAUDE_BIN="$ABSENT" AGY_BIN="$ABSENT" COPILOT_BIN="$ABSENT"
|
|
70
|
+
export PI_BIN="$ABSENT" CLAUDE_BIN="$ABSENT" AGY_BIN="$ABSENT" COPILOT_BIN="$ABSENT" OMP_BIN="$ABSENT"
|
|
68
71
|
|
|
69
72
|
PASS=0
|
|
70
73
|
ok() { PASS=$((PASS + 1)); printf ' ok %s\n' "$*"; }
|
|
@@ -98,6 +101,7 @@ want "S-1: pi absent is an explicit zero-state SKIP" "printf '%s' \"\$OUT\" | gr
|
|
|
98
101
|
want "S-1: claude absent is an explicit zero-state SKIP" "printf '%s' \"\$OUT\" | grep -q 'claude: SKIP'"
|
|
99
102
|
want "S-1: agy absent is an explicit zero-state SKIP" "printf '%s' \"\$OUT\" | grep -q 'agy: SKIP'"
|
|
100
103
|
want "S-1: copilot absent is an explicit zero-state SKIP" "printf '%s' \"\$OUT\" | grep -q 'copilot: SKIP'"
|
|
104
|
+
want "S-1: omp absent is an explicit zero-state SKIP" "printf '%s' \"\$OUT\" | grep -q 'omp: SKIP'"
|
|
101
105
|
want "S-1: core bridge boundary validated (PASS)" "printf '%s' \"\$OUT\" | grep -q 'core: PASS'"
|
|
102
106
|
want "S-1: final verdict is computed, not unconditional" \
|
|
103
107
|
"printf '%s' \"\$OUT\" | grep -q 'result: green (computed from the component outcomes above)'"
|
|
@@ -107,6 +111,7 @@ want "S-1: zero Pi wiring written for an absent pi" "[ ! -e '$PROJ1/.pi' ]"
|
|
|
107
111
|
want "S-1: no user-scope pi settings were created" "[ ! -e '$PI_CODING_AGENT_DIR/settings.json' ]"
|
|
108
112
|
want "S-1: no agy config was created" "[ ! -e '$HOME/.gemini' ]"
|
|
109
113
|
want "S-1: no Copilot config/units were created" "[ ! -e '$HOME/.copilot' ]"
|
|
114
|
+
want "S-1: no OMP config/units were created" "[ ! -e '$HOME/.omp' ]"
|
|
110
115
|
want_auth_untouched "S-1"
|
|
111
116
|
|
|
112
117
|
# ── S-2: pi resolvable but BELOW floor → detected FAIL, never SKIP, no writes ──
|
|
@@ -242,6 +247,46 @@ want_auth_untouched "S-7"
|
|
|
242
247
|
rm -rf "$HOME/.copilot" "$XDG_DATA_HOME/entwurf/copilot-mcp" "$XDG_DATA_HOME/entwurf/copilot-receive" \
|
|
243
248
|
"$XDG_DATA_HOME/entwurf/copilot-statusline"
|
|
244
249
|
|
|
250
|
+
# ── S-8: omp present → the FOUR omp units compose, including the operator setting ──
|
|
251
|
+
# OMP shipped in v0.16.0 with installers, doctors and inverses for every unit, but
|
|
252
|
+
# `setup` did not compose it — the fifth backend was a hand-run verb list and the
|
|
253
|
+
# `tools.xdev` setting was a documentation step, so a one-command host came up with
|
|
254
|
+
# an omp citizen whose MCP tools the model could not call. This cell is the standing
|
|
255
|
+
# consumer of that composition. The omp unit scripts touch NO vendor process: they
|
|
256
|
+
# only probe `omp` on PATH and write into the agent dir, so a stub binary is a
|
|
257
|
+
# faithful presence pin and every write lands in the sandbox HOME.
|
|
258
|
+
echo "[smoke-setup-verdict] S-8 omp present — four-unit composition"
|
|
259
|
+
PROJ8="$SB/proj8"; mkdir -p "$PROJ8"
|
|
260
|
+
FAKE_OMP="$SB/harness/omp-fake"; mkdir -p "$FAKE_OMP"
|
|
261
|
+
printf '#!/usr/bin/env bash\necho "omp/18.0.0"\n' > "$FAKE_OMP/omp"
|
|
262
|
+
chmod +x "$FAKE_OMP/omp"
|
|
263
|
+
seed_auth
|
|
264
|
+
# This sandbox exports PI_CODING_AGENT_DIR, which omp reads too — the oracle refuses
|
|
265
|
+
# that ambiguity by design (ledger M6), so the cell names the agent dir explicitly, the
|
|
266
|
+
# same seam a real operator on a pi-rail host would use.
|
|
267
|
+
OMP_AGENT="$HOME/.omp/agent"
|
|
268
|
+
set +e; OUT="$(OMP_BIN="$FAKE_OMP/omp" ENTWURF_OMP_AGENT_DIR="$OMP_AGENT" PATH="$FAKE_OMP:$PATH" bash "$REPO_DIR/run.sh" setup "$PROJ8" 2>&1)"; RC=$?; set -e
|
|
269
|
+
want "S-8: omp-present setup exits 0 (four units + core all green)" "[ '$RC' -eq 0 ]"
|
|
270
|
+
want "S-8: birth unit composed as PASS" "printf '%s' \"\$OUT\" | grep -q 'omp-birth: PASS'"
|
|
271
|
+
want "S-8: MCP unit composed as PASS" "printf '%s' \"\$OUT\" | grep -q 'omp-mcp: PASS'"
|
|
272
|
+
want "S-8: the tools.xdev operator setting composed as PASS" "printf '%s' \"\$OUT\" | grep -q 'omp-config: PASS'"
|
|
273
|
+
want "S-8: receiver unit composed as PASS" "printf '%s' \"\$OUT\" | grep -q 'omp-receive: PASS'"
|
|
274
|
+
want "S-8: computed summary is green" \
|
|
275
|
+
"printf '%s' \"\$OUT\" | grep -q 'result: green (computed from the component outcomes above)'"
|
|
276
|
+
want "S-8: all four package-owned install-states exist (each unit keeps its inverse authority)" \
|
|
277
|
+
"[ -f '$XDG_DATA_HOME/entwurf/omp-bridge/install-state.json' ] && [ -f '$XDG_DATA_HOME/entwurf/omp-mcp/install-state.json' ] && [ -f '$XDG_DATA_HOME/entwurf/omp-config/install-state.json' ] && [ -f '$XDG_DATA_HOME/entwurf/omp-receive/install-state.json' ]"
|
|
278
|
+
want "S-8: both extension units landed in the sandbox omp agent dir" \
|
|
279
|
+
"[ -d '$HOME/.omp/agent/extensions/entwurf-meta-omp' ] && [ -d '$HOME/.omp/agent/extensions/entwurf-receive-omp' ]"
|
|
280
|
+
want "S-8: the MCP hand wrote the pinned key and the setting reached the config the vendor reads" \
|
|
281
|
+
"grep -q 'entwurf-bridge' '$HOME/.omp/agent/mcp.json' && [ \"\$(python3 '$REPO_DIR/scripts/omp-tool-surface.py' '$HOME/.omp/agent' | awk '/^verdict /{print \$2}')\" = 'xdev-off' ]"
|
|
282
|
+
want "S-8: setup is idempotent — a second run over the composed host is still green" \
|
|
283
|
+
"OMP_BIN='$FAKE_OMP/omp' ENTWURF_OMP_AGENT_DIR='$HOME/.omp/agent' PATH='$FAKE_OMP:$PATH' bash '$REPO_DIR/run.sh' setup '$PROJ8' 2>&1 | grep -q 'result: green (computed from the component outcomes above)'"
|
|
284
|
+
want_auth_untouched "S-8"
|
|
285
|
+
# Reset the composed OMP state so the next cell decides on a clean host.
|
|
286
|
+
rm -rf "$HOME/.omp" "$XDG_DATA_HOME/entwurf/omp-bridge" "$XDG_DATA_HOME/entwurf/omp-mcp" \
|
|
287
|
+
"$XDG_DATA_HOME/entwurf/omp-config" "$XDG_DATA_HOME/entwurf/omp-receive" \
|
|
288
|
+
"$XDG_DATA_HOME/entwurf/meta-bridge-omp" "$XDG_DATA_HOME/entwurf/omp-receive"
|
|
289
|
+
|
|
245
290
|
# ── S-5: installed mode is a NAMED first verdict, never the source bootstrap ──
|
|
246
291
|
# A bare copy of run.sh under a fake node_modules root pins the mode seam
|
|
247
292
|
# cheaply: the copy is NOT a runnable installed package (no dist), so this cell
|