@shumkov/orchestra 0.5.0 → 0.7.0
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/README.md +12 -4
- package/docs/CLAUDE_CODE_2_1_220.md +22 -0
- package/docs/codex-app-server-compatibility.md +631 -0
- package/index.js +18 -3
- package/lib/claude-bin.js +3 -17
- package/lib/codex/app-server-client.js +2866 -0
- package/lib/codex/app-server-supervisor.mjs +41 -0
- package/lib/codex/preflight.js +1073 -0
- package/lib/codex/protocol-schema.json +237 -0
- package/lib/process/cli-process.js +269 -26
- package/lib/process/codex-process.js +2814 -0
- package/lib/process/factory.js +345 -1
- package/lib/process/process-manager.js +1140 -84
- package/lib/process/process.js +16 -0
- package/lib/process/workflow-completion-correlation.js +100 -5
- package/package.json +5 -3
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
# Codex app-server 0.145.0 compatibility gate
|
|
2
|
+
|
|
3
|
+
Date: 2026-07-26
|
|
4
|
+
|
|
5
|
+
Scope: U1a core protocol, steering, healthy stop, isolation, accepted
|
|
6
|
+
native-beta containment contract, and U1b operational/security
|
|
7
|
+
characterization
|
|
8
|
+
|
|
9
|
+
Overall U1a result: **CONTINUE — every integrated U1a gate passed**
|
|
10
|
+
|
|
11
|
+
Overall U1b result: **CONTINUE — every implementation-blocking U1b gate
|
|
12
|
+
passed; rollout remains native/direct-only**
|
|
13
|
+
|
|
14
|
+
Named-profile result: **CONTINUE — authenticated direct-binary run passed**
|
|
15
|
+
|
|
16
|
+
Steering capability result: **CONTINUE — one complete ordered semantic
|
|
17
|
+
steering and definite stale-rejection trace passed**
|
|
18
|
+
|
|
19
|
+
Steering-smoke result: **CONTINUE — final integrated authenticated run passed**
|
|
20
|
+
|
|
21
|
+
Tracked-terminal stop result: **CONTINUE — interrupt plus clean passed**
|
|
22
|
+
|
|
23
|
+
Arbitrary-descendant containment result: **DEFERRED — accepted native-beta
|
|
24
|
+
limitation with daemon-wide same-host reboot quarantine**
|
|
25
|
+
|
|
26
|
+
The named-profile result replaces the earlier false-negative that treated the absence of
|
|
27
|
+
`WorkspaceWriteSandboxPolicy.readOnlyAccess` as dispositive. Codex 0.145.0 has
|
|
28
|
+
a separate beta named-permission-profile surface that can restrict command
|
|
29
|
+
reads without a legacy `workspaceWrite` request policy.
|
|
30
|
+
|
|
31
|
+
## Pinned baseline
|
|
32
|
+
|
|
33
|
+
- Orchestra baseline: `v0.5.0`, commit
|
|
34
|
+
`b788efb1f99e5fbf8669d4efa7ce5a1f9c0f7dcb`.
|
|
35
|
+
- Codex: `codex-cli 0.145.0`.
|
|
36
|
+
- Binary SHA-256:
|
|
37
|
+
`1da3f4e0e96028b8a771814293c3033dafd1971f943f6c7e79b0897fe705f590`.
|
|
38
|
+
- Stable and experimental generated schema hashes remain pinned in
|
|
39
|
+
`tests/fixtures/codex-app-server-0.145.0/manifest.json`.
|
|
40
|
+
- `turn/steer` still requires `threadId`, `input`, and `expectedTurnId`.
|
|
41
|
+
- The authenticated direct-binary checker passed every named-profile evidence
|
|
42
|
+
bit on 2026-07-26. This Mac has no configured session launcher, so the local
|
|
43
|
+
beta is explicitly `launcherMode=direct`; wrapper-launcher behavior is not
|
|
44
|
+
claimed.
|
|
45
|
+
- The same integrated run passed every steering evidence bit and left the
|
|
46
|
+
exact owned config byte-for-byte unchanged.
|
|
47
|
+
- A later post-review run passed the pre-spawn, replacement, and pre-steering
|
|
48
|
+
config attestations but the hosted model did not start the requested
|
|
49
|
+
synthetic sleep command within 60 seconds. No steering request was sent in
|
|
50
|
+
that run, so it is a setup-inconclusive trace rather than a contrary steering
|
|
51
|
+
result.
|
|
52
|
+
- A separate authenticated stop trace proved the missing supported protocol:
|
|
53
|
+
interrupt settles the turn, background-terminal clean is accepted, a fresh
|
|
54
|
+
first-page poll becomes empty, and the observed synthetic PID exits.
|
|
55
|
+
- A hard app-server-loss trace separately proved that replacement resume cannot
|
|
56
|
+
rediscover the old terminal and that the old command escapes the app-server
|
|
57
|
+
process group and POSIX session. This is a per-session OS-containment gap,
|
|
58
|
+
not evidence that `turn/interrupt` or tracked-terminal cleanup is absent.
|
|
59
|
+
- The final revised integrated authenticated checker passed named-profile,
|
|
60
|
+
ordered steering, definite stale steering, tracked-terminal stop, and every
|
|
61
|
+
same-user side-channel gate together and returned status 0.
|
|
62
|
+
|
|
63
|
+
## Named-profile checker contract
|
|
64
|
+
|
|
65
|
+
The checker requires externally provisioned deployment inputs:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
node scripts/spikes/codex-app-server-real.mjs \
|
|
69
|
+
--binary /absolute/versioned/path/to/codex \
|
|
70
|
+
--codex-home /absolute/non-temporary/codex-home \
|
|
71
|
+
--workspace /absolute/workspace \
|
|
72
|
+
--daemon-secret-root /absolute/daemon-secret-root
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Environment fallbacks are `POLYGRAM_CODEX_BIN`, `ORCHESTRA_CODEX_HOME`,
|
|
76
|
+
`ORCHESTRA_CODEX_WORKSPACE`, `ORCHESTRA_SESSION_LAUNCHER`, and the
|
|
77
|
+
path-delimited `ORCHESTRA_CODEX_DAEMON_SECRET_ROOTS`.
|
|
78
|
+
Each synthetic daemon-secret root must contain an owner-only regular
|
|
79
|
+
`.orchestra-codex-u1a-deny-probe` sentinel with no symlink or hard-link alias.
|
|
80
|
+
|
|
81
|
+
The checker never creates, copies, reads, hashes, or prints authentication
|
|
82
|
+
contents. `CODEX_HOME` must already exist, be canonical, non-temporary, owned
|
|
83
|
+
by the service user, and mode `0700`; its `config.toml` must be a real
|
|
84
|
+
owner-only file without hard-link aliases. When `auth.json` exists, it has the
|
|
85
|
+
same ownership, mode, regular-file, symlink, and hard-link requirements.
|
|
86
|
+
The exact config pins `cli_auth_credentials_store = "file"` so this validation
|
|
87
|
+
identity cannot silently reuse macOS Keychain credentials. Authentication must
|
|
88
|
+
be provisioned separately with the pinned CLI under that service identity.
|
|
89
|
+
Interactive `codex login` and app-server thread startup may append a
|
|
90
|
+
`[projects.<cwd>] trust_level = "trusted"` stanza to `config.toml`. The
|
|
91
|
+
reviewed config instead pins the exact validation workspace to
|
|
92
|
+
`trust_level = "untrusted"` so project-local config cannot become an
|
|
93
|
+
additional policy source. This setting survived the authenticated fresh,
|
|
94
|
+
resume, and steering runs byte-for-byte. The checker hashes the config before
|
|
95
|
+
any app-server starts, checks it before and after each connection attestation,
|
|
96
|
+
re-attests layers and requirements before fresh, resume, and steering thread
|
|
97
|
+
operations, and requires the same hash after every connection closes.
|
|
98
|
+
|
|
99
|
+
App-server starts as:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
codex app-server --strict-config --stdio
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Schema generation is a separate offline subcommand and must omit
|
|
106
|
+
`--strict-config`, which Codex 0.145.0 rejects for
|
|
107
|
+
`app-server generate-json-schema`. The compatibility bundle is generated
|
|
108
|
+
exactly as:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
codex app-server generate-json-schema --experimental --out <dir>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The generated bundle must contain `thread/settings/update`,
|
|
115
|
+
`thread/backgroundTerminals/list`, and
|
|
116
|
+
`thread/backgroundTerminals/clean`. Only the two terminal methods are in the
|
|
117
|
+
production request allowlist; the experimental settings mutation remains
|
|
118
|
+
characterization-only.
|
|
119
|
+
|
|
120
|
+
No `-c`, profile flag, legacy sandbox flag, or per-request permission selector
|
|
121
|
+
is sent. Initialization sets `capabilities.experimentalApi = true` because the
|
|
122
|
+
pinned stop protocol requires `thread/backgroundTerminals/list` and `clean`.
|
|
123
|
+
The checker does not allowlist per-terminal `terminate` or any other
|
|
124
|
+
experimental client method. Separate positive allowlists cover outbound
|
|
125
|
+
methods and inbound requests/notifications; malformed envelopes, response-ID
|
|
126
|
+
mismatches, and unexpected traffic latch a terminal protocol failure. Server
|
|
127
|
+
requests receive a method-not-found denial before termination. Terminal
|
|
128
|
+
command, cwd, handle, and OS metadata remain ephemeral and never enter errors
|
|
129
|
+
or the compatibility output. The authenticated run also pinned the benign
|
|
130
|
+
startup/lifecycle notifications that occur in this configuration:
|
|
131
|
+
remote-control status, MCP startup status, account rate-limit status, and
|
|
132
|
+
thread-goal updates/clears.
|
|
133
|
+
|
|
134
|
+
## Exact profile and attestation
|
|
135
|
+
|
|
136
|
+
The sole non-empty user layer must materialize:
|
|
137
|
+
|
|
138
|
+
- `cli_auth_credentials_store = "file"`;
|
|
139
|
+
- `default_permissions = "polygram-session"`;
|
|
140
|
+
- `approval_policy = "never"` and `approvals_reviewer = "user"`;
|
|
141
|
+
- `web_search = "disabled"` and `allow_login_shell = false`;
|
|
142
|
+
- command environment inheritance `none`, with controlled `HOME`, `TMPDIR`,
|
|
143
|
+
and `PATH`;
|
|
144
|
+
- `:minimal = "read"`, workspace-root `.` write access, absolute denies for
|
|
145
|
+
`CODEX_HOME` and every daemon-secret root, and profile network disabled;
|
|
146
|
+
- the exact validation workspace set to `trust_level = "untrusted"`;
|
|
147
|
+
- no active legacy sandbox, MCP, app, tool, skill, hook, plugin, selected
|
|
148
|
+
config profile, or marketplace capability.
|
|
149
|
+
|
|
150
|
+
`config/read` must include layers and origins. The checker records only the raw
|
|
151
|
+
owned-config SHA-256, canonical SHA-256 of the actual effective config, opaque
|
|
152
|
+
layer version, and layer types. It does not print config or credential contents. Non-empty
|
|
153
|
+
project/session/managed layers and source-origin drift fail closed.
|
|
154
|
+
`configRequirements/read` must allow the profile, `never`, and disabled web
|
|
155
|
+
search when requirements exist. `permissionProfile/list` is paginated and only
|
|
156
|
+
proves that the exact ID is selectable; it cannot substitute for attestation.
|
|
157
|
+
|
|
158
|
+
## Real enforcement performed by this subgate
|
|
159
|
+
|
|
160
|
+
Using stable `command/exec` without `env`, `sandboxPolicy`, or a profile
|
|
161
|
+
selector, content-free probes created under an atomically unique mode-`0700`
|
|
162
|
+
workspace directory must prove:
|
|
163
|
+
|
|
164
|
+
- a synthetic workspace file can be opened and a synthetic marker created;
|
|
165
|
+
- `CODEX_HOME/config.toml` and `auth.json` cannot be opened;
|
|
166
|
+
- the known sentinel inside every configured synthetic daemon-secret root
|
|
167
|
+
cannot be opened;
|
|
168
|
+
- the exact controlled netcat invocation can reach a loopback TCP canary
|
|
169
|
+
outside the command sandbox, then returns the pinned denied-connection status
|
|
170
|
+
inside it;
|
|
171
|
+
- no unexpected server request is emitted.
|
|
172
|
+
|
|
173
|
+
Only booleans, hashes, and probe exit-status codes are reported. Command stdout
|
|
174
|
+
and credential/account fields are not retained.
|
|
175
|
+
|
|
176
|
+
`account/read` uses `refreshToken: false` and records only whether the account
|
|
177
|
+
type is `chatgpt`.
|
|
178
|
+
|
|
179
|
+
Every production `turn/start` carries the complete catalog-validated
|
|
180
|
+
`model`/`effort` pair selected for that admission. Changing the local
|
|
181
|
+
selection preserves the process generation and provider thread, leaves an
|
|
182
|
+
active turn and its steering on their admitted pair, and applies to the next
|
|
183
|
+
turn. Dynamic settings notifications must agree with the attached, last
|
|
184
|
+
observed, admitting, or active pair while the full static permission,
|
|
185
|
+
workspace, approval, and provider policy remains exact.
|
|
186
|
+
|
|
187
|
+
Codex does not persist a resumable rollout for `thread/start` alone. The
|
|
188
|
+
checker therefore completes one fixed no-tools text turn, requires the matching
|
|
189
|
+
`turn/completed` with no tool-item type, and then starts a fresh app-server for
|
|
190
|
+
`thread/resume`. This persistence prerequisite passed in the authenticated
|
|
191
|
+
direct-binary run; it does not clear the broader hosted-tool enforcement gate.
|
|
192
|
+
|
|
193
|
+
## Profile provenance
|
|
194
|
+
|
|
195
|
+
Live pinned-runtime characterization found the exact profile at top-level
|
|
196
|
+
`activePermissionProfile` in both `thread/start` and `thread/resume`
|
|
197
|
+
responses. The value is fixture-pinned as `{id: "polygram-session",
|
|
198
|
+
extends: null}`. The generated stable response schemas do not declare that
|
|
199
|
+
field, and no matching `thread/settings/updated` notification was observed.
|
|
200
|
+
|
|
201
|
+
The named-profile subgate accepts this only as a pinned fresh-plus-resume pair
|
|
202
|
+
and reports:
|
|
203
|
+
|
|
204
|
+
- `provenanceSurface: "response-extension"`;
|
|
205
|
+
- `provenanceSchemaDeclared: false`;
|
|
206
|
+
- `provenanceFragile: true`.
|
|
207
|
+
|
|
208
|
+
A missing, different, or one-sided value remains a stop. Every Codex pin change
|
|
209
|
+
must regenerate the schema and rerun this live characterization.
|
|
210
|
+
|
|
211
|
+
## Active-turn steering capability passed; smoke setup remains fragile
|
|
212
|
+
|
|
213
|
+
The authenticated checker starts a dedicated fresh thread, requires one exact
|
|
214
|
+
`/bin/sleep 8` command, and writes two `turn/steer` requests back-to-back
|
|
215
|
+
before awaiting either response. The pinned runtime:
|
|
216
|
+
|
|
217
|
+
- returned the active turn ID for both requests;
|
|
218
|
+
- emitted the two `userMessage` item-start notifications in request order with
|
|
219
|
+
their distinct `clientUserMessageId` values;
|
|
220
|
+
- produced a schema-constrained final value containing both steered values in
|
|
221
|
+
the same order;
|
|
222
|
+
- emitted no turn error or unexpected tool item; and
|
|
223
|
+
- rejected a steer sent only after the matching terminal notification with
|
|
224
|
+
JSON-RPC `-32600` and exact message `no active turn to steer`.
|
|
225
|
+
|
|
226
|
+
This proves protocol intake, order, and semantic effect for the pinned
|
|
227
|
+
authenticated runtime. The exact stale message is not a documented stable
|
|
228
|
+
error type, so it remains a pin-fragile contract. `clientUserMessageId` is
|
|
229
|
+
correlation metadata only; no deduplication claim is made.
|
|
230
|
+
|
|
231
|
+
The scenario relies on the hosted model obeying an instruction to start the
|
|
232
|
+
synthetic sleep command so the turn remains active. That setup has both passed
|
|
233
|
+
and failed across bounded runs. A failed setup sends no `turn/steer` request
|
|
234
|
+
and therefore does not disprove the successful protocol trace, but this
|
|
235
|
+
model-dependent scenario is not a reliable rollout smoke. A future U1a
|
|
236
|
+
replacement needs a deterministic held-turn mechanism or must report setup
|
|
237
|
+
inconclusive separately from steering failure.
|
|
238
|
+
|
|
239
|
+
## Turn interruption and tracked-terminal cleanup passed
|
|
240
|
+
|
|
241
|
+
A bounded authenticated trace first completed an ordinary no-tools turn and
|
|
242
|
+
proved that a later `turn/interrupt` is rejected with JSON-RPC `-32600` and
|
|
243
|
+
exact message `no active turn to interrupt`.
|
|
244
|
+
|
|
245
|
+
A second turn then ran an exact synthetic command that wrote its PID to the
|
|
246
|
+
dedicated private fixture directory and `exec`'d a bounded 120-second sleep. After the command item had
|
|
247
|
+
started:
|
|
248
|
+
|
|
249
|
+
- `turn/interrupt` returned `{}`;
|
|
250
|
+
- that response arrived immediately before the matching `turn/completed`;
|
|
251
|
+
- the terminal turn status was `interrupted` with no turn error;
|
|
252
|
+
- the command PID was still alive;
|
|
253
|
+
- `thread/backgroundTerminals/list` reported the tracked terminal;
|
|
254
|
+
- `thread/backgroundTerminals/clean` accepted cleanup;
|
|
255
|
+
- a bounded poll from a null cursor observed an empty first page with no
|
|
256
|
+
`nextCursor`; and
|
|
257
|
+
- the observed synthetic PID exited well before its natural deadline.
|
|
258
|
+
|
|
259
|
+
`turn/interrupt` and `turn/completed` therefore settle the model turn but not
|
|
260
|
+
the tracked terminal; `clean` is the required second operation. Post-clean
|
|
261
|
+
emptiness is checked by polling a fresh first page each time, not by advancing
|
|
262
|
+
to the end of a mutable paginated snapshot. A natural-completion race may
|
|
263
|
+
continue to cleanup only when the stale interrupt is reconciled to the exact
|
|
264
|
+
durably observed terminal.
|
|
265
|
+
|
|
266
|
+
This is a tracked-terminal characterization, not complete tree proof. Pinned
|
|
267
|
+
source drains the in-memory terminal registry before invoking non-confirming
|
|
268
|
+
termination, and app-server reports no usable OS PID. The observed synthetic
|
|
269
|
+
PID check proves that one process died; it does not prove that a command could not
|
|
270
|
+
daemonize another descendant first.
|
|
271
|
+
|
|
272
|
+
The checker never signals the marker PID: PID lookup followed by `kill` would
|
|
273
|
+
be vulnerable to reuse and argv spoofing. It retries the app-server clean path,
|
|
274
|
+
observes liveness only, and gives the synthetic sleep a bounded natural
|
|
275
|
+
expiry. Production containment must use an atomic per-session job identity
|
|
276
|
+
rather than copy this diagnostic PID observation.
|
|
277
|
+
|
|
278
|
+
## Same-user side-channel characterization passed in the integrated checker
|
|
279
|
+
|
|
280
|
+
A bounded direct app-server characterization used the exact pinned named
|
|
281
|
+
profile plus host-positive synthetic canaries. Outside the Codex command
|
|
282
|
+
sandbox, the service identity could:
|
|
283
|
+
|
|
284
|
+
- observe a unique same-user process argument and sample that process;
|
|
285
|
+
- retrieve one unique synthetic generic-password Keychain item;
|
|
286
|
+
- reach synthetic local TCP, UDP, DNS-protocol, and Unix-socket listeners; and
|
|
287
|
+
- read a deliberately inherited descriptor in a positive-control child.
|
|
288
|
+
|
|
289
|
+
The corresponding `command/exec` probes recovered none of those canaries.
|
|
290
|
+
Every process, listener, socket, descriptor, fixture, and Keychain item was
|
|
291
|
+
bounded and cleaned; only booleans and exit codes were reported.
|
|
292
|
+
|
|
293
|
+
The durable checker now executes the exact process, Keychain, TCP, UDP, DNS,
|
|
294
|
+
and Unix-socket probe commands for both host-positive control and sandboxed
|
|
295
|
+
denial, retains the descriptor-specific positive control, force-terminates its
|
|
296
|
+
owned process canary, verifies Keychain absence after cleanup, and attempts
|
|
297
|
+
all cleanup paths before failing. The final integrated authenticated run
|
|
298
|
+
passed every control and denial. The Unix-socket control uses a short,
|
|
299
|
+
explicitly length-guarded macOS pathname and an asynchronous host runner so
|
|
300
|
+
the control cannot false-fail while Node's listener is blocked.
|
|
301
|
+
|
|
302
|
+
## Transport-cut classification is deterministic; persistence is unproved
|
|
303
|
+
|
|
304
|
+
The checker now tracks every currently allowlisted state-changing request
|
|
305
|
+
(`command/exec`, thread start/resume, turn start/steer/interrupt, and
|
|
306
|
+
background-terminal clean) as not-yet-written versus write-attempted.
|
|
307
|
+
Deterministic fake transports prove:
|
|
308
|
+
|
|
309
|
+
- a cut before start/steer write sends no request line and returns
|
|
310
|
+
`CODEX_RPC_NOT_SENT`;
|
|
311
|
+
- a full request line read followed by response loss returns
|
|
312
|
+
`CODEX_RPC_OUTCOME_UNKNOWN` for every classified state-changing method,
|
|
313
|
+
faults the connection, and is never retried;
|
|
314
|
+
- a matching-ID malformed response, including a late valid response after it,
|
|
315
|
+
retains the same unknown/faulted disposition; and
|
|
316
|
+
- a response timeout after write has the same unknown/faulted disposition.
|
|
317
|
+
|
|
318
|
+
Pinned schema checks confirm that start and steer accept
|
|
319
|
+
`clientUserMessageId`, and that resumed thread user-message items may expose it
|
|
320
|
+
as `clientId`. A bounded content-blind correlator treats zero resumed matches
|
|
321
|
+
as unknown, one exact match as observed, and duplicates or a steer match under
|
|
322
|
+
the wrong turn as conflicts. No uniqueness, idempotency, or deduplication claim
|
|
323
|
+
is made. A later authenticated proxy trace must still determine whether this
|
|
324
|
+
correlation survives real reconnect/resume; absence can never prove a request
|
|
325
|
+
was unsent.
|
|
326
|
+
|
|
327
|
+
## Hard app-server loss and daemon descendants remain uncontained
|
|
328
|
+
|
|
329
|
+
The app-server client starts the child below an owned POSIX supervisor that
|
|
330
|
+
remains the process-group leader through bounded TERM, group-membership
|
|
331
|
+
verification, explicit release, and KILL escalation. Fake and live effect
|
|
332
|
+
fixtures prove this removes ordinary descendants without signaling a reused
|
|
333
|
+
PGID. The real Codex PTY command created its own process group, escaped the
|
|
334
|
+
app-server POSIX session, was reparented, and remained alive after app-server
|
|
335
|
+
close. A replacement app-server resumed the thread but could neither list nor
|
|
336
|
+
clean the old terminal. The exposed `processId` was a random Codex-local
|
|
337
|
+
handle, not the OS PID.
|
|
338
|
+
|
|
339
|
+
Any later strong “no descendant survives `/stop` or app-server loss” contract
|
|
340
|
+
still needs one separately designed and proved boundary:
|
|
341
|
+
|
|
342
|
+
- a per-session cgroup/container/job that owns reparented descendants;
|
|
343
|
+
- a per-session ephemeral identity plus a trusted supervisor able to
|
|
344
|
+
enumerate, kill, and reap exactly that job without PID-reuse or cross-chat
|
|
345
|
+
risk;
|
|
346
|
+
- an upstream durable cleanup or externally usable OS-identity surface; or
|
|
347
|
+
- an explicitly approved weaker stop/crash contract with user-visible and
|
|
348
|
+
security consequences.
|
|
349
|
+
|
|
350
|
+
A common service user is credential isolation, not per-session containment.
|
|
351
|
+
The proof must include a deliberately daemonizing/`setsid` fixture in both
|
|
352
|
+
normal cleanup and hard app-server-loss cases.
|
|
353
|
+
|
|
354
|
+
## macOS containment alternatives characterized
|
|
355
|
+
|
|
356
|
+
The following are verified local facts, not an architecture approval:
|
|
357
|
+
|
|
358
|
+
- This host is Apple Silicon macOS 26.5.1. The installed
|
|
359
|
+
`launchd.plist(5)` contract kills only processes that retain the launchd
|
|
360
|
+
job's process-group ID. That is not a stronger boundary than the process
|
|
361
|
+
group already escaped by the real Codex PTY trace, so a per-chat launchd
|
|
362
|
+
job does not close this gate.
|
|
363
|
+
- Docker Desktop 29.5.2 is installed and currently serves Linux/arm64
|
|
364
|
+
containers. In a disposable Alpine container with no network, no host
|
|
365
|
+
mounts, a read-only root, a bounded PID limit, and automatic removal, an
|
|
366
|
+
in-container assertion first proved that a deliberately daemonizing
|
|
367
|
+
`setsid` child existed. Stopping the exact container ID then removed the
|
|
368
|
+
container.
|
|
369
|
+
- A second disposable fixture ran attached with stdin open, started the same
|
|
370
|
+
kind of daemonized child, and blocked its PID 1 on stdin. Killing only the
|
|
371
|
+
attached Docker client closed stdin; the container exited and was removed.
|
|
372
|
+
This is evidence that an attached-stdio wrapper can fail closed on
|
|
373
|
+
controller loss. It is not yet proof for the real Codex image or every
|
|
374
|
+
Polygram/launchd crash mode.
|
|
375
|
+
|
|
376
|
+
One container per live Codex chat is therefore the only locally demonstrated
|
|
377
|
+
strong macOS direction. A production design would run app-server as PID 1 (or
|
|
378
|
+
under a minimal init), store and generation-bind the exact container ID before
|
|
379
|
+
the first turn, mount no Docker socket, use neither privileged nor host PID/
|
|
380
|
+
network modes, expose only explicitly reviewed workspace and Codex-state
|
|
381
|
+
mounts, and reconcile labeled containers before accepting work after boot.
|
|
382
|
+
`/stop` can use the verified app-server interrupt/clean protocol for graceful
|
|
383
|
+
settlement and then stop/delete the exact container to make descendant death
|
|
384
|
+
the kernel/runtime boundary rather than a PID enumeration claim. Transport or
|
|
385
|
+
app-server loss would take the same container-ID stop path.
|
|
386
|
+
|
|
387
|
+
That direction is **not yet approved or proved for U1a**. It changes the
|
|
388
|
+
runtime from native macOS tools to a Linux tool image and adds image
|
|
389
|
+
construction, pinned Linux Codex distribution, ChatGPT credential mounting,
|
|
390
|
+
workspace bind-mount semantics, egress policy, Docker availability, boot
|
|
391
|
+
reconciliation, resource cost, and actual app-server stdin-loss tests. The
|
|
392
|
+
generic fixtures retire only the question “can a macOS-hosted boundary reap a
|
|
393
|
+
daemonized process atomically?”; they do not retire those integration risks.
|
|
394
|
+
|
|
395
|
+
The remaining alternatives have materially different contracts:
|
|
396
|
+
|
|
397
|
+
- Native app-server can keep the already verified normal interrupt/clean
|
|
398
|
+
behavior, but accepting possible daemon descendants after hard transport or
|
|
399
|
+
app-server loss would explicitly weaken R11/AE8. It must be a user-approved
|
|
400
|
+
product-contract revision, with a visible persisted `ContainmentFailed`
|
|
401
|
+
quarantine and no silent replacement.
|
|
402
|
+
- A dedicated macOS service identity could make all Codex workers one
|
|
403
|
+
deliberate global kill domain, but it needs privileged account/process
|
|
404
|
+
supervision, new credential provisioning, workspace ACLs, and cross-chat
|
|
405
|
+
blast radius. It is not an atomic per-session boundary and is not the
|
|
406
|
+
recommended first implementation.
|
|
407
|
+
- Apple's `container` tool uses a lightweight VM per Linux container on
|
|
408
|
+
Apple-silicon macOS 26, but it is not installed on this host and its upstream
|
|
409
|
+
project remains pre-1.0. It is a credible later alternative to Docker, not a
|
|
410
|
+
validated U1a dependency.
|
|
411
|
+
|
|
412
|
+
## U1b model, effort, and replacement-resume passed
|
|
413
|
+
|
|
414
|
+
The authenticated catalog was paginated through the allowlisted `model/list`
|
|
415
|
+
surface. The local validation boundary now projects only model slugs, default
|
|
416
|
+
effort, and the ordered supported-effort strings; descriptions and provider
|
|
417
|
+
metadata are not retained. The service identity advertised seven visible
|
|
418
|
+
models. `gpt-5.6-sol` was present with default `low` and selected `xhigh`.
|
|
419
|
+
|
|
420
|
+
A real hosted trace under Node v24.4.0:
|
|
421
|
+
|
|
422
|
+
1. started a fresh thread with exact model `gpt-5.6-sol`;
|
|
423
|
+
2. sent exact model plus `xhigh` on the first turn;
|
|
424
|
+
3. observed the exact model/effort settings update and a completed no-tools
|
|
425
|
+
turn;
|
|
426
|
+
4. closed that app-server and initialized a replacement;
|
|
427
|
+
5. resumed with no model, effort, provider, or config override;
|
|
428
|
+
6. observed exact resumed model plus `reasoningEffort = "xhigh"`; and
|
|
429
|
+
7. completed a later no-tools turn.
|
|
430
|
+
|
|
431
|
+
The same trace passed when invoked through `launchctl asuser 502` with an empty
|
|
432
|
+
ambient environment, the production Node binary, and the same dedicated
|
|
433
|
+
file-backed ChatGPT credential store. Fresh and resume readiness were 817 ms
|
|
434
|
+
and 787 ms in that run. This proves same-UID GUI-bootstrap authentication and
|
|
435
|
+
direct child pipes; it does not reproduce a launchd-managed job lifecycle or
|
|
436
|
+
claim a configured wrapper launcher.
|
|
437
|
+
|
|
438
|
+
The U1b trace established the original immutable-thread baseline. The current
|
|
439
|
+
product contract supersedes that restriction:
|
|
440
|
+
|
|
441
|
+
- validate both exact strings against the full paginated authenticated
|
|
442
|
+
catalog;
|
|
443
|
+
- keep the selected pair local until turn admission;
|
|
444
|
+
- send the complete pair on every `turn/start`;
|
|
445
|
+
- preserve an active turn and its steering on their admitted pair; and
|
|
446
|
+
- apply a later selection to the next turn without replacing the provider
|
|
447
|
+
thread.
|
|
448
|
+
|
|
449
|
+
The sanitized observation is
|
|
450
|
+
`tests/fixtures/codex-app-server-0.145.0/model-effort-observation.json`.
|
|
451
|
+
|
|
452
|
+
## G-MODEL-1 passed
|
|
453
|
+
|
|
454
|
+
`scripts/spikes/codex-app-server-model-settings.mjs` is the bounded
|
|
455
|
+
model-settings compatibility gate. Its raw app-server transport exposes
|
|
456
|
+
`thread/settings/update` only when that checker explicitly opts into
|
|
457
|
+
experimental characterization. The production client continues to reject the
|
|
458
|
+
method before writing bytes.
|
|
459
|
+
|
|
460
|
+
The gate covers:
|
|
461
|
+
|
|
462
|
+
1. a changed idle experimental update and its effective-settings
|
|
463
|
+
notification;
|
|
464
|
+
2. a repeated no-op update and whether a notification is emitted;
|
|
465
|
+
3. an update while one exact bounded sleep turn is active, proving the
|
|
466
|
+
original turn starts once and completes without interruption;
|
|
467
|
+
4. a product-path per-turn override, recording the ordering labels for
|
|
468
|
+
`thread/settings/updated`, `turn/started`, and the `turn/start` response;
|
|
469
|
+
5. replacement app-server resume of the same thread and another completed
|
|
470
|
+
turn; and
|
|
471
|
+
6. production allowlist exclusion.
|
|
472
|
+
|
|
473
|
+
Experimental response, notification, and sanitized error classes are
|
|
474
|
+
characterization evidence only. A rejected, unavailable, or drifted
|
|
475
|
+
`thread/settings/update` does not fail the product gate and cannot contaminate
|
|
476
|
+
its thread: idle/no-op characterization, active-turn characterization, and
|
|
477
|
+
the stable product proof use separate fresh app-server connections and
|
|
478
|
+
threads. The active lane must still prove that its original turn starts once
|
|
479
|
+
and completes without interruption when the experimental request returns a
|
|
480
|
+
definitive error. The stable gate depends on the separate product thread's
|
|
481
|
+
per-turn override completing, its notification/response ordering being
|
|
482
|
+
recorded as available, the same thread resuming with the selected pair, a
|
|
483
|
+
later turn completing, and production allowlist exclusion.
|
|
484
|
+
|
|
485
|
+
The process suite separately races local selection against held
|
|
486
|
+
`turn/start` admission and proves the admitted turn retains the old pair while
|
|
487
|
+
the next turn carries the new pair.
|
|
488
|
+
|
|
489
|
+
Run the real gate against the exact isolated service identity:
|
|
490
|
+
|
|
491
|
+
```sh
|
|
492
|
+
node scripts/spikes/codex-app-server-model-settings.mjs \
|
|
493
|
+
--binary /absolute/versioned/codex \
|
|
494
|
+
--codex-home /absolute/private/codex-home \
|
|
495
|
+
--workspace /absolute/isolated/workspace \
|
|
496
|
+
--daemon-secret-root /absolute/denied-root \
|
|
497
|
+
--model gpt-5.6-sol \
|
|
498
|
+
--effort xhigh
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
An alternate pair is selected deterministically from the authenticated
|
|
502
|
+
catalog. It can instead be pinned with matching `--alternate-model` and
|
|
503
|
+
`--alternate-effort` arguments.
|
|
504
|
+
|
|
505
|
+
The authenticated run against pinned Codex 0.145.0 passed. It selected
|
|
506
|
+
`gpt-5.6-sol/xhigh` as the baseline and the advertised
|
|
507
|
+
`gpt-5.6-sol/low` pair as the alternate. The product-path per-turn override
|
|
508
|
+
completed, emitted the expected settings observation, resumed the same thread
|
|
509
|
+
with the alternate pair, and completed a later turn. Experimental changed and
|
|
510
|
+
active updates returned empty success results with notifications; the
|
|
511
|
+
experimental no-op returned empty success without another notification. The
|
|
512
|
+
production client still rejected `thread/settings/update` before writing
|
|
513
|
+
bytes. The sanitized evidence is pinned in
|
|
514
|
+
`tests/fixtures/codex-app-server-0.145.0/model-settings-observation.json`.
|
|
515
|
+
|
|
516
|
+
## U1b retry ownership and effect windows passed
|
|
517
|
+
|
|
518
|
+
A disposable loopback Responses provider ran the real pinned app-server and
|
|
519
|
+
real command executor without hosted-provider nondeterminism. Its config used
|
|
520
|
+
the same named profile, no credentials, no inherited command environment,
|
|
521
|
+
disabled command network, `request_max_retries = 0`, and
|
|
522
|
+
`stream_max_retries = 1` for the retry lane.
|
|
523
|
+
|
|
524
|
+
The retry matrix proved:
|
|
525
|
+
|
|
526
|
+
- retryable success: one client `turn/start`, two provider attempts,
|
|
527
|
+
`error(willRetry=true)`, then one matching `turn/completed(completed)`;
|
|
528
|
+
- retryable exhaustion: one client start, two provider attempts,
|
|
529
|
+
`willRetry=true`, then `willRetry=false`, then one
|
|
530
|
+
`turn/completed(failed)`; and
|
|
531
|
+
- HTTP 400: one client start, one provider attempt, no retry signal, then
|
|
532
|
+
`willRetry=false` and one `turn/completed(failed)`.
|
|
533
|
+
|
|
534
|
+
A fourth scripted response emitted `response.created` and then withheld the
|
|
535
|
+
terminal while sending keepalives. The client observed its bounded timeout
|
|
536
|
+
after exactly one client start and one provider request, did not replay, then
|
|
537
|
+
interrupted the exact turn and observed `turn/completed(interrupted)`.
|
|
538
|
+
|
|
539
|
+
Codex core therefore owns provider retries. Polygram must never add a second
|
|
540
|
+
retry around an accepted turn. `willRetry=true` is intermediate; the exact
|
|
541
|
+
terminal remains authoritative for completion, and a bounded missing terminal
|
|
542
|
+
is a failure requiring reconciliation rather than replay.
|
|
543
|
+
|
|
544
|
+
The effect lane set provider retries to zero and ran six fresh turns: transport
|
|
545
|
+
loss and app-server loss after command item-start, after the fixture's exact
|
|
546
|
+
first output, and after the proxy received but withheld the exact terminal.
|
|
547
|
+
The marker helper used create-exclusive, fsync, a fixed output token, and
|
|
548
|
+
bounded self-expiry. Results were:
|
|
549
|
+
|
|
550
|
+
- both item-start cuts had no marker, yet remained `effect=unknown` and
|
|
551
|
+
`replayAllowed=false`;
|
|
552
|
+
- all first-output cuts had the exact durable marker and resumed as
|
|
553
|
+
`interrupted`;
|
|
554
|
+
- both terminal-generated-not-observed cuts had the marker and resumed as
|
|
555
|
+
`completed`; and
|
|
556
|
+
- no prompt was resent in any scenario.
|
|
557
|
+
|
|
558
|
+
This proves that neither item-start nor marker absence is a no-effect
|
|
559
|
+
checkpoint. Resume status is useful reconciliation evidence but never replay
|
|
560
|
+
truth. A written state-changing request without a client-observed terminal
|
|
561
|
+
stays non-replayable even if resume later says `completed`, `interrupted`, or
|
|
562
|
+
omits it.
|
|
563
|
+
|
|
564
|
+
The sanitized observation is
|
|
565
|
+
`tests/fixtures/codex-app-server-0.145.0/retry-effect-observation.json`.
|
|
566
|
+
|
|
567
|
+
## U1b resource and capacity characterization passed
|
|
568
|
+
|
|
569
|
+
The actual local deployment has no `ORCHESTRA_SESSION_LAUNCHER`; direct binary
|
|
570
|
+
mode is the local beta contract. Resource sampling used the production service
|
|
571
|
+
user and Node v24.4.0 on arm64 macOS 26.5.1. Each idle child initialized and
|
|
572
|
+
loaded one ephemeral thread. The controlled lab-only 10/25 points
|
|
573
|
+
intentionally ran outside the product lease and used concurrent local
|
|
574
|
+
`command/exec` sleeps to measure process, sandbox, stdio, RSS, and descriptor
|
|
575
|
+
overhead without spending 35 hosted turns. They are not product-valid
|
|
576
|
+
concurrent generations.
|
|
577
|
+
|
|
578
|
+
Median aggregate idle root RSS was approximately:
|
|
579
|
+
|
|
580
|
+
- 114 MiB for one app-server;
|
|
581
|
+
- 1.09 GiB for ten; and
|
|
582
|
+
- 2.74 GiB for twenty-five.
|
|
583
|
+
|
|
584
|
+
Median tree descriptor counts were 31, 315, and 775. The 25-child active local
|
|
585
|
+
proxy peaked near 2.85 GiB summed tree RSS and 901 descriptors, with 25 command
|
|
586
|
+
descendants. Summed RSS is an upper bound because shared pages can be counted
|
|
587
|
+
more than once. These are short local-overhead observations, not hosted-turn
|
|
588
|
+
latency, token-dependent memory, rate-limit, or soak measurements.
|
|
589
|
+
|
|
590
|
+
The required single hosted-active point also passed: while one real
|
|
591
|
+
`gpt-5.6-sol` turn held an exact eight-second command, median root RSS was
|
|
592
|
+
about 120 MiB, tree RSS peaked near 123 MiB, median tree descriptors were 38,
|
|
593
|
+
and one command descendant was present. Nineteen warm same-child
|
|
594
|
+
`account/read` controls measured 2 ms p50 and 13 ms p95/max. The hosted point is
|
|
595
|
+
one characterization sample, not a service-latency percentile or SLA.
|
|
596
|
+
|
|
597
|
+
Per-chat app-server scaling is therefore too expensive for the native MVP even
|
|
598
|
+
before the containment contract is considered. The product limit remains one
|
|
599
|
+
live native Codex generation per Polygram daemon; dormant chat rows own no
|
|
600
|
+
app-server child. U4 must reject every same- or different-workspace competitor
|
|
601
|
+
before factory construction, spawn, RPC write, or session-state mutation.
|
|
602
|
+
The recommended typed diagnostic is `CODEX_DAEMON_GENERATION_BUSY`, distinct
|
|
603
|
+
from same-session switch-in-flight and daemon quarantine. A rejected request
|
|
604
|
+
must not reveal the owner chat, cwd, thread ID, or generation ID.
|
|
605
|
+
|
|
606
|
+
The sanitized measurements are
|
|
607
|
+
`tests/fixtures/codex-app-server-0.145.0/resource-observation.json`.
|
|
608
|
+
|
|
609
|
+
## U1 complete; U2 may start
|
|
610
|
+
|
|
611
|
+
Both U1a and U1b return `CONTINUE`. The accepted native-beta contract treats
|
|
612
|
+
hard-loss descendant escape as a documented limitation with daemon-wide
|
|
613
|
+
same-host reboot quarantine, not as a claim that normal turn stop is absent.
|
|
614
|
+
Normal stop remains interrupt, exact terminal reconciliation, background
|
|
615
|
+
terminal clean, and a fresh empty first-page check.
|
|
616
|
+
|
|
617
|
+
The remaining operational qualification is rollout-only:
|
|
618
|
+
|
|
619
|
+
- there is no session wrapper launcher on this Mac, so wrapper behavior is
|
|
620
|
+
N/A rather than passed;
|
|
621
|
+
- the `launchctl asuser` run proves same-UID GUI-bootstrap auth and direct
|
|
622
|
+
child pipes but does not load or signal a disposable launchd plist;
|
|
623
|
+
- Linux/systemd and other hosts require their own launcher characterization;
|
|
624
|
+
and
|
|
625
|
+
- no production daemon, service, config, or credential contents were touched.
|
|
626
|
+
|
|
627
|
+
U2 may implement the narrow line-delimited client. It must preserve the
|
|
628
|
+
prepared/write-attempted/response-observed ledger, Codex-owned retry rule,
|
|
629
|
+
unknown-effect non-replay rule, immutable model/effort thread policy, exact
|
|
630
|
+
profile provenance, one-live daemon lease, and accepted quarantine contract.
|
|
631
|
+
No Orchestra backend or Claude behavior has been changed by U1.
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @shumkov/orchestra —
|
|
2
|
-
// Spawn,
|
|
1
|
+
// @shumkov/orchestra — transport-agnostic Claude Code and Codex sessions.
|
|
2
|
+
// Spawn, steer, supervise, observe turns, and recover.
|
|
3
3
|
// Extracted from polygram after water proved the copy (see docs/EXTRACTION.md).
|
|
4
4
|
//
|
|
5
5
|
// The engine is parameterized by the consumer (toolDispatcher, displayHint,
|
|
@@ -11,6 +11,21 @@
|
|
|
11
11
|
const { Process, UnsupportedOperationError } = require('./lib/process/process');
|
|
12
12
|
const { ProcessManager, CALLBACK_TO_EVENT } = require('./lib/process/process-manager');
|
|
13
13
|
const { CliProcess } = require('./lib/process/cli-process');
|
|
14
|
+
const { CodexProcess } = require('./lib/process/codex-process');
|
|
15
|
+
const {
|
|
16
|
+
assertCodexSpawnProfile,
|
|
17
|
+
CodexPreflightError,
|
|
18
|
+
createCodexSpawnProfile,
|
|
19
|
+
preflightCodexRuntime,
|
|
20
|
+
reattestCodexStaticPolicy,
|
|
21
|
+
} = require('./lib/codex/preflight');
|
|
22
|
+
const {
|
|
23
|
+
attestPinnedCodexHome,
|
|
24
|
+
buildCodexAppServerEnv,
|
|
25
|
+
CodexAppServerClient,
|
|
26
|
+
CodexAppServerError,
|
|
27
|
+
protocolSchema: codexProtocolSchema,
|
|
28
|
+
} = require('./lib/codex/app-server-client');
|
|
14
29
|
const sdkProcess = require('./lib/process/sdk-process');
|
|
15
30
|
const { SdkProcess, extractAssistantText, sumUsage, makeInputController } = sdkProcess;
|
|
16
31
|
const { createProcessFactory, pickBackend } = require('./lib/process/factory');
|
|
@@ -37,7 +52,7 @@ const approvalsStore = require('./lib/approvals/store');
|
|
|
37
52
|
|
|
38
53
|
module.exports = {
|
|
39
54
|
// pool + driver
|
|
40
|
-
Process, UnsupportedOperationError, ProcessManager, CALLBACK_TO_EVENT, CliProcess, SdkProcess, extractAssistantText, sumUsage, makeInputController, createProcessFactory, pickBackend,
|
|
55
|
+
Process, UnsupportedOperationError, ProcessManager, CALLBACK_TO_EVENT, CliProcess, CodexProcess, CodexAppServerClient, CodexAppServerError, CodexPreflightError, SdkProcess, extractAssistantText, sumUsage, makeInputController, createProcessFactory, pickBackend, preflightCodexRuntime, reattestCodexStaticPolicy, createCodexSpawnProfile, assertCodexSpawnProfile, attestPinnedCodexHome, buildCodexAppServerEnv, codexProtocolSchema,
|
|
41
56
|
// channels bridge (MCP injection protocol)
|
|
42
57
|
ChannelsBridgeServer, bridgeProtocol,
|
|
43
58
|
// tmux lifecycle
|